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 1351da081a..4d4f8792cf 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 @@ -735,7 +735,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s //get all macro divs and load their content $(editor.dom.select(".umb-macro-holder.mceNonEditable")).each(function () { - self.loadMacroContent($(this), null); + self.loadMacroContent($(this), null, editor); }); }); @@ -850,14 +850,15 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s } var $macroDiv = $(editor.dom.select("div.umb-macro-holder." + uniqueId)); + editor.setDirty(true); //async load the macro content - this.loadMacroContent($macroDiv, macroObject); + this.loadMacroContent($macroDiv, macroObject, editor); }, /** loads in the macro content async from the server */ - loadMacroContent: function ($macroDiv, macroData) { + loadMacroContent: function ($macroDiv, macroData, editor) { //if we don't have the macroData, then we'll need to parse it from the macro div if (!macroData) { @@ -893,7 +894,11 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s $macroDiv.removeClass("loading"); htmlResult = htmlResult.trim(); if (htmlResult !== "") { + var wasDirty = editor.isDirty(); $ins.html(htmlResult); + if (!wasDirty) { + editor.undoManager.clear(); + } } }); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js index c2bf5d0336..748d8da1a4 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js @@ -101,6 +101,10 @@ angular.module("umbraco") } }); + $scope.focus = function () { + tinyMceEditor.focus(); + } + //when the element is disposed we need to unsubscribe! // NOTE: this is very important otherwise if this is part of a modal, the listener still exists because the dom // element might still be there even after the modal has been hidden. diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.html index d2cf29d75a..b147e5ccca 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.html @@ -2,6 +2,7 @@
+