diff --git a/src/components/Form/fields/FieldRichText.vue b/src/components/Form/fields/FieldRichText.vue index 2d3938bb6..e4688c4fd 100644 --- a/src/components/Form/fields/FieldRichText.vue +++ b/src/components/Form/fields/FieldRichText.vue @@ -54,9 +54,9 @@ export default { return { ...init, ...{ - // This will not have any impact on TinyMCE 6.0+ , + // Need to set to
wrapper, to resolve deprecated option forced_root_block of empty string // @see https://github.com/tinymce/tinymce/discussions/7342 - forced_root_block: '', + forced_root_block: 'div', toolbar_groups: { formatgroup: { @@ -91,6 +91,15 @@ export default { return; } }); + + editor.on('PostProcess', function (ed) { + // TinyMCE by default inserts a wrapper

around the content + // for each editor. We need to set forced_root_block with value "div" + // to use this as the wrapper, and then remove as a workaround to a + // deprecated option & value "{ forced_root_block: '' }" + // @see https://github.com/tinymce/tinymce/discussions/7342 + ed.content = ed.content.replace(/^

(.*)<\/div>$/, '$1'); + }); }, }, };