Make sure the RTE always loads minified resources + optimize the grid RTE resource loading

This commit is contained in:
Kenn Jacobsen
2020-07-29 18:42:00 +02:00
committed by Sebastiaan Janssen
parent a9dfd9a568
commit be6b051674
2 changed files with 8 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
angular.module("umbraco.directives")
.directive('gridRte', function (tinyMceService, angularHelper, assetsService, $q, $timeout, eventsService) {
.directive('gridRte', function (tinyMceService, angularHelper, assetsService, $q, $timeout, eventsService, tinyMceAssets) {
return {
scope: {
uniqueId: '=',
@@ -22,11 +22,6 @@ angular.module("umbraco.directives")
// because now we have to support having 2x (maybe more at some stage) content editors being displayed at once. This is because
// we have this mini content editor panel that can be launched with MNTP.
scope.textAreaHtmlId = scope.uniqueId + "_" + String.CreateGuid();
//queue file loading
if (typeof (tinymce) === "undefined") {
promises.push(assetsService.loadJs("lib/tinymce/tinymce.min.js", scope));
}
var editorConfig = scope.configuration ? scope.configuration : null;
if (!editorConfig || Utilities.isString(editorConfig)) {
@@ -50,6 +45,10 @@ angular.module("umbraco.directives")
//stores a reference to the editor
var tinyMceEditor = null;
//queue file loading
tinyMceAssets.forEach(function (tinyJsAsset) {
promises.push(assetsService.loadJs(tinyJsAsset, scope));
});
promises.push(tinyMceService.getTinyMceEditorConfig({
htmlId: scope.textAreaHtmlId,
stylesheets: editorConfig.stylesheets,

View File

@@ -1367,6 +1367,9 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
// throw "args.model.value is required";
//}
// force TinyMCE to load plugins/themes from minified files (see http://archive.tinymce.com/wiki.php/api4:property.tinymce.suffix.static)
args.editor.suffix = ".min";
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