Opened 3 years ago
Closed 13 months ago
#13070 closed enhancement (fixed)
Add RTL/LTR button to html editor
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | Editor | Version: | |
| Severity: | normal | Keywords: | has-patch rtl commit |
| Cc: | r_a_m_i@… |
Description (last modified by yoavf)
When using WordPress in an RTL language (Farsi, Hebrew, Arabic etc... ) it's a real pain to use the HTML editor when the content actually includes HTML.
TinyMCE has the directionality plugin to add a RTL/LTR button, but there's no equivalent in the HTML editor.
This patch adds the missing button
Attachments (3)
Change History (19)
- Keywords changed from has-patch, rtl to has-patch rtl
related #19598
Wouldn't it be better to use the dir="..." attribute on the textarea to change directions (this seems suggested at W3.org)?
Also the current patch works but only because of the back-compat in Quicktags. The "new" method of adding buttons is described here. Thinking if we are doing this, it should be included in wp_editor() and added automatically when the text direction is RTL, similar to the "directionality" plugin for TinyMCE.
- Owner set to yoavf
- Status changed from new to assigned
Replying to azaozz:
Wouldn't it be better to use the dir="..." attribute on the textarea to change directions
Also the current patch works but only because of the back-compat in Quicktags. The "new" method of adding buttons is described here. Thinking if we are doing this, it should be included in wp_editor() and added automatically when the text direction is RTL, similar to the "directionality" plugin for TinyMCE.
Absolutely - this patch is 22months old, but I'll be happy to work on a refresh.
- Keywords needs-refresh added
If it gets refreshed, I'm game for this for 3.4.
- Keywords needs-refresh removed
Made it a default button now, but only when the global(ish) isRtl is true.
The patch looks good. Wondering if we can use something like:
document.getElementsByTagName('html')[0].dir
to determine the initial text direction, instead of relying on the global isRtl being set (it's set only in the admin).
comment:10
yoavf — 16 months ago
Makes sense, 13070.2.patch does that instead of using isRtl.
I didn't bother "caching" the value of document.getElementsByTagName('html')[0].dir since it's only used twice - but if you think I should, I will :)
comment:11
nacin — 14 months ago
- Keywords commit added
comment:12
ramiy — 14 months ago
- Cc r_a_m_i@… added
comment:13
follow-up:
↓ 14
nacin — 14 months ago
This patch changes how the text is viewed in the HTML editor, but it doesn't do anything to the HTML.
When pressing the direction button in TinyMCE, the HTML underneath changes, so I get <p dir="ltr"> for example. I imagine you'd want that here, right?
comment:14
in reply to:
↑ 13
;
follow-up:
↓ 15
yoavf — 14 months ago
When pressing the direction button in TinyMCE, the HTML underneath changes, so I get <p dir="ltr"> for example. I imagine you'd want that here, right?
Actually, no - it doesn't make sense in the HTML editor.
The default in the HTML editor is RTL, but if you want to actually edit HTML tags and code, it's a mess, so you just want to switch the entire box to LTR (and back, when you're done).
The button isn't supposed to affect the content, just the editor.
Maybe in the next version we can find a way to differentiate the 'Fullscreen' and 'Text direction' buttons so they don't look like the other, content altering, buttons.
comment:15
in reply to:
↑ 14
nacin — 14 months ago
comment:16
azaozz — 13 months ago
- Resolution set to fixed
- Status changed from assigned to closed
In [20451]:

Idea forum suggestion here: http://wordpress.org/extend/ideas/topic/rtl-and-tinymce-wysiwyg-editor