0

In Drupal 11.2.2 with Arabic as main language and English as a second language, I have a node set to English.
When I edit it, I use the following JavaScript code to make everything have an ltr direction, so I could read and edit the English in the correct alignment and directionality.

// ==UserScript==
// @name         LTR edit
// @match        *://example.com/*/*
// ==/UserScript==

window.setInterval ( ()=>{

if (
    document.body.classList.contains(
        "page-node-type-page-in-english"
    )
) {
    document.querySelectorAll('*').forEach( (element)=>{
        element.setAttribute("dir", "ltr");
    });
}

}, 1000);

My problem is that after about 2-4 seconds, Drupal (or CkEditor, I am not sure) will cause a "flash" of bringing everything back to rtl. Now then, it will immediately be back to ltr but the "flash" is still a bit annoying.

I force dir="ltr" but Drupal or CKEditor brings back dir="rtl" - how to solve that if at all possible?

1
  • 1
    There is nothing in Drupal core or CKEditor which would cause this to happen, so it must be something specific to your installation or environment (or perhaps a contributed module you have installed). If the behaviour is overriding a user script, it’s likely being caused by another user script, or browser plugin. Either way, without some steps to reproduce, it’s not a suitable question for the site I’m afraid Commented Aug 22 at 17:17

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.