Allow setting direction to either ltr or rtl

Created on 10 January 2024, about 1 year ago

Problem/Motivation

Currently this module only adds a single on/off button that toggles the [dir="rtl"] attribute on the selected element.
In the settings of the text format , we can also configure it to toggle the [dir="ltr"] attribute instead.

But that's not enough.

This module should have two buttons:
One button to toggle the [dir="rtl"] attribute
And another to toggle the [dir="ltr"]

We should be able to set the [dir] attribute to either "rtl" or "ltr" or remove it as needed.

(similar to what was available in Ckeditor 4)

Feature request
Status

Active

Version

4.0

Component

User interface

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @hejazee
  • 🇺🇸United States smustgrave

    I'm open to the idea

  • Status changed to Closed: duplicate 8 months ago
  • 🇺🇸United States smustgrave

    Will be covered in a redo ticket.

  • Status changed to Active 4 months ago
  • This issue remains unresolved
    and issue #3461112 is not a duplicate of this.

    I recently updated to 5.0.0 and the problem is not solved.

    Let's clarify the requirements:
    An element in the editor can have three distinct states:

    • State No. 1: an element with dir set to "rtl": <div dir="rtl">
    • State No. 2: an element with dir set to "ltr": <div dir="ltr">
    • State No. 3: an element with no dir attribute set:

      Currently, this module includes two buttons but does not support all three states. Only State 1 and State 3 are supported.

      The intention is that no admin configuration should be required for all three states to be available to users simultaneously. The admin should not need to configure the editor to allow toggling dir="rtl" or dir="ltr"; rather, users should always have the option to select between the three states, regardless of any admin configuration.

      (At the very least, an option should be provided in the settings to allow users to choose among the three states.)

      Proposal:
      We should have two buttons:
      1 - A button to toggle between dir="ltr" and no dir set.
      2 - A button to toggle between dir="rtl" and no dir set.

      Note: the two buttons can not be active at the same time. Only one of them or none of them can be active at a time.

  • 🇮🇱Israel israelshmueli

    I believe we can fix this issue by providing, via the JS, default direction value based on current page direction. Please see the enclosed patch.
    These daye we are upgrading the Bar-Ilan University multiple department websites from CKEeditor 4 to ckeditor5
    Most of our department websites needs that the bidi plugin will work on pages in both directions since usually Hebrew and English is enabled on same website.
    Currently the module is not working as expected on the RTL pages because the default language is defaults to LTR.
    In the enclosed patch the default direction is set dynamicly according to the current document/page direction.

Production build 0.71.5 2024