languagetool-org / languagetool-website-2018

OUTDATED, do not use anymore
12 stars 11 forks source link

wrong newline interpretation on iOS? #48

Closed danielnaber closed 3 years ago

danielnaber commented 6 years ago

This is probably somehow caused by the return. It does not happen on Safari 11.1 on the desktop (tested in browserstack.com).

jturcotte commented 5 years ago

The website is not usable on iOS for me because of this (or a similar) issue. By curiosity I tried to track it down and it seems to be caused by getBookmark() in markMyWords at https://github.com/languagetool-org/languagetool-website-2018/blob/master/public/vendors/tiny_mce/plugins/atd-tinymce/editor_plugin3.js#L821.

When var newText = this.getPlainText(); gets run, the bookmark <span> is still there, but on iOS, when discarding the on-screen keyboard, the cursor position seems to get reset and the <span> gets inserted before the MCE's root <p>, adding two additional CR characters to its plain text, and making offsets returned by the API response point to the wrong position in newText.

I tried a few things and couldn't find an easy way to fix it though. Since AtDCore.prototype.markMyWords also seems to have code to maintain the cursor position, maybe this could be used instead of selection bookmarks outside this call.

danielnaber commented 3 years ago

closing, as website has been relaunched