From d3f264fc54f4584938e203bfe3fedc5df6dd9918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 15 Jan 2025 13:56:53 +0100 Subject: [PATCH] Fix: only fire event when instance is available (issue 17847) (#17987) * only fire event when instance is available * avoid js issue when no markup --- .../src/views/propertyeditors/rte/rte.component.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.component.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.component.js index 4c552b19b5..2794f0bd16 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.component.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.component.js @@ -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(); } }