Fixes some issues for rte
This commit is contained in:
@@ -78,11 +78,13 @@
|
|||||||
"bower_components/angular-local-storage/dist/angular-local-storage.min.js",
|
"bower_components/angular-local-storage/dist/angular-local-storage.min.js",
|
||||||
"bower_components/angular-local-storage/dist/angular-local-storage.min.js.map"
|
"bower_components/angular-local-storage/dist/angular-local-storage.min.js.map"
|
||||||
],
|
],
|
||||||
"tinymce": [
|
"tinymce": {
|
||||||
"bower_components/tinymce/tinymce.min.js",
|
"mapping": [
|
||||||
"bower_components/tinymce/skins/*",
|
{ "bower_components/tinymce/skins/**": "skins" },
|
||||||
"bower_components/tinymce/themes/*"
|
{ "bower_components/tinymce/themes/**": "themes" },
|
||||||
],
|
{ "bower_components/tinymce/tinymce.min.js": "tinymce.min.js" }
|
||||||
|
]
|
||||||
|
},
|
||||||
"angular-i18n": "bower_components/angular-i18n/angular-locale_*.js",
|
"angular-i18n": "bower_components/angular-i18n/angular-locale_*.js",
|
||||||
"typeahead.js": "bower_components/typeahead.js/dist/typeahead.bundle.min.js",
|
"typeahead.js": "bower_components/typeahead.js/dist/typeahead.bundle.min.js",
|
||||||
"rgrove-lazyload": "bower_components/rgrove-lazyload/lazyload.js",
|
"rgrove-lazyload": "bower_components/rgrove-lazyload/lazyload.js",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
angular.module("umbraco")
|
angular.module("umbraco")
|
||||||
.controller("Umbraco.PropertyEditors.RTEController",
|
.controller("Umbraco.PropertyEditors.RTEController",
|
||||||
function ($rootScope, $scope, $q, $locale, dialogService, $log, imageHelper, assetsService, $timeout, tinyMceService, angularHelper, stylesheetResource, macroService, editorState) {
|
function ($scope, $q, assetsService, $timeout, tinyMceService, angularHelper, editorService, macroService, editorState) {
|
||||||
|
|
||||||
//TODO: A lot of the code below should be shared between the grid rte and the normal rte
|
//TODO: A lot of the code below should be shared between the grid rte and the normal rte
|
||||||
|
|
||||||
@@ -15,49 +15,49 @@ angular.module("umbraco")
|
|||||||
|
|
||||||
function syncContent(editor) {
|
function syncContent(editor) {
|
||||||
|
|
||||||
//stop watching before we update the value
|
//stop watching before we update the value
|
||||||
stopWatch();
|
stopWatch();
|
||||||
angularHelper.safeApply($scope, function () {
|
angularHelper.safeApply($scope, function () {
|
||||||
$scope.model.value = editor.getContent();
|
$scope.model.value = editor.getContent();
|
||||||
});
|
});
|
||||||
//re-watch the value
|
//re-watch the value
|
||||||
startWatch(editor);
|
startWatch(editor);
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
* @param {any} editor
|
|
||||||
*/
|
|
||||||
function startWatch(editor) {
|
|
||||||
unwatch = $scope.$watch("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
|
|
||||||
editor.setContent(newVal || "", { format: 'raw' });
|
|
||||||
|
|
||||||
//we need to manually fire this event since it is only ever fired based on loading from the DOM, this
|
|
||||||
// is required for our plugins listening to this event to execute
|
|
||||||
editor.fire('LoadContent', null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Stops the watch on model.value which is done anytime we are manually updating the model.value */
|
|
||||||
function stopWatch() {
|
|
||||||
if (unwatch) {
|
|
||||||
unwatch();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
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
|
||||||
|
* @param {any} editor
|
||||||
|
*/
|
||||||
|
function startWatch(editor) {
|
||||||
|
unwatch = $scope.$watch("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
|
||||||
|
editor.setContent(newVal || "", { format: 'raw' });
|
||||||
|
|
||||||
|
//we need to manually fire this event since it is only ever fired based on loading from the DOM, this
|
||||||
|
// is required for our plugins listening to this event to execute
|
||||||
|
editor.fire('LoadContent', null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Stops the watch on model.value which is done anytime we are manually updating the model.value */
|
||||||
|
function stopWatch() {
|
||||||
|
if (unwatch) {
|
||||||
|
unwatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var editorConfig = $scope.model.config.editor;
|
var editorConfig = $scope.model.config.editor;
|
||||||
if (!editorConfig || angular.isString(editorConfig)) {
|
if (!editorConfig || angular.isString(editorConfig)) {
|
||||||
editorConfig = tinyMceService.defaultPrevalues();
|
editorConfig = tinyMceService.defaultPrevalues();
|
||||||
}
|
}
|
||||||
|
|
||||||
var promises = [];
|
var promises = [];
|
||||||
if (!editorConfig.maxImageSize && editorConfig.maxImageSize != 0) {
|
if (!editorConfig.maxImageSize && editorConfig.maxImageSize != 0) {
|
||||||
editorConfig.maxImageSize = tinyMceService.defaultPrevalues().maxImageSize;
|
editorConfig.maxImageSize = tinyMceService.defaultPrevalues().maxImageSize;
|
||||||
@@ -132,7 +132,7 @@ angular.module("umbraco")
|
|||||||
tinyMceService.insertLinkInEditor(editor, model.target, anchorElement);
|
tinyMceService.insertLinkInEditor(editor, model.target, anchorElement);
|
||||||
editorService.close();
|
editorService.close();
|
||||||
},
|
},
|
||||||
close: function() {
|
close: function () {
|
||||||
editorService.close();
|
editorService.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -152,7 +152,7 @@ angular.module("umbraco")
|
|||||||
tinyMceService.insertMediaInEditor(editor, model.selectedImages[0]);
|
tinyMceService.insertMediaInEditor(editor, model.selectedImages[0]);
|
||||||
editorService.close();
|
editorService.close();
|
||||||
},
|
},
|
||||||
close: function() {
|
close: function () {
|
||||||
editorService.close();
|
editorService.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -162,11 +162,11 @@ angular.module("umbraco")
|
|||||||
//Create the embedded plugin
|
//Create the embedded plugin
|
||||||
tinyMceService.createInsertEmbeddedMedia(editor, $scope, function () {
|
tinyMceService.createInsertEmbeddedMedia(editor, $scope, function () {
|
||||||
var embed = {
|
var embed = {
|
||||||
submit: function(model) {
|
submit: function (model) {
|
||||||
tinyMceService.insertEmbeddedMediaInEditor(editor, model.embed.preview);
|
tinyMceService.insertEmbeddedMediaInEditor(editor, model.embed.preview);
|
||||||
editorService.close();
|
editorService.close();
|
||||||
},
|
},
|
||||||
close: function() {
|
close: function () {
|
||||||
editorService.close();
|
editorService.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -183,7 +183,7 @@ angular.module("umbraco")
|
|||||||
tinyMceService.insertMacroInEditor(editor, macroObject, $scope);
|
tinyMceService.insertMacroInEditor(editor, macroObject, $scope);
|
||||||
editorService.close();
|
editorService.close();
|
||||||
},
|
},
|
||||||
close: function() {
|
close: function () {
|
||||||
editorService.close();
|
editorService.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -208,7 +208,7 @@ angular.module("umbraco")
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadTinyMce();
|
loadTinyMce();
|
||||||
|
|
||||||
//listen for formSubmitting event (the result is callback used to remove the event subscription)
|
//listen for formSubmitting event (the result is callback used to remove the event subscription)
|
||||||
var unsubscribe = $scope.$on("formSubmitting", function () {
|
var unsubscribe = $scope.$on("formSubmitting", function () {
|
||||||
//TODO: Here we should parse out the macro rendered content so we can save on a lot of bytes in data xfer
|
//TODO: Here we should parse out the macro rendered content so we can save on a lot of bytes in data xfer
|
||||||
@@ -227,7 +227,7 @@ angular.module("umbraco")
|
|||||||
tinyMceEditor.destroy()
|
tinyMceEditor.destroy()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user