From 92ee0f2721625dfa567fe6ca65aeb81f6c6ab27a Mon Sep 17 00:00:00 2001 From: Travis Van Couvering <42187666+RentecTravis@users.noreply.github.com> Date: Thu, 30 Jan 2025 01:58:24 +0000 Subject: [PATCH] Support Font Awesome 6 icon classNames --- src/jquery.contextMenu.js | 11 ++++------- src/sass/jquery.contextMenu.scss | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/jquery.contextMenu.js b/src/jquery.contextMenu.js index ace46e63..b82a0448 100644 --- a/src/jquery.contextMenu.js +++ b/src/jquery.contextMenu.js @@ -1339,15 +1339,12 @@ if ($.isFunction(item.icon)) { item._icon = item.icon.call(this, this, $t, key, item); } else { - if (typeof(item.icon) === 'string' && ( - item.icon.substring(0, 4) === 'fab ' - || item.icon.substring(0, 4) === 'fas ' - || item.icon.substring(0, 4) === 'fad ' - || item.icon.substring(0, 4) === 'far ' - || item.icon.substring(0, 4) === 'fal ') + if ( + typeof(item.icon) === 'string' + && /^fa[lrsdbt]{1,3}\s+|fa-(?:solid|regular|light|thin|duotone|brands|sharp|sharp-duotone)\s+/.test(item.icon) ) { // to enable font awesome - $t.addClass(root.classNames.icon + ' ' + root.classNames.icon + '--fa5'); + $t.addClass(root.classNames.icon + ' ' + root.classNames.icon + '--fa6'); item._icon = $(''); } else if (typeof(item.icon) === 'string' && item.icon.substring(0, 3) === 'fa-') { item._icon = root.classNames.icon + ' ' + root.classNames.icon + '--fa fa ' + item.icon; diff --git a/src/sass/jquery.contextMenu.scss b/src/sass/jquery.contextMenu.scss index da4768b7..eebf7d27 100644 --- a/src/sass/jquery.contextMenu.scss +++ b/src/sass/jquery.contextMenu.scss @@ -46,7 +46,7 @@ } } - &.context-menu-icon--fa5 { + &.context-menu-icon--fa6 { display: list-item; font-family: inherit; line-height: inherit;