Skip to content
Snippets Groups Projects

MAINT: replace promises by await

Merged Henrik tom Wörden requested to merge f-review-async into f-wysiwyg
1 file
+ 22
29
Compare changes
  • Side-by-side
  • Inline
@@ -39,42 +39,35 @@
*/
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;
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
try{
const 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) {
Loading