Merge pull request #1328 from pynej/fix-markdwn-isDirty

Update markdowneditor.controller.js
This commit is contained in:
Sebastiaan Janssen
2016-06-23 12:35:46 +02:00
committed by GitHub

View File

@@ -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);