Welcome to Geeklog, Anonymous Friday, December 01 2023 @ 02:34 pm EST
Geeklog Forums
FCKeditor isn't RTL automatically
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
I've also submitted the following as a bug report:
In edit mode, unlike the rest of the site. FCKeditor doesn't respond to <body dir=rtl>.
It doesn't matter FCKeditor's menus are presented in a RTL language (i.e. fckeditor/editor/lang/that_language.js has RTL defined) and that the same language is used in one's browser's setting.
So RTL users must manually go RTL (by clicking on ctrl+right shift inside the textarea), which, besides being totally unsuitable for newbies, again returns to LTR when you click on the "Source" button and such.
The documentation says FCKeditor has a natural support for RTL, so something must be wrong.
Also, the version inside Geeklog contains some files in fckeditor/editor/dialog that supposedly provide a language direction selection. Using them would be the best choice for multilingual sites.
Failed solutions:
storyeditor_advanced.thtml :
<textarea dir="{direction}" id="introhtml"...
or
<td dir="{direction}" ...><textarea id="introhtml"...
public_html/javascript/storyeditor_fckeditor.js :
var oFCKeditor1 = new FCKeditor( 'introhtml' ) ;
...
oFCKeditor1.Dir='rtl'
or
oFCKeditor1.Dir='right';
In edit mode, unlike the rest of the site. FCKeditor doesn't respond to <body dir=rtl>.
It doesn't matter FCKeditor's menus are presented in a RTL language (i.e. fckeditor/editor/lang/that_language.js has RTL defined) and that the same language is used in one's browser's setting.
So RTL users must manually go RTL (by clicking on ctrl+right shift inside the textarea), which, besides being totally unsuitable for newbies, again returns to LTR when you click on the "Source" button and such.
The documentation says FCKeditor has a natural support for RTL, so something must be wrong.
Also, the version inside Geeklog contains some files in fckeditor/editor/dialog that supposedly provide a language direction selection. Using them would be the best choice for multilingual sites.
Failed solutions:
Text Formatted Code
storyeditor_advanced.thtml :
<textarea dir="{direction}" id="introhtml"...
or
<td dir="{direction}" ...><textarea id="introhtml"...
public_html/javascript/storyeditor_fckeditor.js :
var oFCKeditor1 = new FCKeditor( 'introhtml' ) ;
...
oFCKeditor1.Dir='rtl'
or
oFCKeditor1.Dir='right';
7
8
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
Eureka!
The problem lies with public_html/fckeditor/editor/fckeditor.html
Here's the needed fix:
window.document.dir = FCKLang.Dir ;
// custom code - start
// Ok, window.document.dir is never ACTUALLY used!
// Therefore let's actually use it.
FCKConfig.ContentLangDirection = window.document.dir ;
// Without it, FCKConfig.ContentLangDirection is hardcoded in
// public_html/fckeditor/fckconfig.js !
// (by default it's hardcoded to LTR, but changing it to RTL would just hardcode RTL)
// Custom code - end
The tracker is still down, so I hope some "official" applies this patch and notify here.
Although it should be said this is not a complete solution because all FCKeditor cares about is the browser's setting whereas Geeklog checks a lot more things. Therefore somehow using $LANG_DIRECTION (in one of the PHP files that involve FCKeditor) for FCKConfig.ContentLangDirection would be a lot better.
BTW, although it matters less, relying only on the browser is true for any language setting in FCKeditor, so it would be better off to improve FCKLanguageManager.GetActiveLanguage in the JS files in public_html/fckeditor/editor/js/
But again, that's minor. Having LTR or RTL when you want the opposite is really annoying and looks unprofessional in the eyes of newbie clients (especially since there's no usage of the supposedly actual button FCKeditor provides to switch language direction).
The problem lies with public_html/fckeditor/editor/fckeditor.html
Here's the needed fix:
Text Formatted Code
// Set the editor interface direction.window.document.dir = FCKLang.Dir ;
// custom code - start
// Ok, window.document.dir is never ACTUALLY used!
// Therefore let's actually use it.
FCKConfig.ContentLangDirection = window.document.dir ;
// Without it, FCKConfig.ContentLangDirection is hardcoded in
// public_html/fckeditor/fckconfig.js !
// (by default it's hardcoded to LTR, but changing it to RTL would just hardcode RTL)
// Custom code - end
The tracker is still down, so I hope some "official" applies this patch and notify here.
Although it should be said this is not a complete solution because all FCKeditor cares about is the browser's setting whereas Geeklog checks a lot more things. Therefore somehow using $LANG_DIRECTION (in one of the PHP files that involve FCKeditor) for FCKConfig.ContentLangDirection would be a lot better.
BTW, although it matters less, relying only on the browser is true for any language setting in FCKeditor, so it would be better off to improve FCKLanguageManager.GetActiveLanguage in the JS files in public_html/fckeditor/editor/js/
But again, that's minor. Having LTR or RTL when you want the opposite is really annoying and looks unprofessional in the eyes of newbie clients (especially since there's no usage of the supposedly actual button FCKeditor provides to switch language direction).
9
5
Quote
All times are EST. The time is now 02:34 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content