Fixes cursor position being lost when adding an image from the mediafinder to a richeditor (#4233)

Credit to @rejuvenatedigital
This commit is contained in:
rejuvenatedigital 2019-04-05 16:27:48 +01:00 committed by Luke Towers
parent 84839ba231
commit aeeb791899
1 changed files with 6 additions and 1 deletions

View File

@ -45,12 +45,17 @@
}
function onInsertImage() {
var $currentImage = editor.image.get()
var $currentImage = editor.image.get(),
selection = editor.selection.get(),
range = editor.selection.ranges(0);
new $.oc.mediaManager.popup({
alias: 'ocmediamanager',
cropAndInsertButton: true,
onInsert: function(items) {
editor.selection.clear();
selection.addRange(range);
if (!items.length) {
$.oc.alert($.oc.lang.get('mediamanager.invalid_image_empty_insert'))
return