Page 1 of 1
Add event listener to TinyMCE
Posted: Sat Mar 16, 2024 8:25 pm
by totza2010
Edit html code in tinymce not editable.
i find solution fix this problem work, By
document.addEventListener('focusin', (e) => {
if (e.target.closest(".tox-tinymce-aux, .moxman-window, .tam-assetmanager-root") !== null) {
e.stopImmediatePropagation();
}
});
use this code, but i try pase this code in client script and startup script not work,
i try pase this code in file ewediter.js worked.
Re: Tinymce
Posted: Sat Mar 16, 2024 9:15 pm
by arbei
You cannot put it in Client/Startup Script directly because the editors are not created yet. You may wait until the form is initiated, e.g. in Startup Script
currentForm.on("initiated", () => { ... your code ... }); // This example assume normal pages such as the Add/Edit page of a table
Re: Tinymce
Posted: Sat Mar 16, 2024 11:21 pm
by totza2010
currentForm.on("initiated", (e) => {
document.addEventListener('focusin', (e) => {
if (e.target.closest(".tox-tinymce-aux, .moxman-window, .tam-assetmanager-root") !== null) {
e.stopImmediatePropagation();
}
});
});
i use this code in global startup script, it worked. thx.