Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#16944 closed Bug (worksforme)

Setting language in inline editor doesn't change language direction in content area.

Reported by: Jakub Ś Owned by:
Priority: Normal Milestone:
Component: General Version: 4.0
Keywords: Cc:

Description

Steps to reproduce

  1. Open attached sample
  2. Change language to Arabic

Expected result

Toolbar and contentarea change direction to RTL.

Actual result

Only Toolbar changes direction to RTL. Content area stays in LTR mode.

Other details (browser, OS, CKEditor version, installed plugins)

Problem can be worked around by uncommenting this code:

var container = document.getElementById( 'editor1' );
if( languageCode == 'ug' || languageCode == 'fa' || languageCode == 'ar' || languageCode == 'he' )
	container.setAttribute( 'dir', 'rtl');
else
	container.setAttribute( 'dir', 'ltr');

Attachments (1)

uilanguages2.html (4.6 KB) - added by Jakub Ś 2 years ago.

Download all attachments as: .zip

Change History (4)

Changed 2 years ago by Jakub Ś

Attachment: uilanguages2.html added

comment:1 Changed 2 years ago by Jakub Ś

Status: newconfirmed

comment:2 Changed 2 years ago by Marek Lewandowski

Resolution: worksforme
Status: confirmedclosed

AFAICS Attached code is the same as in http://nightly.ckeditor.com/latest/full/ckeditor/samples/old/uilanguages.html

And it works correctly then. As you're changing the language to Arabic content's language gets also changed.

Also note that content language can be set explicitly http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-contentsLanguage

comment:3 Changed 2 years ago by Jakub Ś

False Alarm - http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-contentsLangDirection.

All you need is:

editor = CKEDITOR.inline( 'editor1', {
	language: languageCode,
	contentsLangDirection : ( languageCode == 'ug' || languageCode == 'fa' || languageCode == 'ar' || languageCode == 'he' ) ? 'rtl' : 'ltr',

	on: {
		instanceReady: function() {
			// Wait for the editor to be ready to set
			// the language combo.
			var languages = document.getElementById( 'languages' );
			languages.value = this.langCode;
			languages.disabled = false;
		}
	}
});
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy