NodeBB / nodebb-plugin-composer-quill

WYSIWYG composer for NodeBB based off of Quill (https://quilljs.com/)
MIT License
15 stars 11 forks source link

Adding mention or emoji inline (:name) switches text direction #79

Open PostMidnight opened 5 years ago

PostMidnight commented 5 years ago

To reproduce, switch to RTL, and add an emoji by typing : and selecting one from the dialog selection box. The direction will switch to LTR and the line will be aligned to the left.

PostMidnight commented 5 years ago

Turns out this is an old issue I reported earlier with textcomplete and mention.

The following pull fixed markdown, but not mention: https://github.com/julianlam/nodebb-plugin-markdown/pull/107

We should reopen the issue: https://github.com/NodeBB/NodeBB/issues/7457

To recap, mention returns a string @ + userslug, and that confuses the editor. It should return html with direction / alignment attributes.

PostMidnight commented 5 years ago

Update:

I removed HTML support from textcomplete.contenteditable that I had earlier to solve RTL issues with Redactor. Now mention and inline emoji work well. Using text also fixes https://github.com/NodeBB/nodebb-plugin-composer-quill/issues/79.

As for textcomplete.contenteditable: The command that was making quill reset the direction is "range.deleteContents();". That command stems from a PR for providing HTML support. See here: (https://github.com/yuku/textcomplete.contenteditable/pull/3)

Since HTML insertion is not supported by composer, and since we are dropping Redactor, going back to text is the best solution.

I did however keep the changes from the mentioned PR that allow textcomplete to work with Safari. @julianlam I do believe Safari related support should be integrated to the core, for the benefit of all other users.

Feel free to close this issue when appropriate.