Skip to content
Snippets Groups Projects
Commit d9984480 authored by florian's avatar florian
Browse files

DRAFT: Add more ideas, todos, and non-working code

parent a970c71f
Branches
Tags
2 merge requests!68DOC: update CHANGELOG,!62FIX: Save WYSIWYG saving in source mode
Pipeline #17494 passed
......@@ -67,7 +67,28 @@ var ext_editmode_wysiwyg_text = function ($, logger, ClassicEditor, edit_mode, g
editor.updateSourceElement();
});
// TODO(fspreck): Add an event listener to save also changes made in
// source mode. What event can we listen to?
// source mode. What event can we listen to? The following doesn't
// work either.
// document.body.addEventListener("input", e => {
// console.log("Saving after input...");
// editor.updateSourceElement();
// }, true);
const sourceEditingPlugin = editor.plugins.get("SourceEditing");
sourceEditingPlugin.on("change:isSourceEditingMode", (e, name, isSourceEditingMode) => {
if (isSourceEditingMode) {
// Maybe this helps?
console.log("Entering source editing");
const [domSourceEditingElementWrapper] = sourceEditingPlugin._replacedRoots.values();
const textarea = domSourceEditingElementWrapper.querySelector('textarea');
// TODO(fspreck) this has to be more intelligent since it
// leads to an infinite update loop...
textarea.addEventListener("input", (e) => {
console.log("Input in source mode");
// sourceEditingPlugin._updateEditorData();
});
}
});
} catch (error) {
logger.error(error.stack);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment