Skip to content

Commit 50933b8

Browse files
Merge pull request #6369 from christianbeeznest/ofaj-22712
Internal: Fix caret position on first keystroke in empty TinyMCE editor - refs BT#22712
2 parents bb49778 + 9faf598 commit 50933b8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

assets/vue/components/basecomponents/BaseTinyEditor.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,15 @@ const editorConfig = computed(() => ({
214214
...defaultEditorConfig,
215215
...props.editorConfig,
216216
file_picker_callback: filePickerCallback,
217+
setup(editor) {
218+
editor.on("GetContent", (e) => {
219+
if (!e.content.includes("tiny-content")) {
220+
e.content = `<div class="tiny-content">${e.content}</div>`
221+
}
222+
})
223+
},
217224
}))
218225
219-
watch(modelValue, (newValue) => {
220-
if (newValue && !newValue.includes("tiny-content")) {
221-
modelValue.value = `<div class="tiny-content">${newValue}</div>`
222-
}
223-
})
224-
225226
async function filePickerCallback(callback, value, meta) {
226227
let url = getUrlForTinyEditor()
227228
if ("image" === meta.filetype) {

0 commit comments

Comments
 (0)