Opened 13 years ago

Closed 13 years ago

#6897 closed New Feature (wontfix)

No "dir" attribute is added unless direction is changed manually

Reported by: Mohammad Ebrahim Mohammadi Panah Owned by:
Priority: Normal Milestone:
Component: Core : BiDi Version: 3.5
Keywords: Cc: ebrahim@…

Description (last modified by Krzysztof Studnik)

I use Persian UI of CKEditor, which is right-to-left, to produce right-to-left content on an English page, and English is a left-to-right language. I expect CKEditor to add a dir="rtl" to elements by default, but it doesn't add it. For example if I open CKEditor and type "salam, output HTML would be '<p>salam</p>' rather than '<p dir="rtl">salam</p>'. So the final content which was right-to-left in CKEditor, is left-to-right outside of CKEditor. The same issue happens if someone uses a left-to-right UI of CKEditor to produce some content for a right-to-left page/context.

If you're wondering why would anybody produce RTL content for a LTR context: Language of content should be thought of independently of language of UI. It is popular for RTL-languaged people to use the normal LTR UI, but with RTL content. The issue would be more obvious in multi-language environments.

I think "dir" attribute should be added to content by default for some reasons:

  1. Text direction is actually an attribute of the content.
  2. Not always layout direction of editing equals layout direction of presentation.
  3. If adding direction is not done by CKEditor, it has to be taken care of outside CKEditor, which complicates integrating CKEditor in BiDi environments, specially if you want the user to be able to personalize UI language of his editor.

(Note that I know direction of UI is independent of contentsLangDirection, but I described it like above not to complicate the description.)

Change History (4)

comment:1 Changed 13 years ago by Mohammad Ebrahim Mohammadi Panah

Cc: ebrahim@… added

comment:2 Changed 13 years ago by Krzysztof Studnik

Description: modified (diff)
Keywords: Discussion added
Status: newconfirmed
Type: BugNew Feature

The question is if CKEditor should set its defaults, depending on language used in browser or page where it resides?

comment:3 Changed 13 years ago by Mohammad Ebrahim Mohammadi Panah

Default direction of content should obey contentsLangDirection config, which in turn defaults to 'ui' to obey direction of UI language. See 'contentsLangDirection', 'language', and 'defaultLanguage' config items.

In fact default direction of content is currently correct while editing, but the produced HTML does not contain appropriate "dir" attribute(s).

comment:4 Changed 13 years ago by Frederico Caldeira Knabben

Keywords: Discussion removed
Resolution: wontfix
Status: confirmedclosed

contentsLangDirection is there to set an "environmental feature" for the editor contents. This means that the content produced with the editor are supposed to be injected into spaces where the direction is already set.

Just think about it in the same way as fonts face, size and color. The editor will not enforce the font on every single paragraph style, but to have the proper wysiwyg feeling, you should use the same font features in the final page where the contents are to be published.

To conclude, if you expect to produce rtl contents, you should publish it on rtl spaces, either having a <div dir="rtl"> container or <html dir="rtl">. If the application was able to set contentsLangDirection on content creation, it can certainly save the direction to be applied on output.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy