Merge pull request #1823 from umbraco/temp-U4-9647

fixes: U4-9647 7.6.0-beta: New template editor not set $dirty on code…
This commit is contained in:
Claus
2017-03-28 15:15:43 +02:00
committed by GitHub
4 changed files with 38 additions and 1 deletions

View File

@@ -291,6 +291,8 @@
//change on blur, focus
vm.editor.on("blur", persistCurrentLocation);
vm.editor.on("focus", persistCurrentLocation);
vm.editor.on("change", changeAceEditor);
}
}
@@ -309,6 +311,10 @@
vm.currentPosition = vm.editor.getCursorPosition();
}
function changeAceEditor() {
setFormState("dirty");
}
function setFormState(state) {
// get the current form

View File

@@ -367,6 +367,8 @@
//change on blur, focus
vm.editor.on("blur", persistCurrentLocation);
vm.editor.on("focus", persistCurrentLocation);
vm.editor.on("change", changeAceEditor);
}
}
@@ -385,6 +387,10 @@
vm.currentPosition = vm.editor.getCursorPosition();
}
function changeAceEditor() {
setFormState("dirty");
}
function setFormState(state) {
// get the current form

View File

@@ -1,7 +1,7 @@
(function () {
"use strict";
function ScriptsEditController($scope, $routeParams, $timeout, appState, editorState, navigationService, assetsService, codefileResource, contentEditingHelper, notificationsService, localizationService, templateHelper) {
function ScriptsEditController($scope, $routeParams, $timeout, appState, editorState, navigationService, assetsService, codefileResource, contentEditingHelper, notificationsService, localizationService, templateHelper, angularHelper) {
var vm = this;
var currentPosition = null;
@@ -169,9 +169,29 @@
});
}
vm.editor.on("change", changeAceEditor);
}
}
function changeAceEditor() {
setFormState("dirty");
}
function setFormState(state) {
// get the current form
var currentForm = angularHelper.getCurrentForm($scope);
// set state
if(state === "dirty") {
currentForm.$setDirty();
} else if(state === "pristine") {
currentForm.$setPristine();
}
}
}
init();

View File

@@ -264,6 +264,7 @@
//change on blur, focus
vm.editor.on("blur", persistCurrentLocation);
vm.editor.on("focus", persistCurrentLocation);
vm.editor.on("change", changeAceEditor);
}
}
@@ -632,6 +633,10 @@
vm.currentPosition = vm.editor.getCursorPosition();
}
function changeAceEditor() {
setFormState("dirty");
}
function setFormState(state) {
// get the current form