[Rt-commit] rt branch 5.0/collapse-ckeditor-toolbar created. rt-5.0.2-84-g764f16cfc2

BPS Git Server git at git.bestpractical.com
Wed Feb 23 21:28:48 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/collapse-ckeditor-toolbar has been created
        at  764f16cfc2a450fd146ebb8f3870658b091cec55 (commit)

- Log -----------------------------------------------------------------
commit 764f16cfc2a450fd146ebb8f3870658b091cec55
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Feb 24 05:13:27 2022 +0800

    Make ckeditor toolbar collapsable and remember its state

diff --git a/share/static/RichText/config.js b/share/static/RichText/config.js
index 1d1ee3141e..984d0a9146 100644
--- a/share/static/RichText/config.js
+++ b/share/static/RichText/config.js
@@ -33,4 +33,5 @@ CKEDITOR.editorConfig = function( config ) {
     }
 
     config.disableNativeSpellChecker = false;
+    config.toolbarCanCollapse = true;
 };
diff --git a/share/static/js/util.js b/share/static/js/util.js
index e5e93311e0..6abfe04d2b 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -374,7 +374,11 @@ function ReplaceAllTextareas() {
             // Set the type
             type.val("text/html");
 
-            CKEDITOR.replace(textArea.name,{ width: '100%', height: RT.Config.MessageBoxRichTextHeight });
+            CKEDITOR.replace(textArea.name, {
+                width: '100%',
+                height: RT.Config.MessageBoxRichTextHeight,
+                toolbarStartupExpanded: jQuery.cookie('cke_' + textArea.name + '-toolbar') == 0 ? false : true
+            });
 
             jQuery('[name="' + textArea.name + '___Frame"]').addClass("richtext-editor");
         }
@@ -864,6 +868,14 @@ jQuery(function() {
             file_input.prop('checked', false);
         });
     });
+
+    CKEDITOR.on('instanceReady', function(e){
+        jQuery('div.cke.' + e.editor.id + ' .cke_toolbox_collapser').click( function() {
+            createCookie(jQuery(this).closest('div.cke').attr('id') + '-toolbar', jQuery(this).hasClass(
+                'cke_toolbox_collapser_min') ? 0 : 1, 365);
+            return 1;
+        });
+    });
 });
 
 /* inline edit */

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list