Commit b266ef47 authored by Jérome Perrin's avatar Jérome Perrin

core,dms,xhtml_syle: support language in editor gadgets (CKEditor and pdf.js)

A new option render option, "language" is passed to the gadget. It is
a two letter code as used by Localier.

Both CKEditor and pdf.js have support for translations and already
include translations for many languages. Before this change, they were
auto detecting the browser language and displaying in the browser
language, ignoring the language that was selected in ERP5. With this
change, they use the language selected in ERP5.

For CKEditor, we need to set the language only it is actually supported,
otherwise CKEditor crash. pdf.js does not this, but we had to call
ourselves initialize - which is probably better, because it was a promise
not awaited.
parent 6dccfa3b
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testCRMCreateNewEventEditorLanguage</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title tal:content="template/title_or_id"></title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3" tal:content="template/title_or_id"></td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/init" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/create_translation_data" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/prepare_data" />
<!-- try with a language supported (fr) in CKEditor, then a language not supported (wo) -->
<tal:block
tal:define="language_and_translations python:[('fr', {'Font': 'Police', 'Actions': 'Actions'}), ('wo', {'Font': 'Font', 'Actions': 'caozhuo'})]"
tal:repeat="language_and_translation language_and_translations">
<tr>
<td>store</td>
<td>${base_url}/web_site_module/renderjs_runner/<tal:block tal:replace="python: language_and_translation[0]"/>/#</td>
<td>renderjs_url</td>
</tr>
<tal:block tal:define="translation_dict python: language_and_translation[1]">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/view_create_new_event_dialog" />
</tal:block>
<tal:block tal:define="dialog_content_configuration python: {'field_your_title': '',
'field_your_portal_type': 'Mail Message',
'field_your_resource': '',
'field_your_notification_message': '',
'field_your_event_workflow_action': 'send',
'field_your_source': '',
'field_your_destination': '',
'field_your_text_content': '<p><br></p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_new_event_dialog_content" />
</tal:block>
<tal:block tal:define="dialog_content_configuration python: {'field_your_title': 'erp5_crm_ui_test_create_event_title',
'field_your_portal_type': 'Letter',
'field_your_resource': '',
'field_your_start_date': '2010-01-01T00:00:00',
'field_your_notification_message': '',
'field_your_event_workflow_action': 'send',
'field_your_source': 'erp5_crm_ui_test_agent_title',
'field_your_destination': 'erp5_crm_ui_test_customer_title',
'field_your_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/fill_create_new_event_dialog_content" />
</tal:block>
<tr>
<td>selectFrame</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>css=.cke_combo__font > .cke_combo_label</td>
<td tal:content="python: language_and_translation[1]['Font']"></td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
<!-- Header has a save button -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Created and associated a new Letter to the ticket.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="response_configuration python: {'field_my_title': 'erp5_crm_ui_test_create_event_title',
'field_my_portal_type': 'Letter',
'field_my_resource': '',
'field_my_start_date': '2010-01-01T00:00:00',
'simulation_state': 'Sent',
'field_my_source_title': 'erp5_crm_ui_test_agent_title',
'field_my_destination_title': 'erp5_crm_ui_test_customer_title',
'field_my_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_response_content" />
</tal:block>
<tr>
<td>selectFrame</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>css=.cke_combo__font > .cke_combo_label</td>
<td tal:content="python: language_and_translation[1]['Font']"></td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -207,7 +207,7 @@
</tal:block>
<tal:block metal:define-macro="view_create_new_event_dialog">
<tal:block metal:define-macro="view_create_new_event_dialog" tal:define="translation_dict translation_dict | python: {}">
<tr>
<td colspan="3"><b>Display the create new event dialog</b></td>
</tr>
......@@ -223,7 +223,7 @@
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view_editable.html']</td>
<td></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Actions'}">
<tal:block tal:define="click_configuration python: {'text': translation_dict.get('Actions', 'Actions')}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
......@@ -234,11 +234,11 @@
</tr>
<tr>
<td>assertTextPresent</td>
<td>Create New Event</td>
<td tal:content="python: translation_dict.get('Create New Event', 'Create New Event')">Create New Event</td>
<td></td>
</tr>
<tal:block tal:define="click_configuration python: {'text': 'Create New Event'}">
<tal:block tal:define="click_configuration python: {'text': translation_dict.get('Create New Event', 'Create New Event')}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
......@@ -250,7 +250,7 @@
</tr>
<tr>
<td>assertTextPresent</td>
<td>Create New Event</td>
<td tal:content="python: translation_dict.get('Create New Event', 'Create New Event')">Create New Event</td>
<td></td>
</tr>
<tr>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testCRMCreateNewEventEditorLanguage</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title tal:content="template/title_or_id"></title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3" tal:content="template/title_or_id"></td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMUiTest/macros/init" />
<tr>
<td>open</td>
<td tal:content="string: ${here/portal_url}/Base_createUITestLanguages"></td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>New Languages Added</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMUiTest/macros/prepare_data" />
<!-- try with a language supported (fr) in CKEditor, then a language not supported (wo) -->
<tal:block
tal:define="language_and_translations python:[('French', 'Police'), ('Wolof', 'Font')]"
tal:repeat="language_and_translation language_and_translations">
<tr>
<td>open</td>
<td>${base_url}</td>
<td></td>
</tr>
<tr>
<td>selectAndWait</td>
<td>select_language</td>
<td tal:content="python: language_and_translation[0]"></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMUiTest/macros/view_create_new_event_dialog" />
<tal:block tal:define="dialog_content_configuration python: {'field_your_title': '',
'field_your_portal_type': 'Mail Message',
'field_your_resource': '',
'field_your_notification_message': '',
'field_your_event_workflow_action': 'send',
'field_your_source': '',
'field_your_destination': '',
'field_your_text_content': '<p><br></p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMUiTest/macros/check_create_new_event_dialog_content" />
</tal:block>
<tal:block tal:define="dialog_content_configuration python: {'field_your_title': 'Test event',
'field_your_portal_type': 'Letter',
'field_your_resource': '',
'field_your_start_date': '2010-01-01T00:00:00',
'field_your_notification_message': '',
'field_your_event_workflow_action': 'send',
'field_your_source': 'erp5_crm_ui_test_agent_title',
'field_your_destination': 'erp5_crm_ui_test_customer_title',
'field_your_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMUiTest/macros/fill_create_new_event_dialog_content" />
</tal:block>
<tr>
<td>selectFrame</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>css=.cke_combo__font > .cke_combo_label</td>
<td tal:content="python: language_and_translation[1]"></td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>dialog_submit_button</td>
<td></td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>Created and associated a new Letter to the ticket.</td>
<td></td>
</tr>
<tal:block tal:define="response_configuration python: {'field_my_title': 'Test event',
'field_my_portal_type': 'Letter',
'field_my_resource': '',
'field_my_start_date': '2010-01-01T00:00:00',
'simulation_state': 'Sent',
'field_my_source_title': 'erp5_crm_ui_test_agent_title',
'field_my_destination_title': 'erp5_crm_ui_test_customer_title',
'field_my_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMUiTest/macros/check_response_content" />
</tal:block>
<tr>
<td>selectFrame</td>
<td>//iframe</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>css=.cke_combo__font > .cke_combo_label</td>
<td tal:content="python: language_and_translation[1]"></td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -13,16 +13,18 @@
});
})
.declareMethod("render", function (options) {
this.props.key = options.key;
webViewerLoad(options.value);
// hide few buttons for now
this.props.element.querySelector('#viewBookmark').hidden = true;
this.props.element.querySelector('#documentProperties').hidden = true;
this.props.element.querySelector('#documentProperties').hidden = true;
this.props.element.querySelector('#download').hidden = true;
return;
var gadget = this;
gadget.props.key = options.key;
configure(PDFJS);
PDFJS.locale = options.language;
return PDFViewerApplication.initialize().then(function() {
webViewerInitialized(options.value);
// hide some buttons that do not make sense for us
gadget.props.element.querySelector('#viewBookmark').hidden = true;
gadget.props.element.querySelector('#documentProperties').hidden = true;
gadget.props.element.querySelector('#documentProperties').hidden = true;
gadget.props.element.querySelector('#download').hidden = true;
});
})
.declareMethod("getContent", function () {
var form_data = {};
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testPDFPreviewLanguage</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode>PDF Preview Editor Language</unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title tal:content="template/title_and_id"></title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3" tal:content="template/title_and_id"></td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td tal:content="string: ${here/portal_url}/Base_createUITestLanguages"></td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>New Languages Added</td>
<td></td>
</tr>
<tr>
<td>openAndWait</td>
<td>${base_url}/fr/document_module/test_ERP5_Logo_PDF/PDF_viewPDFJSPreview</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//iframe[contains(@src, "pdfjs.gadget.html")]</td>
<td></td>
</tr>
<tr>
<td>selectFrame</td>
<td>//iframe[contains(@src, "pdfjs.gadget.html")]</td>
<td></td>
</tr>
<tr>
<td>waitForText</td>
<td>//body//div[@class='textLayer']/div[1]</td>
<td>This is a sample PDF with some text and an image</td>
</tr>
<tr>
<td>waitForText</td>
<td>//option[@id="pageAutoOption"]</td>
<td>Zoom automatique</td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
<!-- Try with a language not supported by pdf.js -->
<tr>
<td>selectAndWait</td>
<td>select_language</td>
<td>Xhosa</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//iframe[contains(@src, "pdfjs.gadget.html")]</td>
<td></td>
</tr>
<tr>
<td>selectFrame</td>
<td>//iframe[contains(@src, "pdfjs.gadget.html")]</td>
<td></td>
</tr>
<tr>
<td>waitForText</td>
<td>//option[@id="pageAutoOption"]</td>
<td>Automatic Zoom</td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testPDFPreviewLanguage</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode>PDF Preview Editor Language</unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title tal:content="template/title_and_id"></title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3" tal:content="template/title_and_id"></td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/create_translation_data" />
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<!-- try with a language supported (fr) in pdf.js, then a language not supported (wo) -->
<tal:block
tal:define="language_and_translations python:[('fr', 'Views', 'Zoom automatique'), ('wo', 'shitu', 'Automatic Zoom')]"
tal:repeat="language_and_translation language_and_translations">
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/<tal:block tal:replace="python: language_and_translation[0]"/>/#/document_module/test_ERP5_Logo_PDF?editable=1</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block tal:define="click_configuration python: {'text': language_and_translation[1]}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Preview'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>waitForElementPresent</td>
<td>//iframe[contains(@src, "pdfjs.gadget.html")]</td>
<td></td>
</tr>
<tr>
<td>selectFrame</td>
<td>//iframe[contains(@src, "pdfjs.gadget.html")]</td>
<td></td>
</tr>
<tr>
<td>waitForText</td>
<td>//body//div[@class='textLayer']/div[1]</td>
<td>This is a sample PDF with some text and an image</td>
</tr>
<tr>
<td>waitForText</td>
<td>//option[@id="pageAutoOption"]</td>
<td tal:content="python: language_and_translation[2]">Automatic Zoom</td>
</tr>
<tr>
<td>selectFrame</td>
<td>relative=top</td>
<td></td>
</tr>
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -142,7 +142,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'jio_key\', context.getRelativeUrl()), (\'editor\', context.Base_getEditorFieldPreferredTextEditor()), (\'portal_type\', context.getPortalType()), (\'maximize\', \'listbox\' not in field.id), (\'content_type\', context.getProperty(\'content_type\'))]</string> </value>
<value> <string>python: [(\'jio_key\', context.getRelativeUrl()), (\'editor\', context.Base_getEditorFieldPreferredTextEditor()), (\'portal_type\', context.getPortalType()), (\'maximize\', \'listbox\' not in field.id), (\'content_type\', context.getProperty(\'content_type\')), (\'language\', context.getPortalObject().Localizer.get_selected_language())]</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -12,6 +12,8 @@
* @property {string} portal_type the portal type
* @property {boolean} editable set to true to have an editor when user
* can modify the content, false for a "read only" editor
* @property {string} language the user language, if the editor supports
* localisation it will be displayed in this language
* @property {boolean} run a hack for jsmd editor
* @property {string} key Key for ERP5 form
*/
......@@ -81,6 +83,7 @@
maximize: options.maximize,
portal_type: options.portal_type,
editable: options.editable || false,
language: options.language,
//run value is used to make jsmd viewer available in editable mode
//this is temporary until the viewer becomes editable
run: options.run || false,
......
......@@ -99,7 +99,8 @@
READONLY_CONFIGURATION,
is_responsive: (options.configuration_mobile !== undefined) ||
(options.configuration === undefined),
is_mobile: MATCH_MEDIA.matches
is_mobile: MATCH_MEDIA.matches,
language: options.language
});
})
......@@ -124,7 +125,8 @@
modification_dict.hasOwnProperty('configuration_readonly') ||
modification_dict.hasOwnProperty('is_responsive') ||
modification_dict.hasOwnProperty('is_mobile') ||
modification_dict.hasOwnProperty('editable')) {
modification_dict.hasOwnProperty('editable') ||
modification_dict.hasOwnProperty('language')) {
// Expected configuration changed.
// Recreate ckeditor
if (gadget.hasOwnProperty('ckeditor')) {
......@@ -139,6 +141,10 @@
} else {
configuration = gadget.state.configuration;
}
if (CKEDITOR.lang.languages[gadget.state.language] !== undefined) {
configuration.language = gadget.state.language;
configuration.defaultLanguage = gadget.state.language;
}
gadget.on_change_listener = gadget.deferNotifyChange.bind(gadget);
gadget.ckeditor = CKEDITOR.replace(
this.element.querySelector('textarea'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment