From 4918fa0868bc8fe4e4a73431ca20ee9d37650b5a Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 2 Oct 2019 12:05:11 +0200 Subject: [PATCH 01/11] added timeout --- .../src/views/propertyeditors/rte/rte.controller.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 8ca698060a..c2bf5d0336 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 @@ -89,7 +89,10 @@ angular.module("umbraco") angular.extend(baseLineConfigObj, standardConfig); - tinymce.init(baseLineConfigObj); + // We need to wait for DOM to have rendered before we can find the element by ID. + $timeout(function () { + tinymce.init(baseLineConfigObj); + }, 150); //listen for formSubmitting event (the result is callback used to remove the event subscription) var unsubscribe = $scope.$on("formSubmitting", function () { From 72952db3b2a28775b3f75467c6daaa067237facc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 1 Oct 2019 12:17:23 +0200 Subject: [PATCH 02/11] fixing toolbar issues when sticky and RTE width in grid. --- .../src/common/services/tinymce.service.js | 13 ++++++++----- .../src/less/components/umb-grid.less | 4 ++++ src/Umbraco.Web.UI.Client/src/less/rte.less | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) 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 8fee11dbc9..da013d88ee 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 @@ -1188,6 +1188,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s var tinyMceRect = editor.editorContainer.getBoundingClientRect(); var tinyMceTop = tinyMceRect.top; var tinyMceBottom = tinyMceRect.bottom; + var tinyMceWidth = tinyMceRect.width; var tinyMceEditArea = tinyMce.find(".mce-edit-area"); @@ -1196,16 +1197,18 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s if (tinyMceTop < 177 && ((177 + toolbarHeight) < tinyMceBottom)) { toolbar - .css("visibility", "visible") .css("position", "fixed") .css("top", "177px") - .css("margin-top", "0"); + .css("left", "auto") + .css("right", "auto") + .css("width", tinyMceWidth); } else { toolbar - .css("visibility", "visible") .css("position", "absolute") - .css("top", "auto") - .css("margin-top", "0"); + .css("left", "") + .css("right", "") + .css("top", "") + .css("width", ""); } }, 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 b3e729dfdd..277c2bcbe8 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 @@ -638,7 +638,11 @@ .umb-grid .mce-toolbar { border-bottom: 1px solid @gray-7; + background-color: white; display: none; + + left: 0; + right: 0; } .umb-grid .umb-control.-active .mce-toolbar { diff --git a/src/Umbraco.Web.UI.Client/src/less/rte.less b/src/Umbraco.Web.UI.Client/src/less/rte.less index f33617d03f..6dfccdd0a3 100644 --- a/src/Umbraco.Web.UI.Client/src/less/rte.less +++ b/src/Umbraco.Web.UI.Client/src/less/rte.less @@ -162,4 +162,5 @@ .umb-grid .umb-rte { border: 1px solid #d8d7d9; + max-width: none; } From 56695282533daabdbc792c92fc808e5e7a9171e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Tue, 1 Oct 2019 13:35:27 +0200 Subject: [PATCH 03/11] fixing icon issue in PreValueEditor --- src/Umbraco.Web.UI.Client/src/less/rte.less | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/less/rte.less b/src/Umbraco.Web.UI.Client/src/less/rte.less index 6dfccdd0a3..60065ee1d2 100644 --- a/src/Umbraco.Web.UI.Client/src/less/rte.less +++ b/src/Umbraco.Web.UI.Client/src/less/rte.less @@ -63,8 +63,9 @@ } /* Special case to support helviticons for the tiny mce button controls */ -.umb-rte .mce-ico.mce-i-custom[class^="icon-"], -.umb-rte .mce-ico.mce-i-custom[class*=" icon-"] { +// Also used in Prevalue editor. +.mce-ico.mce-i-custom[class^="icon-"], +.mce-ico.mce-i-custom[class*=" icon-"] { font-family: icomoon; font-size: 16px !important; } From 6d9af75fbedda66f36c9782c66d126366019e501 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 2 Oct 2019 13:49:50 +0200 Subject: [PATCH 04/11] Fixes the media refs within the RTE in the Grid --- .../PropertyEditors/GridPropertyEditor.cs | 50 ++++++++++++++++--- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs index f940ed5c15..719377ca72 100644 --- a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs @@ -1,5 +1,6 @@ using Newtonsoft.Json; using System; +using System.Collections.Generic; using System.Linq; using Umbraco.Core; using Umbraco.Core.Logging; @@ -83,12 +84,9 @@ namespace Umbraco.Web.PropertyEditors // editorValue.Value is a JSON string of the grid var rawJson = editorValue.Value.ToString(); - var grid = JsonConvert.DeserializeObject(rawJson); - - // Find all controls that use the RTE editor - var controls = grid.Sections.SelectMany(x => x.Rows.SelectMany(r => r.Areas).SelectMany(a => a.Controls)); - var rtes = controls.Where(x => x.Editor.Alias.ToLowerInvariant() == "rte"); + var grid = DeserializeGridValue(rawJson, out var rtes); + //process the rte values foreach(var rte in rtes) { // Parse the HTML @@ -96,13 +94,53 @@ namespace Umbraco.Web.PropertyEditors var userId = _umbracoContextAccessor.UmbracoContext?.Security.CurrentUser.Id ?? Constants.Security.SuperUserId; - var parsedHtml = TemplateUtilities.FindAndPersistPastedTempImages(html, mediaParentId, userId, _mediaService, _contentTypeBaseServiceProvider, _logger); + var editorValueWithMediaUrlsRemoved = TemplateUtilities.RemoveMediaUrlsFromTextString(html); + + var parsedHtml = TemplateUtilities.FindAndPersistPastedTempImages(editorValueWithMediaUrlsRemoved, mediaParentId, userId, _mediaService, _contentTypeBaseServiceProvider, _logger); rte.Value = parsedHtml; } // Convert back to raw JSON for persisting return JsonConvert.SerializeObject(grid); } + + /// + /// Ensures that the rich text editor values are processed within the grid + /// + /// + /// + /// + /// + /// + public override object ToEditor(Property property, IDataTypeService dataTypeService, string culture = null, string segment = null) + { + var val = property.GetValue(culture, segment); + if (val == null) return string.Empty; + + var grid = DeserializeGridValue(val.ToString(), out var rtes); + + //process the rte values + foreach (var rte in rtes.ToList()) + { + var html = rte.Value?.ToString(); + + var propertyValueWithMediaResolved = TemplateUtilities.ResolveMediaFromTextString(html); + rte.Value = propertyValueWithMediaResolved; + } + + return grid; + } + + private GridValue DeserializeGridValue(string rawJson, out IEnumerable richTextValues) + { + var grid = JsonConvert.DeserializeObject(rawJson); + + // Find all controls that use the RTE editor + var controls = grid.Sections.SelectMany(x => x.Rows.SelectMany(r => r.Areas).SelectMany(a => a.Controls)); + richTextValues = controls.Where(x => x.Editor.Alias.ToLowerInvariant() == "rte"); + + return grid; + } } } } From 033780cb90ad30275bc3e99f3c8508592468d2ff Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 2 Oct 2019 13:50:00 +0100 Subject: [PATCH 05/11] We only want to allow you to pick one folder in the media library for this prevalue editor --- .../src/views/prevalueeditors/mediafolderpicker.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediafolderpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediafolderpicker.controller.js index ddfca295d4..1f39c2423e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediafolderpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/mediafolderpicker.controller.js @@ -27,7 +27,7 @@ function mediaFolderPickerController($scope, editorService, entityResource) { $scope.add = function() { var mediaPickerOptions = { view: "mediapicker", - multiPicker: true, + multiPicker: false, // We only want to allow you to pick one folder at a given time disableFolderSelect: false, onlyImages: false, onlyFolders: true, From 0e16d9cd3302e86e22a36253b478b3a07ddd65dc Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 2 Oct 2019 11:59:15 +0100 Subject: [PATCH 06/11] WIP: Try and support images in the RTE that are pasted/dragged in and are NOT in media yet to be able to update the ALT text --- .../src/common/services/tinymce.service.js | 86 +++++++++++++++---- .../mediapicker/mediapicker.controller.js | 23 +++-- 2 files changed, 84 insertions(+), 25 deletions(-) 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 8fee11dbc9..0e4816953f 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 @@ -588,12 +588,15 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s var selectedElm = editor.selection.getNode(), - currentTarget; + currentTarget, + imgDomElement; if (selectedElm.nodeName === 'IMG') { var img = $(selectedElm); + imgDomElement = selectedElm; var hasUdi = img.attr("data-udi") ? true : false; + var hasDataTmpImg = img.attr("data-tmpimg") ? true : false; currentTarget = { altText: img.attr("alt"), @@ -605,12 +608,17 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s } else { currentTarget["id"] = img.attr("rel"); } + + if(hasDataTmpImg){ + currentTarget["tmpimg"] = img.attr("data-tmpimg"); + } } userService.getCurrentUser().then(function (userData) { if (callback) { angularHelper.safeApply($rootScope, function() { - callback(currentTarget, userData); + console.log('current data in create media picker', currentTarget); + callback(currentTarget, userData, imgDomElement); }); } }); @@ -618,25 +626,67 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s }); }, - insertMediaInEditor: function (editor, img) { + insertMediaInEditor: function (editor, img, imgDomElement) { if (img) { + // imgElement is only definied if updating an image + // if null/undefinied then its a BRAND new image + if(imgDomElement){ + console.log('UPDATING IMG', img); - var data = { - alt: img.altText || "", - src: (img.url) ? img.url : "nothing.jpg", - id: '__mcenew', - 'data-udi': img.udi - }; + // Check if the img src has changed + // If it has we will need to do some resizing/recalc again + var hasImageSrcChanged = false; - editor.selection.setContent(editor.dom.createHTML('img', data)); + if(img.url !== editor.dom.getAttrib(imgDomElement, "src")){ + console.log("IMG SRC CHANGED !!!!"); + hasImageSrcChanged = true; + } - $timeout(function () { - var imgElm = editor.dom.get('__mcenew'); - sizeImageInEditor(editor, imgElm, img.url); - editor.dom.setAttrib(imgElm, 'id', null); - editor.fire('Change'); + // If null/undefinied it will remove the attribute + editor.dom.setAttrib(imgDomElement, "alt", img.altText); - }, 500); + // It's possible to pick a NEW image - so need to ensure this gets updated + if(img.udi){ + editor.dom.setAttrib(imgDomElement, "data-udi", img.udi); + } + + // It's possible to pick a NEW image - so need to ensure this gets updated + if(img.url){ + editor.dom.setAttrib(imgDomElement, "src", img.url); + } + + // Remove width & height attributes (ONLY if imgSrc changed) + // So native image size is used as this needed to re-calc width & height + // For the function sizeImageInEditor() & apply the image resizing querystrings etc.. + if(hasImageSrcChanged){ + editor.dom.setAttrib(imgDomElement, "width", null); + editor.dom.setAttrib(imgDomElement, "height", null); + + //Re-calc the image dimensions + sizeImageInEditor(editor, imgDomElement, img.url); + } + + } else{ + console.log('CREATE NEW IMAGE', img); + // We need to create a NEW DOM element to insert + var data = { + alt: img.altText || "", + src: (img.url) ? img.url : "nothing.jpg", + id: "__mcenew", + "data-udi": img.udi + }; + editor.selection.setContent(editor.dom.createHTML('img', data)); + + // Insert a DOM element with an ID of __mcenew + // So we can select it after 500ms by that ID + // In order to call the sizeImageEditor function to size img correctly + $timeout(function () { + var imgElm = editor.dom.get("__mcenew"); + sizeImageInEditor(editor, imgElm, img.url); + editor.dom.setAttrib(imgElm, "id", null); + editor.fire("Change"); + }, 500); + } } }, @@ -1399,7 +1449,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s }); //Create the insert media plugin - self.createMediaPicker(args.editor, function (currentTarget, userData) { + self.createMediaPicker(args.editor, function (currentTarget, userData, imgDomElement) { var startNodeId, startNodeIsVirtual; if (!args.model.config.startNodeId) { @@ -1422,7 +1472,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s startNodeIsVirtual: startNodeIsVirtual, dataTypeKey: args.model.dataTypeKey, submit: function (model) { - self.insertMediaInEditor(args.editor, model.selection[0]); + self.insertMediaInEditor(args.editor, model.selection[0], imgDomElement); editorService.close(); }, close: function () { diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js index 837c0ebc9d..4b6cfb6969 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js @@ -98,21 +98,30 @@ angular.module("umbraco") gotoStartNode(); } } else { - //if a target is specified, go look it up - generally this target will just contain ids not the actual full - //media object so we need to look it up + // if a target is specified, go look it up - generally this target will just contain ids not the actual full + // media object so we need to look it up var id = $scope.target.udi ? $scope.target.udi : $scope.target.id; - var altText = $scope.target.altText; - entityResource.getById(id, "Media") + + // ID of a UDI or legacy int ID still could be null/undefinied here + // As user may dragged in an image that has not been saved to media section yet + if(id){ + entityResource.getById(id, "Media") .then(function (node) { - $scope.target = node; + //$scope.target = node; //Not 100% sure why we override it here?! if (ensureWithinStartNode(node)) { selectImage(node); - $scope.target.url = mediaHelper.resolveFile(node); - $scope.target.altText = altText; + //$scope.target.url = mediaHelper.resolveFile(node); + //$scope.target.altText = altText; $scope.openDetailsDialog(); } }, gotoStartNode); + } + else { + // No ID set - then this is going to be a tmpimg that has not been uploaded + // User editing this will want to be changing the ALT text + $scope.openDetailsDialog(); + } } } From 76dd7a667a92d6d7159485b89ffeb105909aaca4 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 2 Oct 2019 13:23:05 +0100 Subject: [PATCH 07/11] Remove console.logs --- .../src/common/services/tinymce.service.js | 5 ----- 1 file changed, 5 deletions(-) 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 0e4816953f..4480968d0a 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 @@ -617,7 +617,6 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s userService.getCurrentUser().then(function (userData) { if (callback) { angularHelper.safeApply($rootScope, function() { - console.log('current data in create media picker', currentTarget); callback(currentTarget, userData, imgDomElement); }); } @@ -631,14 +630,11 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s // imgElement is only definied if updating an image // if null/undefinied then its a BRAND new image if(imgDomElement){ - console.log('UPDATING IMG', img); - // Check if the img src has changed // If it has we will need to do some resizing/recalc again var hasImageSrcChanged = false; if(img.url !== editor.dom.getAttrib(imgDomElement, "src")){ - console.log("IMG SRC CHANGED !!!!"); hasImageSrcChanged = true; } @@ -667,7 +663,6 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s } } else{ - console.log('CREATE NEW IMAGE', img); // We need to create a NEW DOM element to insert var data = { alt: img.altText || "", From 05ff51575bde05ca2e57352a71ae5646007d9148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 2 Oct 2019 15:30:41 +0200 Subject: [PATCH 08/11] Wait for image to load, for measuring size. Removed the 500ms timeout that was prone to error if image was'nt loaded within time. --- .../src/common/services/tinymce.service.js | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) 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 4480968d0a..3978cedd2d 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 @@ -664,23 +664,37 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s } else{ // We need to create a NEW DOM element to insert + // setting an attribute of ID to __mcenew, so we can gather a reference to the node, to be able to update its size accordingly to the size of the image. var data = { alt: img.altText || "", src: (img.url) ? img.url : "nothing.jpg", id: "__mcenew", "data-udi": img.udi }; + editor.selection.setContent(editor.dom.createHTML('img', data)); - - // Insert a DOM element with an ID of __mcenew - // So we can select it after 500ms by that ID - // In order to call the sizeImageEditor function to size img correctly + + // Using settimeout to wait for a DoM-render, so we can find the new element by ID. $timeout(function () { + var imgElm = editor.dom.get("__mcenew"); - sizeImageInEditor(editor, imgElm, img.url); editor.dom.setAttrib(imgElm, "id", null); - editor.fire("Change"); - }, 500); + + // When image is loaded we are ready to call sizeImageInEditor. + var onImageLoaded = function() { + sizeImageInEditor(editor, imgElm, img.url); + editor.fire("Change"); + } + + // Check if image already is loaded. + if(imgElm.complete === true) { + onImageLoaded(); + } else { + imgElm.onload = onImageLoaded; + } + + }); + } } }, From 03a4affbde4948afbcccc7fbea6a2327c97f8c40 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 3 Oct 2019 10:12:41 +0200 Subject: [PATCH 09/11] Fixes order of parsing RTEs --- .../PropertyEditors/GridPropertyEditor.cs | 12 ++++++------ .../PropertyEditors/RichTextPropertyEditor.cs | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs index 719377ca72..41f38a33e1 100644 --- a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs @@ -86,18 +86,18 @@ namespace Umbraco.Web.PropertyEditors var rawJson = editorValue.Value.ToString(); var grid = DeserializeGridValue(rawJson, out var rtes); + var userId = _umbracoContextAccessor.UmbracoContext?.Security.CurrentUser.Id ?? Constants.Security.SuperUserId; + //process the rte values - foreach(var rte in rtes) + foreach (var rte in rtes) { // Parse the HTML var html = rte.Value?.ToString(); - var userId = _umbracoContextAccessor.UmbracoContext?.Security.CurrentUser.Id ?? Constants.Security.SuperUserId; + var parseAndSavedTempImages = TemplateUtilities.FindAndPersistPastedTempImages(html, mediaParentId, userId, _mediaService, _contentTypeBaseServiceProvider, _logger); + var editorValueWithMediaUrlsRemoved = TemplateUtilities.RemoveMediaUrlsFromTextString(parseAndSavedTempImages); - var editorValueWithMediaUrlsRemoved = TemplateUtilities.RemoveMediaUrlsFromTextString(html); - - var parsedHtml = TemplateUtilities.FindAndPersistPastedTempImages(editorValueWithMediaUrlsRemoved, mediaParentId, userId, _mediaService, _contentTypeBaseServiceProvider, _logger); - rte.Value = parsedHtml; + rte.Value = editorValueWithMediaUrlsRemoved; } // Convert back to raw JSON for persisting diff --git a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs index d29b96c1db..3eed40c8bf 100644 --- a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs @@ -114,16 +114,16 @@ namespace Umbraco.Web.PropertyEditors if (editorValue.Value == null) return null; - var editorValueWithMediaUrlsRemoved = TemplateUtilities.RemoveMediaUrlsFromTextString(editorValue.Value.ToString()); - var parsed = MacroTagParser.FormatRichTextContentForPersistence(editorValueWithMediaUrlsRemoved); - var userId = _umbracoContextAccessor.UmbracoContext?.Security.CurrentUser.Id ?? Constants.Security.SuperUserId; var config = editorValue.DataTypeConfiguration as RichTextConfiguration; var mediaParent = config?.MediaParentId; var mediaParentId = mediaParent == null ? Guid.Empty : mediaParent.Guid; - parsed = TemplateUtilities.FindAndPersistPastedTempImages(parsed, mediaParentId, userId, _mediaService, _contentTypeBaseServiceProvider, _logger); + var parseAndSavedTempImages = TemplateUtilities.FindAndPersistPastedTempImages(editorValue.Value.ToString(), mediaParentId, userId, _mediaService, _contentTypeBaseServiceProvider, _logger); + var editorValueWithMediaUrlsRemoved = TemplateUtilities.RemoveMediaUrlsFromTextString(parseAndSavedTempImages); + var parsed = MacroTagParser.FormatRichTextContentForPersistence(editorValueWithMediaUrlsRemoved); + return parsed; } } From 1ad3103d942da65220284633f30ebb35aacd3c84 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Mon, 7 Oct 2019 13:19:58 +0200 Subject: [PATCH 10/11] https://github.com/umbraco/Umbraco-CMS/issues/6516 - Revert uncommenting stuff, without knowing why the code was their. --- .../mediapicker/mediapicker.controller.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js index 4b6cfb6969..24b8b999fa 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/mediapicker/mediapicker.controller.js @@ -101,17 +101,18 @@ angular.module("umbraco") // if a target is specified, go look it up - generally this target will just contain ids not the actual full // media object so we need to look it up var id = $scope.target.udi ? $scope.target.udi : $scope.target.id; - + var altText = $scope.target.altText; + // ID of a UDI or legacy int ID still could be null/undefinied here // As user may dragged in an image that has not been saved to media section yet if(id){ entityResource.getById(id, "Media") .then(function (node) { - //$scope.target = node; //Not 100% sure why we override it here?! + $scope.target = node; if (ensureWithinStartNode(node)) { selectImage(node); - //$scope.target.url = mediaHelper.resolveFile(node); - //$scope.target.altText = altText; + $scope.target.url = mediaHelper.resolveFile(node); + $scope.target.altText = altText; $scope.openDetailsDialog(); } }, @@ -517,4 +518,4 @@ angular.module("umbraco") onInit(); - }); \ No newline at end of file + }); From 9d5f7a8a96575f57e11ecbabae69f1e216353bcf Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Tue, 8 Oct 2019 11:17:54 +0200 Subject: [PATCH 11/11] Removed rc from version --- src/SolutionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index f26965eeae..a4e859988e 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -19,4 +19,4 @@ using System.Resources; // these are FYI and changed automatically [assembly: AssemblyFileVersion("8.2.0")] -[assembly: AssemblyInformationalVersion("8.2.0-rc")] +[assembly: AssemblyInformationalVersion("8.2.0")]