[Rt-commit] rt branch, 4.2/ckeditor-context-menu-preference, created. rt-4.2.13-53-ge45039a

Dustin Collins strega at bestpractical.com
Tue Sep 13 11:57:26 EDT 2016


The branch, 4.2/ckeditor-context-menu-preference has been created
        at  e45039a44ec87da7b8203e65d164add8ec40450c (commit)

- Log -----------------------------------------------------------------
commit e45039a44ec87da7b8203e65d164add8ec40450c
Author: Dustin Collins <strega at bestpractical.com>
Date:   Sun Sep 4 02:36:30 2016 -0400

    Add user preference to disable CKEditor context menu
    
    The custom context menu for CKEditor blocks built in browser context
    menu features such as spellcheck, dictionary and browser extension
    options. Added a user preference that will force use of the system
    right click menu by removing the CKEditor plugins associated with the
    editors custom context menu.
    
    Fixes I#32274

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 6a711d4..171515c 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1715,6 +1715,19 @@ send HTML email messages from the web interface.
 
 Set($MessageBoxRichText, 1);
 
+=item C<$MessageBoxUseSystemContextMenu>
+
+Should the "rich text" editor use the browser's right-click menu?
+
+The rich text editor's custom menu can block system functionality like spell check,
+dictionary lookup and browser extension options. Enabling this option allows the browser's
+native right click menu to be used; However, enabling this option may also prevent
+pasting rich text from other applications.
+
+=cut
+
+Set($MessageBoxUseSystemContextMenu, 0);
+
 =item C<$MessageBoxRichTextHeight>
 
 Height of rich text JavaScript enabled editing boxes (in pixels)
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 71e727f..4fd8708 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -270,6 +270,15 @@ our %META;
             Description => 'WYSIWYG message composer' # loc
         }
     },
+    MessageBoxUseSystemContextMenu => {
+        Section         => 'Ticket composition', #loc
+        Overridable     => 1,
+        SortOrder       => 5.2,
+        Widget          => '/Widgets/Form/Boolean',
+        WidgetArguments => {
+            Description => 'WYSIWYG Force browser-right click menu', #loc
+        },
+    },
     MessageBoxRichTextHeight => {
         Section => 'Ticket composition',
         Overridable => 1,
diff --git a/share/html/Elements/JavascriptConfig b/share/html/Elements/JavascriptConfig
index a03d6d2..f568e76 100644
--- a/share/html/Elements/JavascriptConfig
+++ b/share/html/Elements/JavascriptConfig
@@ -48,7 +48,7 @@
 <%init>
 my $Config = {};
 $Config->{$_} = RT->Config->Get( $_, $session{CurrentUser} )
-  for qw(rtname WebPath MessageBoxRichTextHeight);
+  for qw(rtname WebPath MessageBoxRichTextHeight MessageBoxUseSystemContextMenu);
 
 my $CurrentUser = {};
 if ($session{CurrentUser} and $session{CurrentUser}->id) {
diff --git a/share/static/js/util.js b/share/static/js/util.js
index f6f5c3b..568c9ef 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -239,6 +239,10 @@ function ReplaceAllTextareas() {
         sAgent.indexOf('android') != -1 )
         return false;
 
+    if (RT.Config.MessageBoxUseSystemContextMenu) {
+        CKEDITOR.config.removePlugins = 'liststyle,tabletools,scayt,menubutton,contextmenu';
+    }
+
     // replace all content and signature message boxes
     var allTextAreas = document.getElementsByTagName("textarea");
 

-----------------------------------------------------------------------


More information about the rt-commit mailing list