From 04a898c8d82fa22495db442db1dc83dd384015f6 Mon Sep 17 00:00:00 2001 From: sunnavy Date: Thu, 11 Jan 2024 17:14:31 -0500 Subject: [PATCH] Grouping ckeditor5 toolbar for small textarea inputs For inputs like html custom fields on ticket create page, the full expanded toolbar takes too much space. --- share/static/js/util.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/share/static/js/util.js b/share/static/js/util.js index 7f235692b14..41a219dbd45 100644 --- a/share/static/js/util.js +++ b/share/static/js/util.js @@ -408,8 +408,13 @@ function ReplaceAllTextareas(elt) { // with different number of rows height = textArea.offsetHeight + 54; } + + // Customize shouldNotGroupWhenFull based on textarea width + const initArgs = JSON.parse(JSON.stringify(RT.Config.MessageBoxRichTextInitArguments)); + initArgs.toolbar.shouldNotGroupWhenFull = textArea.offsetWidth >= 600 ? true : false; + ClassicEditor - .create( textArea, RT.Config.MessageBoxRichTextInitArguments ) + .create( textArea, initArgs ) .then(editor => { CKEDITOR.instances[editor.sourceElement.name] = editor; // the height of element(.ck-editor__editable_inline) is reset on focus,