From 55c0a5f7c2000928a6f2e08f5cac63d81724f33e Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 30 Aug 2019 11:58:22 +0100 Subject: [PATCH] Uses browser localStorage to store the UDI from the API response & updates the IMG element when we put them in the editor --- .../src/common/services/tinymce.service.js | 51 +++++++++++++++++-- 1 file changed, 46 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 9ac2635489..776acae892 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 @@ -189,8 +189,8 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s return; } - // TODO: The JSON contains location & udi - // Need to add UDI as attr + // Put UDI into localstorage (used to update the img with data-udi later on) + localStorage.setItem(`tinymce__${json.location}`, json.udi); success(json.location); }; @@ -205,6 +205,46 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s xhr.send(formData); } + function initEvents(editor){ + + editor.on('SetContent', function (e) { + console.log('setcontent', e); + + var content = e.content; + + // Upload BLOB images (dragged/pasted ones) + if(content.indexOf('