Skip to content
Snippets Groups Projects
Commit 01cf366d authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

DRAFT: Replace textarea by editor

parent 5e4786fa
No related branches found
No related tags found
2 merge requests!59REL: release 0.4.1,!56ENH: Add a WYSIWYG editor for text properties
Pipeline #16772 passed
......@@ -23,14 +23,39 @@
/**
* Replaces textareas in the edit mode by a wysiwyg editor
*/
var ext_editmode_wysiwyg_text = function ($, logger) {
var ext_editmode_wysiwyg_text = function ($, logger, ClassicEditor) {
var _insertEditor = function (fieldId) {
ClassicEditor
.create(document.querySelector('#' + fieldId), {
plugins: ClassicEditor.builtinPlugins,
})
.then(editor => {
console.log('Initialized editor for ' + fieldId);
})
.catch(error => {
console.error(error.stack);
});
}
var replaceTextAreas = function () {
const fields = $('textarea');
for (let field of fields) {
// TODO(fspreck): This will be replaced by a whitelist of properties
// in the future
if (field.id) {
_insertEditor(field.id);
}
}
}
var init = function () {};
return {
init: init,
replaceTextAreas: replaceTextAreas,
};
}($, log.getLogger("ext_editmode_wysiwyg_text"));
}($, log.getLogger("ext_editmode_wysiwyg_text"), ClassicEditor);
$(document).ready(() => {
if ("${BUILD_MODULE_EXT_EDITMODE_WYSIWYG_TEXT}" == "ENABLED") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment