Opened 15 years ago
Closed 13 years ago
#13070 closed enhancement (fixed)
Add RTL/LTR button to html editor
Reported by: | yoavf | Owned by: | yoavf |
---|---|---|---|
Milestone: | 3.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | has-patch rtl commit |
Focuses: | Cc: |
Description (last modified by )
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)
#4
follow-up:
↓ 5
@
13 years ago
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.
#5
in reply to:
↑ 4
@
13 years ago
- 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.
#7
@
13 years ago
- Keywords needs-refresh removed
Made it a default button now, but only when the global(ish) isRtl is true.
#9
@
13 years ago
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).
#10
@
13 years 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 :)
#13
follow-up:
↓ 14
@
13 years 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?
#14
in reply to:
↑ 13
;
follow-up:
↓ 15
@
13 years 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.
Idea forum suggestion here: http://wordpress.org/extend/ideas/topic/rtl-and-tinymce-wysiwyg-editor