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

Dustin Collins strega at bestpractical.com
Sun Sep 4 02:36:43 EDT 2016


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

- Log -----------------------------------------------------------------
commit 5aaf1e007803203103d21ad4544965d1fcfe4ec0
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/lib/RT/Config.pm b/lib/RT/Config.pm
index 71e727f..62034ba 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -307,6 +307,16 @@ our %META;
             Hints       => 'Only for entry, not display', #loc
         },
     },
+    DefaultForceSystemContextMenu => {
+        Section         => 'Ticket composition', #loc
+        Overridable     => 1,
+        SortOrder       => 10,
+        Widget          => '/Widgets/Form/Boolean',
+        WidgetArguments => {
+            Description => 'Force browser right click menue', #loc
+            Hints       => 'Only applies to rich text editor', #loc
+        },
+    },
     RefreshIntervals => {
         Type => 'ARRAY',
         PostLoadCheck => sub {
diff --git a/share/html/Elements/JavascriptConfig b/share/html/Elements/JavascriptConfig
index a03d6d2..bdf69d1 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 DefaultForceSystemContextMenu);
 
 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..9112da7 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -238,6 +238,10 @@ function ReplaceAllTextareas() {
         sAgent.indexOf('ipad') != -1 ||
         sAgent.indexOf('android') != -1 )
         return false;
+    
+    if (RT.Config.DefaultForceSystemContextMenu) {
+        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