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 9fa4167b65..a91e3d6ecc 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 @@ -217,64 +217,6 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s xhr.send(formData); } - function initEvents(editor){ - - editor.on('SetContent', function (e) { - - var content = e.content; - - // Upload BLOB images (dragged/pasted ones) - if(content.indexOf(' { - var blobSrcUri = editor.dom.getAttrib(imageElement, "src"); - - // Find the same image uploaded (Should be in LocalStorage) - // May already exist in the editor as duplicate image - // OR added to the RTE, deleted & re-added again - // So lets fetch the tempurl out of localstorage for that blob URI item - var tmpLocation = localStorageService.get(`tinymce__${blobSrcUri}`) - - if(tmpLocation){ - sizeImageInEditor(editor, imageElement); - editor.dom.setAttrib(imageElement, "data-tmpimg", tmpLocation); - } - }); - - } - }); - } - function cleanupPasteData(plugin, args) { // Remove spans @@ -1311,7 +1253,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s // Upload BLOB images (dragged/pasted ones) if(content.indexOf(' { + var blobSrcUri = args.editor.dom.getAttrib(imageElement, "src"); + + // Find the same image uploaded (Should be in LocalStorage) + // May already exist in the editor as duplicate image + // OR added to the RTE, deleted & re-added again + // So lets fetch the tempurl out of localstorage for that blob URI item + var tmpLocation = localStorageService.get(`tinymce__${blobSrcUri}`) + + if(tmpLocation){ + sizeImageInEditor(args.editor, imageElement); + args.editor.dom.setAttrib(imageElement, "data-tmpimg", tmpLocation); + } + }); + } }); diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-grid.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-grid.less index ba0b32bb0d..852f4411d5 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/umb-grid.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-grid.less @@ -654,6 +654,11 @@ overflow-y: hidden!important; } +// had to overwrite defaults from TinyMCE, needed for buttons panel to float to new line in narrow space. +.umb-grid .mce-container > div { + white-space: normal; +} + // MEDIA EDITOR // ------------------------- diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js index f78eedab33..8ca698060a 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js @@ -28,7 +28,14 @@ angular.module("umbraco") $scope.containerOverflow = editorConfig.mode === "distraction-free" ? (height ? "auto" : "inherit") : "inherit"; var promises = []; - + + // we need to make sure that the element is initialized before we can init TinyMCE, because we find the placeholder by ID, so it needs to be appended to document before. + var initPromise = $q((resolve, reject) => { + this.$onInit = resolve; + }); + + promises.push(initPromise); + //queue file loading tinyMceAssets.forEach(function (tinyJsAsset) { promises.push(assetsService.loadJs(tinyJsAsset, $scope)); @@ -77,13 +84,13 @@ angular.module("umbraco") model: $scope.model, currentForm: angularHelper.getCurrentForm($scope) }); - + }; - + angular.extend(baseLineConfigObj, standardConfig); - /** Loads in the editor */ + tinymce.init(baseLineConfigObj); - + //listen for formSubmitting event (the result is callback used to remove the event subscription) var unsubscribe = $scope.$on("formSubmitting", function () { if (tinyMceEditor !== undefined && tinyMceEditor != null && !$scope.isLoading) {