Redactor‘s selection handling is very fragile and “forgetting” to restore the selection can cause some very strange side-effects.
The user will start typing inside a selection marker, which will not cause any visual effects, but the content will get lost once the editor removes the markers.
See https://www.woltlab.com/community/thread/296022-einf%C3%BCgen-von-links-im-editor-unter-ipados/
See https://www.woltlab.com/community/thread/296116-einf%C3%BCgen-von-links-im-editor-unter-ipados-text-verschwindet/
See https://www.woltlab.com/community/thread/294753-text-wird-beim-speichern-abgeschnitten/
this.selection.save();
// Closing the dialog might move the focus somewhere else.
+ //
+ // On iPadOS the focus handling is inconsistent with iOS and
+ // causes the marker to persist in the editor, causing strange
+ // side-effects.
window.setTimeout(() => {
- if (document.activeElement !== this.core.editor()[0]) {
+ if (
+ document.activeElement !== this.core.editor()[0]
+ || this.core.editor()[0].querySelector(".redactor-selection-marker") !== null
+ ) {
this.selection.restore();
}
}, 0);