From 511a7f1371a62bf7b77ef80177b4f89cf30cde70 Mon Sep 17 00:00:00 2001 From: Joshua Brown Date: Wed, 22 Jul 2020 18:05:07 +0100 Subject: [PATCH] Fix for issue #7461 ("Inserting a macro in the rich test editor (RTE) in the Grid makes it disappear on Save & Publish") (#8437) --- .../common/directives/components/grid/grid.rte.directive.js | 4 +++- .../src/common/services/tinymce.service.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js index 3578624b50..0a68ba82f8 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js @@ -87,7 +87,9 @@ angular.module("umbraco.directives") tinyMceService.initializeEditor({ editor: editor, model: scope, - currentForm: angularHelper.getCurrentForm(scope) + // Form is found in the scope of the grid controller above us, not in our isolated scope + // https://github.com/umbraco/Umbraco-CMS/issues/7461 + currentForm: angularHelper.getCurrentForm(scope.$parent) }); //custom initialization for this editor within the grid diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js index 41f240d3af..aeca30f633 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js @@ -1504,6 +1504,8 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s }); args.editor.on('Dirty', function (e) { + syncContent(); // Set model.value to the RTE's content + //make the form dirty manually so that the track changes works, setting our model doesn't trigger // the angular bits because tinymce replaces the textarea. if (args.currentForm) {