Fix: only fire event when instance is available (issue 17847) (#17987)

* only fire event when instance is available

* avoid js issue when no markup
This commit is contained in:
Niels Lyngsø
2025-01-15 13:56:53 +01:00
committed by Sven Geusens
parent 8f42a3a0ea
commit d3f264fc54

View File

@@ -256,7 +256,7 @@
toolbar: editorConfig.toolbar,
model: vm.model,
getValue: function () {
return vm.model.value.markup;
return vm.model.value.markup ?? "";
},
setValue: function (newVal) {
vm.model.value.markup = newVal;
@@ -348,7 +348,9 @@
// But I'm not sure it's needed, as this does not trigger the RTE
if(modelObject) {
modelObject.update(vm.model.value.blocks, $scope);
vm.tinyMceEditor.fire('updateBlocks');
if (vm.tinyMceEditor) {
vm.tinyMceEditor.fire('updateBlocks');
}
onLoaded();
}
}