this.insert.html = (function (html, data) {
if (callback) callback = callback();
+ var selection = window.getSelection();
+ if (selection.rangeCount && selection.anchorNode.nodeName === 'IMG') {
+ this.caret.after(selection.anchorNode);
+ }
+
this.placeholder.hide();
this.core.editor().focus();
// Firefox may have an incorrect selection if pasting into the editor using the contextual menu
if (this.detect.isFirefox()) {
- var selection = this.selection.get();
- if (selection.anchorNode.closest('.redactor-layer') === null) {
+ var anchorNode = (selection.anchorNode.nodeType === Node.TEXT_NODE) ? selection.anchorNode.parentNode : selection.anchorNode;
+ if (anchorNode.closest('.redactor-layer') === null) {
this.selection.restore();
- selection = this.selection.get();
- if (selection.anchorNode.closest('.redactor-layer') === null) {
+ anchorNode = (selection.anchorNode.nodeType === Node.TEXT_NODE) ? selection.anchorNode.parentNode : selection.anchorNode;
+ if (anchorNode.closest('.redactor-layer') === null) {
this.WoltLabCaret.endOfEditor();
this.selection.save();
}
elRemove(block);
}
}
+
+ if (selection.rangeCount && selection.anchorNode.nodeName === 'IMG') {
+ this.caret.after(selection.anchorNode);
+ }
}).bind(this);
var mpText = this.insert.text;