Problem/Motivation
Discovered while re-rolling #2306515: SafeMarkup in CKEditor toolbar configuration UI — fix by not generating markup in PHP but using Twig Macros.
If the site is installed with any of the RTL based languages then the CKEditor toolbar buttons have below issues.
- ISSUE #1:Image buttons do not recognize the language direction change. So no image button appears in the toolbar.
- ISSUE #2The image alternative buttons show inline texts. This is caused by the CSS class ".cke-icon-only". This class doesn't recognize the language direction change.
Step(s) to replicate
- Install latest Drupal 8.x beta in https://simplytest.me/ with language selected as Arabic (ar).
- Navigate to admin/config/content/formats/manage/full_html and see the toolbar buttons.
Proposed resolution
- Image buttons should consider the language direction change. Plugins should call the "LanguageInterface" to determine the language change.
- Need to implement a css class that should consider direction as rtl.
Remaining tasks
- For issue #1, write a test case and validate.
- For issue #2, manual testing is required.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 2563543-11.patch | 8.41 KB | aneek |
| #11 | interdiff-2563543-02-11.txt | 4.5 KB | aneek |
| #9 | Chrome_LANG_AR_after_patch.png | 157.39 KB | aneek |
| #7 | after_patch.png | 139.84 KB | aneek |
| #7 | before_patch.png | 141.76 KB | aneek |

Comments
Comment #2
aneek commentedUploading fail & pass patches to test.
Comment #3
aneek commentedComment #5
wim leersI tested this, with beta 15 versus HEAD plus the patch (https://simplytest.me/project/drupal/8.x?patch[]=https://www.drupal.org/...). Unfortunately, I don't see any difference before vs after.
I don't see why these changes are necessary?
AFAICT you can delete all these changes and still end up with exactly the same HTML?
In other words: I don't think these changes are necessary to fix the problem?
Nit: Indented with 4 instead of 2 spaces.
You can delete this line.
Nit: needs a
\nin between.Nit: needs a
\nin between.Comment #6
aneek commented@Wim Leers, thanks for the review. I might have misses something in the patch. This should work. I will check again and update accordingly this weekend.
Thanks.
Comment #7
aneek commented@Wim Leers,
I've tested the same you tested and I can see that the patch is working with the latest HEAD (beta). Please have a look at the attached image "before_patch" & "after_patch". Btw, have you cleared the browser cache before testing? Might have some effect.
About your query on the changes:
#5.1: Have a look at the file core/modules/ckeditor/ckeditor.admin.inc in current HEAD @ line # 73.
The theme_image is searching for a button with key "image_rtl" if the direction is RTL. The image buttons are coming from "Plugin/CKEditorPlugin/DrupalImage.php" & "Plugin/CKEditorPlugin/DrupalLink.php" files. In both the files
getButtons()method doesn't consider the image direction. So even if the button key exists as "image" the URI is not set. So those changes were done. Have a look at the image "image_not_found.png".The rest reviews I will address soon. Please let me know your views once you re-test the patch.
Thanks.
Comment #8
wim leers#7 As my screenshots show, I tested this on simplytest.me, so I don't see how browser caches could ever cause any problems :( Did you perhaps forget to include a few small things in the patch, that you do have locally? Otherwise, I really have no idea at all how we could be seeing so vastly different things! Note I tested in Chrome.
Oh, LOL, how did I miss that!? I think this would be a much simpler solution then:
In other words: the buttons that don't need LTR/RTL variants, can just use the much simpler
$button['image']. Those that do have LTR and RTL variants can provide both$button['image_ltr']and$button['image_rtl'].Comment #9
aneek commented@Wim Leers, I do agree with you about the simple solution. About the patch, no I am testing in https://simplytest.me/ not in local with the patch. Btw I am installing ARABIC language. Which language are you using? I checked in Chrome as well in Windows & Ubuntu. Both seems to work fine. Please have a look at the attached image (Chrome_LANG_AR_after_patch).
Comment #10
wim leersConfirmed now that it works perfectly :)
So, all that is left, is addressing the nits in points 2–5 in #5, and the simpler solution in #7.
Comment #11
aneek commentedUploading new patch.
Comment #12
aneek commentedComment #13
wim leersGreat work, @aneek! Thanks for your patience!
Comment #16
aneek commentedComment #19
aneek commentedI can't get why this fails. This may be due to other issues. Making it RTBC again. If someone finds any issues then please change the status.
Comment #22
aneek commentedComment #23
alexpottCommitted ae70ed6 and pushed to 8.0.x. Thanks!