Skip to content

Commit

Permalink
Grouping ckeditor5 toolbar for small textarea inputs
Browse files Browse the repository at this point in the history
For inputs like html custom fields on ticket create page, the full expanded
toolbar takes too much space.
  • Loading branch information
sunnavy committed Jun 5, 2024
1 parent 47c318a commit 04a898c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion share/static/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 04a898c

Please sign in to comment.