#3642 - removed new stuff with on change event and fixed the old and broken, thats shared in tinymce
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
function ContentEditController($rootScope, $scope, $routeParams, $q, $window,
|
||||
appState, contentResource, entityResource, navigationService, notificationsService,
|
||||
serverValidationManager, contentEditingHelper, treeService, formHelper, umbRequestHelper,
|
||||
editorState, $http, eventsService, relationResource, overlayService, angularHelper) {
|
||||
editorState, $http, eventsService, relationResource, overlayService) {
|
||||
|
||||
var evts = [];
|
||||
var infiniteMode = $scope.infiniteModel && $scope.infiniteModel.infiniteMode;
|
||||
@@ -309,7 +309,7 @@
|
||||
}
|
||||
|
||||
function ensureDirtyIsSetIfAnyVariantIsDirty() {
|
||||
|
||||
|
||||
$scope.contentForm.$dirty = false;
|
||||
|
||||
for (var i = 0; i < $scope.content.variants.length; i++) {
|
||||
|
||||
@@ -55,7 +55,7 @@ angular.module("umbraco.directives")
|
||||
//initialize the standard editor functionality for Umbraco
|
||||
tinyMceService.initializeEditor({
|
||||
editor: editor,
|
||||
value: scope.value,
|
||||
model: scope,
|
||||
currentForm: angularHelper.getCurrentForm(scope)
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@ angular.module("umbraco.directives")
|
||||
|
||||
$timeout(function () {
|
||||
if (scope.value === null) {
|
||||
editor.trigger("focus");
|
||||
editor.focus();
|
||||
}
|
||||
}, 400);
|
||||
|
||||
|
||||
@@ -1194,7 +1194,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
|
||||
.css("top", "auto")
|
||||
.css("margin-top", "0")
|
||||
.css("width", tinyMceWidth);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@@ -1214,15 +1214,15 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
|
||||
if (!args.editor) {
|
||||
throw "args.editor is required";
|
||||
}
|
||||
//if (!args.value) {
|
||||
// throw "args.value is required";
|
||||
//if (!args.model.value) {
|
||||
// throw "args.model.value is required";
|
||||
//}
|
||||
|
||||
var unwatch = null;
|
||||
|
||||
//Starts a watch on the model value so that we can update TinyMCE if the model changes behind the scenes or from the server
|
||||
function startWatch() {
|
||||
unwatch = $rootScope.$watch(() => args.value, function (newVal, oldVal) {
|
||||
unwatch = $rootScope.$watch(() => args.model.value, function (newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
//update the display val again if it has changed from the server;
|
||||
//uses an empty string in the editor when the value is null
|
||||
@@ -1247,7 +1247,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
|
||||
//stop watching before we update the value
|
||||
stopWatch();
|
||||
angularHelper.safeApply($rootScope, function () {
|
||||
args.value = args.editor.getContent();
|
||||
args.model.value = args.editor.getContent();
|
||||
});
|
||||
//re-watch the value
|
||||
startWatch();
|
||||
@@ -1255,8 +1255,8 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
|
||||
|
||||
args.editor.on('init', function (e) {
|
||||
|
||||
if (args.value) {
|
||||
args.editor.setContent(args.value);
|
||||
if (args.model.value) {
|
||||
args.editor.setContent(args.model.value);
|
||||
}
|
||||
//enable browser based spell checking
|
||||
args.editor.getBody().setAttribute('spellcheck', true);
|
||||
|
||||
@@ -45,12 +45,7 @@ angular.module("umbraco")
|
||||
|
||||
//create a baseline Config to exten upon
|
||||
var baseLineConfigObj = {
|
||||
maxImageSize: editorConfig.maxImageSize,
|
||||
init_instance_callback: function (editor) {
|
||||
editor.on('Change', function (e) {
|
||||
$scope.model.value = editor.getContent();
|
||||
});
|
||||
}
|
||||
maxImageSize: editorConfig.maxImageSize
|
||||
};
|
||||
|
||||
angular.extend(baseLineConfigObj, standardConfig);
|
||||
@@ -63,7 +58,7 @@ angular.module("umbraco")
|
||||
//initialize the standard editor functionality for Umbraco
|
||||
tinyMceService.initializeEditor({
|
||||
editor: editor,
|
||||
value: $scope.model.value,
|
||||
model: $scope.model,
|
||||
currentForm: angularHelper.getCurrentForm($scope)
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user