From 4cf202188f091c8d953d2838b5edfe46f46e07f7 Mon Sep 17 00:00:00 2001 From: Jeremy Pyne Date: Mon, 13 Jun 2016 15:20:07 -0400 Subject: [PATCH] Update markdowneditor.controller.js This is a important fix for the Markdown property type. I added code previously to get it to properly record changes made via the button controls. This was causing every document loaded with a markdown property on it to immedetly be flagged as checked with IsDirty() instead of only when a change was actually made. --- .../markdowneditor/markdowneditor.controller.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/markdowneditor/markdowneditor.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/markdowneditor/markdowneditor.controller.js index 7b3d5698c5..3bebb8c078 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/markdowneditor/markdowneditor.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/markdowneditor/markdowneditor.controller.js @@ -57,9 +57,11 @@ function MarkdownEditorController($scope, $element, assetsService, dialogService }); editor2.hooks.set("onPreviewRefresh", function () { - angularHelper.getCurrentForm($scope).$setDirty(); - // We must manually update the model as there is no way to hook into the markdown editor events without editing that code. - $scope.model.value = $("textarea", $element).val(); + // We must manually update the model as there is no way to hook into the markdown editor events without exstensive edits to the library. + if ($scope.model.value != $("textarea", $element).val()) { + angularHelper.getCurrentForm($scope).$setDirty(); + $scope.model.value = $("textarea", $element).val(); + } }); }, 200);