Tinymce descripiton bugs fixes [SCI-11824]

This commit is contained in:
Anton 2025-05-29 14:42:27 +02:00
parent 067849e3d3
commit cce3006e02
2 changed files with 16 additions and 5 deletions

View file

@ -36,6 +36,8 @@ import 'tinymce/plugins/help/js/i18n/keynav/en';
import 'tinymce/plugins/quickbars'; import 'tinymce/plugins/quickbars';
import 'tinymce/plugins/directionality'; import 'tinymce/plugins/directionality';
import './external_tinymce_plugins.js'; // Load external plugins
// Content styles, including inline UI like fake cursors // Content styles, including inline UI like fake cursors
// All the above CSS files are loaded on to the page but these two must // All the above CSS files are loaded on to the page but these two must
// be loaded into the editor iframe so they are loaded as strings and passed // be loaded into the editor iframe so they are loaded as strings and passed
@ -68,8 +70,7 @@ export default {
default: () => ` default: () => `
table autoresize link advlist codesample code autolink lists table autoresize link advlist codesample code autolink lists
charmap anchor searchreplace wordcount visualblocks visualchars charmap anchor searchreplace wordcount visualblocks visualchars
insertdatetime nonbreaking save directionality help quickbars insertdatetime nonbreaking save directionality help quickbars`
`
}, },
menubar: { menubar: {
default: 'file edit view insert format' default: 'file edit view insert format'
@ -86,13 +87,13 @@ export default {
mounted() { mounted() {
tinyMCE.init({ tinyMCE.init({
selector: `#${this.textareaId}`, selector: `#${this.textareaId}`,
plugins: this.plugins, plugins: `${this.plugins} ${window.extraTinyMcePlugins || ''}`,
menubar: this.menubar, menubar: this.menubar,
skin: false, skin: false,
content_css: false, content_css: false,
content_style: contentStyle, content_style: contentStyle,
convert_urls: false, convert_urls: false,
toolbar: this.toolbar, toolbar: window.customLightTinyMceToolbar || this.toolbar,
contextmenu: '', contextmenu: '',
promotion: false, promotion: false,
menu: { menu: {
@ -185,7 +186,13 @@ export default {
editor.setContent(this.modelValue); editor.setContent(this.modelValue);
}); });
editor.on('change', () => { editor.on('change', () => {
this.$emit('update:modelValue', editor.getContent()); let content = editor.getContent();
// Remove images
content = content.replace(/<img[^>]*>/g, '');
editor.setContent(content);
this.$emit('update:modelValue', content);
}); });
} }
}); });
@ -202,6 +209,7 @@ export default {
editorIframe.contents().find('head').append(`<style type="text/css"> editorIframe.contents().find('head').append(`<style type="text/css">
img::-moz-selection{background:0 0} img::-moz-selection{background:0 0}
img::selection{background:0 0} img::selection{background:0 0}
.mce-content-body img[data-mce-selected]{outline:2px solid ${primaryColor}} .mce-content-body img[data-mce-selected]{outline:2px solid ${primaryColor}}
.mce-content-body div.mce-resizehandle{background:transparent;border-color:transparent;box-sizing:border-box;height:10px;width:10px; position:absolute} .mce-content-body div.mce-resizehandle{background:transparent;border-color:transparent;box-sizing:border-box;height:10px;width:10px; position:absolute}
.mce-content-body div.mce-resizehandle:hover{background:transparent} .mce-content-body div.mce-resizehandle:hover{background:transparent}
@ -212,6 +220,9 @@ export default {
h1 {font-size: 24px !important } h1 {font-size: 24px !important }
h2 {font-size: 18px !important } h2 {font-size: 18px !important }
h3 {font-size: 16px !important } h3 {font-size: 16px !important }
#tinymce {
overflow-y: auto !important;
}
</style>`); </style>`);
editorIframe.contents().find('head').append($('#font-css-pack').clone()); editorIframe.contents().find('head').append($('#font-css-pack').clone());
} }