Commit ae4a9445 authored by Titouan Soulard's avatar Titouan Soulard

erp5_xhtml_style: CKEditor – Fix duplicate image on paste

When pasting an image in CKEditor, the image was displayed twice.
This behaviour is due to the new paste-as-base64 feature implemented in CKE,
which conflict with existing plugins implementing the same feature.

To solve it, add `clipboard_handleImages` option to the CKE configuration object,
which disables its own image-pasting feature.

See https://github.com/ckeditor/ckeditor4/issues/4874 for the corresponding issue on CKEditor’s repository.

/cc @jerome @romain @tomo
/reviewed-by @jerome
/reviewed-on nexedi/erp5!1951
parent 546b35cc
Pipeline #35017 failed with stage
in 0 seconds
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
MOBILE_CONFIGURATION = { MOBILE_CONFIGURATION = {
toolbar: TOOLBAR_MOBILE, toolbar: TOOLBAR_MOBILE,
disableNativeSpellChecker: false, disableNativeSpellChecker: false,
// Image pasting is already handled by a plugin
clipboard_handleImages: false,
// Remove the WebSpellChecker and SpellCheckAsYouType (SCAYT) plugins. // Remove the WebSpellChecker and SpellCheckAsYouType (SCAYT) plugins.
removePlugins: 'scayt,wsc', removePlugins: 'scayt,wsc',
// Disable ACF to not destroy HTML on mobile // Disable ACF to not destroy HTML on mobile
...@@ -48,6 +50,8 @@ ...@@ -48,6 +50,8 @@
DESKTOP_CONFIGURATION = { DESKTOP_CONFIGURATION = {
toolbar: TOOLBAR_DESKTOP, toolbar: TOOLBAR_DESKTOP,
disableNativeSpellChecker: false, disableNativeSpellChecker: false,
// Image pasting is already handled by a plugin
clipboard_handleImages: false,
// Remove the WebSpellChecker and SpellCheckAsYouType (SCAYT) plugins. // Remove the WebSpellChecker and SpellCheckAsYouType (SCAYT) plugins.
removePlugins: 'scayt,wsc', removePlugins: 'scayt,wsc',
// Disable ACF to not destroy HTML on mobile // Disable ACF to not destroy HTML on mobile
...@@ -59,6 +63,7 @@ ...@@ -59,6 +63,7 @@
READONLY_CONFIGURATION = { READONLY_CONFIGURATION = {
allowedContent: true, allowedContent: true,
readOnly: true, readOnly: true,
clipboard_handleImages: false,
// Remove the WebSpellChecker and SpellCheckAsYouType (SCAYT) plugins. // Remove the WebSpellChecker and SpellCheckAsYouType (SCAYT) plugins.
removePlugins: 'elementspath,scayt,wsc,toolbar,pastefromword,' + removePlugins: 'elementspath,scayt,wsc,toolbar,pastefromword,' +
'tableselection,uploadwidget,clipboard,pastetext,' + 'tableselection,uploadwidget,clipboard,pastetext,' +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment