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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user