this.buffer.set();
if (data.url) {
- this.insert.html('<img src="' + data.url + '" class="woltlabAttachment" data-attachment-id="' + attachmentId + '">');
+ var id = 'wcfImgAttachment' + this.uuid;
+ var img = elById(id);
+ if (img) img.removeAttribute('id');
+
+ this.insert.html('<img src="' + data.url + '" class="woltlabAttachment" data-attachment-id="' + attachmentId + '" id="' + id + '">');
+
+ window.setTimeout((function () {
+ // Safari does not properly update the caret position on insert
+ var img = elById(id);
+ if (img) {
+ img.removeAttribute('id');
+ this.caret.after(img);
+ }
+ }).bind(this), 10);
}
else {
// non-image attachment
smiley = elById(id);
smiley.removeAttribute('id');
+ // Safari does not properly update the caret position on insert
+ this.caret.after(smiley);
+
//noinspection SillyAssignmentJS
smiley.outerHTML = smiley.outerHTML;
}
this._setTitle(pre);
pre.addEventListener(WCF_CLICK_EVENT, this._callbackEdit);
+
+ // work-around for Safari
+ this._editor.caret.end(pre);
}
},
this._setTitle(quote);
quote.addEventListener(WCF_CLICK_EVENT, this._callbackEdit);
+
+ // work-around for Safari
+ this._editor.caret.end(quote);
}
},
this._setTitle(spoiler);
spoiler.addEventListener(WCF_CLICK_EVENT, this._callbackEdit);
+
+ // work-around for Safari
+ this._editor.caret.end(spoiler);
}
},