From be6b051674e8b2acd0a0940febd9f0525db3d21c Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Wed, 29 Jul 2020 18:42:00 +0200 Subject: [PATCH] Make sure the RTE always loads minified resources + optimize the grid RTE resource loading --- .../directives/components/grid/grid.rte.directive.js | 11 +++++------ .../src/common/services/tinymce.service.js | 3 +++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js index 0a68ba82f8..e2b2e2c3df 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js @@ -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, diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js index aeca30f633..c59cf545ab 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js @@ -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