Skip to content
Snippets Groups Projects
Commit e041a596 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: replace promises by await

parent 6b095dbc
Branches
Tags
3 merge requests!59REL: release 0.4.1,!57MAINT: replace promises by await,!56ENH: Add a WYSIWYG editor for text properties
Pipeline #16849 passed
......@@ -39,42 +39,37 @@
*/
var ext_editmode_wysiwyg_text = function ($, logger, ClassicEditor, edit_mode, getPropertyElements, getPropertyDatatype, getPropertyName) {
var insertEditorInProperty = function (prop) {
var insertEditorInProperty = async function (prop) {
if (!(getPropertyDatatype(prop) === 'TEXT')) {
// Ignore anything that isn't a list property, even LIST<TEXT>
return;
}
let editor;
try{
let editor;
ClassicEditor
.create(prop.querySelector('textarea'), {
// use all plugins since we built the editor dependency to
// contain only those we need.
plugins: ClassicEditor.builtinPlugins,
// Markdown needs a header row so enforce this
table: {
defaultHeadings: {
rows: 1,
columns: 0
editor = await ClassicEditor
.create(prop.querySelector('textarea'), {
// use all plugins since we built the editor dependency to
// contain only those we need.
plugins: ClassicEditor.builtinPlugins,
// Markdown needs a header row so enforce this
table: {
defaultHeadings: {
rows: 1,
columns: 0
},
},
},
})
.then(newEditor => {
console.log('Initialized editor for ' + getPropertyName(prop));
editor = newEditor;
}).then(
() => {
// Manually implement saving the data since edit mode is not
// a form to be submitted.
editor.model.document.on("change:data", (e) => {
editor.updateSourceElement();
});
}
)
.catch(error => {
console.error(error.stack);
})
console.log('Initialized editor for ' + getPropertyName(prop));
// Manually implement saving the data since edit mode is not
// a form to be submitted.
editor.model.document.on("change:data", (e) => {
editor.updateSourceElement();
});
} catch(error) {
console.error(error.stack);
}
}
var replaceTextAreas = function (entity) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment