messages: Add support for right-to-left messages.

This implements right-to-left message automatic detection support in
the compose box as well as the message feed.  Full unit tests and
support in the message-editing UI are for future work (as are
potentially more fancy things like supporting things like
right-to-left multi-word names for users/streams/etc.).

Fixes #3123.
This commit is contained in:
Shayan Toqraee
2018-07-05 14:47:20 +04:30
committed by Tim Abbott
parent 649fccde6b
commit 0757d022f5
6 changed files with 75 additions and 1 deletions

View File

@@ -406,6 +406,12 @@ MessageListView.prototype = {
blueslip.warn('Only DOM nodes can be passed to _post_process_messages');
}
var row = $(dom_message);
var content = row.find('.message_content');
// Set the rtl class if the text has an rtl direction
if (rtl.get_direction(content.text()) === 'rtl') {
content.addClass('rtl');
}
// Save DOM elements by id into self._rows for O(1) lookup
if (row.hasClass('message_row')) {