Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature-2.x-font-awesome-5'
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	dist/font/context-menu-icons.eot
#	dist/font/context-menu-icons.ttf
#	dist/font/context-menu-icons.woff
#	dist/font/context-menu-icons.woff2
#	dist/jquery.contextMenu.css
#	dist/jquery.contextMenu.js
#	dist/jquery.contextMenu.min.css
#	dist/jquery.contextMenu.min.css.map
#	dist/jquery.contextMenu.min.js
#	dist/jquery.contextMenu.min.js.map
#	src/sass/icons/_variables.scss
  • Loading branch information
bbrala committed Jul 12, 2018
2 parents 1742a80 + a8b95d0 commit 703f2f9
Show file tree
Hide file tree
Showing 17 changed files with 126 additions and 35 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
* Fixed typo in documentation which breaks the `callback` demo.
* Fixed typo `promis` => `promise` ([Issue #633](https://github.com/swisnl/jQuery-contextMenu/issues/633)).

#### Added

* Added support for Font Awesome 5 ([Issue #593](https://github.com/swisnl/jQuery-contextMenu/issues/593)), ([Issue #593](https://github.com/swisnl/jQuery-contextMenu/issues/593))

### 2.6.4

#### Fixed
Expand Down
Binary file modified dist/font/context-menu-icons.eot
Binary file not shown.
Binary file modified dist/font/context-menu-icons.ttf
Binary file not shown.
Binary file modified dist/font/context-menu-icons.woff
Binary file not shown.
Binary file modified dist/font/context-menu-icons.woff2
Binary file not shown.
24 changes: 21 additions & 3 deletions dist/jquery.contextMenu.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
* Date: 2018-07-10T11:22:08.713Z
* Date: 2018-07-11T17:37:50.000Z
*/
@-webkit-keyframes cm-spin {
0% {
Expand Down Expand Up @@ -54,8 +54,8 @@
font-style: normal;
font-weight: normal;

src: url("font/context-menu-icons.eot?2zb9c");
src: url("font/context-menu-icons.eot?2zb9c#iefix") format("embedded-opentype"), url("font/context-menu-icons.woff2?2zb9c") format("woff2"), url("font/context-menu-icons.woff?2zb9c") format("woff"), url("font/context-menu-icons.ttf?2zb9c") format("truetype");
src: url("font/context-menu-icons.eot?22n6c");
src: url("font/context-menu-icons.eot?22n6c#iefix") format("embedded-opentype"), url("font/context-menu-icons.woff2?22n6c") format("woff2"), url("font/context-menu-icons.woff?22n6c") format("woff"), url("font/context-menu-icons.ttf?22n6c") format("truetype");
}

.context-menu-icon-add:before {
Expand Down Expand Up @@ -157,6 +157,24 @@
color: #bbb;
}

.context-menu-icon.context-menu-icon--fa5 {
display: list-item;
font-family: inherit;
line-height: inherit;
}
.context-menu-icon.context-menu-icon--fa5 i, .context-menu-icon.context-menu-icon--fa5 svg {
position: absolute;
top: .3em;
left: .5em;
color: #2980b9;
}
.context-menu-icon.context-menu-icon--fa5.context-menu-hover i, .context-menu-icon.context-menu-icon--fa5.context-menu-hover svg {
color: #fff;
}
.context-menu-icon.context-menu-icon--fa5.context-menu-disabled i, .context-menu-icon.context-menu-icon--fa5.context-menu-disabled svg {
color: #bbb;
}

.context-menu-list {
position: absolute;
display: inline-block;
Expand Down
41 changes: 28 additions & 13 deletions dist/jquery.contextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
* Date: 2018-07-10T11:22:08.665Z
* Date: 2018-07-10T10:24:25.826Z
*/

// jscs:disable
Expand Down Expand Up @@ -116,7 +116,7 @@
// flag denoting if a second trigger should simply move (true) or rebuild (false) an open menu
// as long as the trigger happened on one of the trigger-element's child nodes
reposition: true,
// Flag denoting if a second trigger should close the menu, as long as
// Flag denoting if a second trigger should close the menu, as long as
// the trigger happened on one of the trigger-element's child nodes.
// This overrides the reposition option.
hideOnSecondTrigger: false,
Expand Down Expand Up @@ -466,12 +466,12 @@
$(target).trigger(e);
root.$layer.show();
}

if (root.hideOnSecondTrigger && triggerAction && root.$menu !== null && typeof root.$menu !== 'undefined') {
root.$menu.trigger('contextmenu:hide');
return;
}

if (root.reposition && triggerAction) {
if (document.elementFromPoint) {
if (root.$trigger.is(target)) {
Expand Down Expand Up @@ -1001,7 +1001,7 @@
// position and show context menu
opt.$menu.css(css)[opt.animation.show](opt.animation.duration, function () {
$trigger.trigger('contextmenu:visible');

op.activated(opt);
opt.events.activated(opt);
});
Expand Down Expand Up @@ -1213,9 +1213,7 @@
$t.addClass('context-menu-separator ' + root.classNames.notSelectable);
} else if (item.type === 'html') {
$t.addClass('context-menu-html ' + root.classNames.notSelectable);
} else if (item.type === 'sub') {
// We don't want to execute the next else-if if it is a sub.
} else if (item.type) {
} else if (item.type !== 'sub' && item.type) {
$label = $('<label></label>').appendTo($t);
createNameNode(item).appendTo($label);

Expand Down Expand Up @@ -1330,14 +1328,27 @@
if ($.isFunction(item.icon)) {
item._icon = item.icon.call(this, this, $t, key, item);
} else {
if (typeof(item.icon) === 'string' && item.icon.substring(0, 3) === 'fa-') {
if (typeof(item.icon) === 'string' && (
item.icon.substring(0, 4) === 'fab '
|| item.icon.substring(0, 4) === 'fas '
|| item.icon.substring(0, 4) === 'far '
|| item.icon.substring(0, 4) === 'fal ')
) {
// to enable font awesome
$t.addClass(root.classNames.icon + ' ' + root.classNames.icon + '--fa5');
item._icon = $('<i class="' + item.icon + '"></i>');
} else if (typeof(item.icon) === 'string' && item.icon.substring(0, 3) === 'fa-') {
item._icon = root.classNames.icon + ' ' + root.classNames.icon + '--fa fa ' + item.icon;
} else {
item._icon = root.classNames.icon + ' ' + root.classNames.icon + '-' + item.icon;
}
}
$t.addClass(item._icon);

if(typeof(item._icon) === "string"){
$t.addClass(item._icon);
} else {
$t.prepend(item._icon);
}
}
}

Expand Down Expand Up @@ -1433,8 +1444,12 @@

if ($.isFunction(item.icon)) {
$item.removeClass(item._icon);
item._icon = item.icon.call(this, $trigger, $item, key, item);
$item.addClass(item._icon);
var iconResult = item.icon.call(this, $trigger, $item, key, item);
if(typeof(iconResult) === "string"){
$item.addClass(iconResult);
} else {
$item.prepend(iconResult);
}
}

if (item.type) {
Expand Down Expand Up @@ -1565,7 +1580,7 @@
$menu.css({
'top': '0px'
});
}
}
}
};

Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.contextMenu.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 703f2f9

Please sign in to comment.