Skip to content
This repository has been archived by the owner on Aug 14, 2021. It is now read-only.

Commit

Permalink
Add new menu option isHeader for category headers
Browse files Browse the repository at this point in the history
Close #100
  • Loading branch information
mar10 committed May 14, 2016
1 parent 7cf32e3 commit 733a4ff
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# 1.11.1-0 / Unreleased

* [FEATURE] Support jQuery UI 1.12 (wrap menu items in separate `<div>` tags)
* Add jQuery Ui 1.12 sample with new 'Base' theme
* [FEATURE] #100 new menu option `isHeader` for category headers.
* Add jQuery UI 1.12 sample with new 'Base' theme

# 1.11.0 / 2015-09-10

Expand Down
1 change: 1 addition & 0 deletions demo/index-1-12.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
preventSelect: true,
taphold: true,
menu: [
{title: "Menu Header", isHeader: true},
{title: "Cut <kbd>Ctrl+X</kbd>", cmd: "cut", uiIcon: "ui-icon-scissors"},
{title: "Copy <kbd>Ctrl+C</kbd>", cmd: "copy", uiIcon: "ui-icon-copy"},
{title: "Paste <kbd>Ctrl+V</kbd>", cmd: "paste", uiIcon: "ui-icon-clipboard", disabled: true },
Expand Down
Binary file added demo/teaser-1.11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/teaser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions jquery.ui-contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ $.widget("moogle.contextmenu", {
.addClass(opts.addClass)
// Create a menu instance that delegates events to our widget
.menu($.extend(true, {}, opts.uiMenuOptions, {
items: "> :not(.ui-widget-header)",
blur: $.proxy(opts.blur, this),
create: $.proxy(opts.createMenu, this),
focus: $.proxy(opts.focus, this),
Expand Down Expand Up @@ -422,6 +423,9 @@ $.extend($.moogle.contextmenu, {
if ( entry.disabled ) {
$parentLi.addClass("ui-state-disabled");
}
if ( entry.isHeader ) {
$parentLi.addClass("ui-widget-header");
}
if ( entry.addClass ) {
$parentLi.addClass(entry.addClass);
}
Expand Down

3 comments on commit 733a4ff

@maasha
Copy link

@maasha maasha commented on 733a4ff May 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I did a git pull and copied the latest min.js file and isHeader didn't work. Using the addClass as first suggest was OK, however, there is a CSS glitch: The header is in bold until mouse-over, then it shifts to normal font. I have no CSS messing with fonts, only default CSS from jQuiry-ui and jQuery-ui-contextmenu. Last, the header is clickable - I am not sure that is sensible - at least it is not how "categories" in jQuery-ui behaves.

@mar10
Copy link
Owner Author

@mar10 mar10 commented on 733a4ff May 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minified files will be available with the next release.
If it is clickable, then you might have set uiMenuOptions wrong?
Problems should discussed here: #100

Here is a working demo
http://wwwendt.de/tech/demo/jquery-contextmenu/demo/index-1-12.html

@maasha
Copy link

@maasha maasha commented on 733a4ff May 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotit, super!

Please sign in to comment.