nodebb-plugin-composer-quill icon indicating copy to clipboard operation
nodebb-plugin-composer-quill copied to clipboard

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

Open PostMidnight opened this issue 6 years ago • 2 comments

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 avatar Aug 01 '19 18:08 PostMidnight

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 avatar Aug 02 '19 10:08 PostMidnight

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.

PostMidnight avatar Aug 02 '19 11:08 PostMidnight