From 9e6b69f20b08393d396f52a0e13c10ed05b3a8b0 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Tue, 9 Jul 2024 10:31:20 +0100 Subject: [PATCH 01/15] Update: From ckeditor4 4.17.0 to ckeditor5 42.0.0 (fixes #2772) --- .../scaffold/backboneFormsOverrides.js | 55 ++++-- routes/index/index.hbs | 156 +++++++++++++++++- 2 files changed, 193 insertions(+), 18 deletions(-) diff --git a/frontend/src/modules/scaffold/backboneFormsOverrides.js b/frontend/src/modules/scaffold/backboneFormsOverrides.js index 0c091bed8..8134e490c 100644 --- a/frontend/src/modules/scaffold/backboneFormsOverrides.js +++ b/frontend/src/modules/scaffold/backboneFormsOverrides.js @@ -85,7 +85,7 @@ define([ } until(isAttached(this.$el)).then(function() { - this.editor = CKEDITOR.replace(this.$el[0], { + this.editor = CKEDITOR.create(this.$el[0], { dataIndentationChars: '', disableNativeSpellChecker: false, enterMode: CKEDITOR[Origin.constants.ckEditorEnterMode], @@ -112,24 +112,45 @@ define([ elements.forEach(function(element) { writer.setRules(element, rules); }); } }, - toolbar: [ - { name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source', '-', 'ShowBlocks' ] }, - { name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] }, - { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll' ] }, - { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv' ] }, - { name: 'direction', items: [ 'BidiLtr', 'BidiRtl' ] }, - '/', - { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] }, - { name: 'styles', items: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] }, - { name: 'links', items: [ 'Link', 'Unlink' ] }, - { name: 'colors', items: [ 'TextColor', 'BGColor' ] }, - { name: 'insert', items: [ 'SpecialChar', 'Table' ] }, - { name: 'tools', items: [] }, - { name: 'others', items: [ '-' ] } - ] + plugins: window.CKEDITOR.pluginsConfig, + toolbar: { + items: [ + 'sourceEditing', + 'showBlocks', + 'undo', + 'redo', + '|', + 'findAndReplace', + 'selectAll', + '|', + 'numberedList', + 'bulletedList', + 'blockQuote', + 'indent', + 'outdent', + '|', + 'heading', + '|', + 'bold', + 'italic', + 'underline', + 'strikethrough', + 'subscript', + 'superscript', + 'alignment', + 'removeFormat', + '|', + 'link', + 'fontColor', + 'fontBackgroundColor', + '|', + 'specialCharacters', + 'insertTable' + ], + shouldNotGroupWhenFull: true + } }); }.bind(this)); - return this; }; diff --git a/routes/index/index.hbs b/routes/index/index.hbs index 2ebbecf0c..356aa581c 100644 --- a/routes/index/index.hbs +++ b/routes/index/index.hbs @@ -6,7 +6,7 @@ - + {{#if isProduction}} {{else}} @@ -47,5 +47,159 @@ + + + From 3f68a1c326bda4e608ced63d6edec2760277f2ce Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Tue, 9 Jul 2024 10:33:05 +0100 Subject: [PATCH 02/15] Remove extra script tag --- routes/index/index.hbs | 3 --- 1 file changed, 3 deletions(-) diff --git a/routes/index/index.hbs b/routes/index/index.hbs index 356aa581c..4aa7f59d2 100644 --- a/routes/index/index.hbs +++ b/routes/index/index.hbs @@ -198,8 +198,5 @@ Undo ]; - From 11a57837dc832e85f7da1062c53993037438cd29 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Tue, 9 Jul 2024 10:50:43 +0100 Subject: [PATCH 03/15] Clearup fix --- .../scaffold/backboneFormsOverrides.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/frontend/src/modules/scaffold/backboneFormsOverrides.js b/frontend/src/modules/scaffold/backboneFormsOverrides.js index 8134e490c..541b45c9e 100644 --- a/frontend/src/modules/scaffold/backboneFormsOverrides.js +++ b/frontend/src/modules/scaffold/backboneFormsOverrides.js @@ -84,8 +84,8 @@ define([ }; } - until(isAttached(this.$el)).then(function() { - this.editor = CKEDITOR.create(this.$el[0], { + until(isAttached(this.$el)).then(() => { + return CKEDITOR.create(this.$el[0], { dataIndentationChars: '', disableNativeSpellChecker: false, enterMode: CKEDITOR[Origin.constants.ckEditorEnterMode], @@ -129,8 +129,6 @@ define([ 'indent', 'outdent', '|', - 'heading', - '|', 'bold', 'italic', 'underline', @@ -149,8 +147,15 @@ define([ ], shouldNotGroupWhenFull: true } - }); - }.bind(this)); + }).then(editor => { + this.editor = editor + CKEDITOR.instances = CKEDITOR.instances || [] + CKEDITOR.instances.length = CKEDITOR.instances.length || 0; + this.editor.id = CKEDITOR.instances.length + CKEDITOR.instances.length++; + CKEDITOR.instances[this.editor.id] = this.editor + }) + }); return this; }; @@ -170,8 +175,8 @@ define([ // ckeditor removal Backbone.Form.editors.TextArea.prototype.remove = function() { - this.editor.removeAllListeners(); - CKEDITOR.remove(this.editor); + this.editor.stopListening() + delete CKEDITOR.instances[this.editor] }; // add override to allow prevention of validation From d99f179e17a9e924b518456d4e3116623d34f8d9 Mon Sep 17 00:00:00 2001 From: Tom Taylor Date: Thu, 11 Jul 2024 10:50:57 +0100 Subject: [PATCH 04/15] Update text area styles --- .../src/modules/scaffold/less/textArea.less | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/frontend/src/modules/scaffold/less/textArea.less b/frontend/src/modules/scaffold/less/textArea.less index 1307e80f6..0814f88e2 100644 --- a/frontend/src/modules/scaffold/less/textArea.less +++ b/frontend/src/modules/scaffold/less/textArea.less @@ -1,26 +1,9 @@ .field-editor { - .cke_chrome { - border-color: #ccc; - border-radius: 2px; - overflow: hidden; - box-shadow: none; - width: 93%; - } - - .cke_top { - background: #eee; - border-color: #ccc; - box-shadow: none; - } - - .cke_bottom { - background: @white; - border-color: #ccc; - } + .ck.ck-editor { + width: 93% !important; - .cke_toolgroup { - background-image: none; - background: @white; - border-color: #ccc; + .ck.ck-content { + min-height: 200px !important; + } } } From faef5df3da907a95fe01dd5918e7e5125a3b2d04 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Thu, 11 Jul 2024 11:20:05 +0100 Subject: [PATCH 05/15] Comment out potentially unneeded plugins --- routes/index/index.hbs | 88 +++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/routes/index/index.hbs b/routes/index/index.hbs index 4aa7f59d2..68e1caede 100644 --- a/routes/index/index.hbs +++ b/routes/index/index.hbs @@ -58,51 +58,51 @@