From: Alexander Ebert Date: Sun, 20 May 2018 08:37:39 +0000 (+0200) Subject: Move the caret after the link when inserting images X-Git-Tag: 3.1.3~13 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cd66c9d2ccd180028dcc57c004f01f3555c1943b;p=GitHub%2FWoltLab%2FWCF.git Move the caret after the link when inserting images --- 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 +};