From cd66c9d2ccd180028dcc57c004f01f3555c1943b Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 20 May 2018 10:37:39 +0200 Subject: [PATCH] Move the caret after the link when inserting images --- .../3rdParty/redactor2/plugins/WoltLabImage.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabImage.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabImage.js index 1c21365ea9..2e3ea8f78e 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabImage.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabImage.js @@ -157,8 +157,10 @@ $.Redactor.prototype.WoltLabImage = function() { } var html = ''; + var linkUuid; if (link) { - html = '' + html + ''; + linkUuid = WCF.getUUID(); + html = '' + html + ''; } this.modal.close(); @@ -166,6 +168,16 @@ $.Redactor.prototype.WoltLabImage = function() { this.buffer.set(); this.insert.html(html); + + if (linkUuid) { + window.setTimeout((function() { + var link = elBySel('a[data-uuid="' + linkUuid + '"]', this.core.editor()[0]); + if (link) { + link.removeAttribute('data-uuid'); + this.caret.after(link); + } + }).bind(this), 1); + } } }; -}; \ No newline at end of file +}; -- 2.20.1