Browse Source

Merge branch 'master' into t/ckeditor5/416d

Aleksander Nowodzinski 6 years ago
parent
commit
3dc4ffece9

+ 13 - 0
packages/ckeditor5-core/CHANGELOG.md

@@ -1,6 +1,19 @@
 Changelog
 =========
 
+## [12.3.0](https://github.com/ckeditor/ckeditor5-core/compare/v12.2.1...v12.3.0) (2019-08-26)
+
+### Features
+
+* Allowed configuration of the editor content language via `conifg.language`. See [ckeditor/ckeditor5#1151](https://github.com/ckeditor/ckeditor5/issues/1151). ([22079dd](https://github.com/ckeditor/ckeditor5-core/commit/22079dd))
+* Introduced a `secureSourceElement()` utility that prevents from initialising more than one editor on the same DOM element. See [ckeditor/ckeditor5#746](https://github.com/ckeditor/ckeditor5/issues/746). ([6a59058](https://github.com/ckeditor/ckeditor5-core/commit/6a59058))
+
+### Other changes
+
+* The issue tracker for this package was moved to https://github.com/ckeditor/ckeditor5/issues. See [ckeditor/ckeditor5#1988](https://github.com/ckeditor/ckeditor5/issues/1988). ([6d72325](https://github.com/ckeditor/ckeditor5-core/commit/6d72325))
+* Updated translations. ([e29d56e](https://github.com/ckeditor/ckeditor5-core/commit/e29d56e))
+
+
 ## [12.2.1](https://github.com/ckeditor/ckeditor5-core/compare/v12.2.0...v12.2.1) (2019-07-10)
 
 Internal changes only (updated dependencies, documentation, etc.).

+ 1 - 1
packages/ckeditor5-core/docs/api/core.md

@@ -30,5 +30,5 @@ The source code of this package is available on GitHub in https://github.com/cke
 
 * [`@ckeditor/ckeditor5-core` on npm](https://www.npmjs.com/package/@ckeditor/ckeditor5-core)
 * [`ckeditor/ckeditor5-core` on GitHub](https://github.com/ckeditor/ckeditor5-core)
-* [Issue tracker](https://github.com/ckeditor/ckeditor5-core/issues)
+* [Issue tracker](https://github.com/ckeditor/ckeditor5/issues)
 * [Changelog](https://github.com/ckeditor/ckeditor5-core/blob/master/CHANGELOG.md)

+ 25 - 0
packages/ckeditor5-core/lang/translations/en-gb.po

@@ -0,0 +1,25 @@
+# Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+#
+#                                     !!! IMPORTANT !!!
+#
+#         Before you edit this file, please keep in mind that contributing to the project
+#                translations is possible ONLY via the Transifex online service.
+#
+#         To submit your translations, visit https://www.transifex.com/ckeditor/ckeditor5.
+#
+#                   To learn more, check out the official contributor's guide:
+#     https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
+#
+msgid ""
+msgstr ""
+"Language-Team: English (United Kingdom) (https://www.transifex.com/ckeditor/teams/11143/en_GB/)\n"
+"Language: en_GB\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+msgctxt "Label for the Save button."
+msgid "Save"
+msgstr "Save"
+
+msgctxt "Label for the Cancel button."
+msgid "Cancel"
+msgstr "Cancel"

+ 17 - 17
packages/ckeditor5-core/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@ckeditor/ckeditor5-core",
-  "version": "12.2.1",
+  "version": "12.3.0",
   "description": "The core architecture of CKEditor 5 – the best browser-based rich text editor.",
   "keywords": [
     "ckeditor5-lib",
@@ -21,24 +21,24 @@
     "framework"
   ],
   "dependencies": {
-    "@ckeditor/ckeditor5-engine": "^13.2.1",
-    "@ckeditor/ckeditor5-utils": "^13.0.1",
+    "@ckeditor/ckeditor5-engine": "^14.0.0",
+    "@ckeditor/ckeditor5-utils": "^14.0.0",
     "lodash-es": "^4.17.10"
   },
   "devDependencies": {
-    "@ckeditor/ckeditor5-autoformat": "^11.0.4",
-    "@ckeditor/ckeditor5-basic-styles": "^11.1.3",
-    "@ckeditor/ckeditor5-block-quote": "^11.1.2",
-    "@ckeditor/ckeditor5-editor-classic": "^12.1.3",
-    "@ckeditor/ckeditor5-essentials": "^11.0.4",
-    "@ckeditor/ckeditor5-heading": "^11.0.4",
-    "@ckeditor/ckeditor5-image": "^13.1.2",
-    "@ckeditor/ckeditor5-link": "^11.1.1",
-    "@ckeditor/ckeditor5-list": "^12.0.4",
-    "@ckeditor/ckeditor5-media-embed": "^11.1.3",
-    "@ckeditor/ckeditor5-paragraph": "^11.0.4",
-    "@ckeditor/ckeditor5-table": "^13.0.2",
-    "@ckeditor/ckeditor5-ui": "^13.0.2",
+    "@ckeditor/ckeditor5-autoformat": "^11.0.5",
+    "@ckeditor/ckeditor5-basic-styles": "^11.1.4",
+    "@ckeditor/ckeditor5-block-quote": "^11.1.3",
+    "@ckeditor/ckeditor5-editor-classic": "^12.1.4",
+    "@ckeditor/ckeditor5-essentials": "^11.0.5",
+    "@ckeditor/ckeditor5-heading": "^11.0.5",
+    "@ckeditor/ckeditor5-image": "^14.0.0",
+    "@ckeditor/ckeditor5-link": "^11.1.2",
+    "@ckeditor/ckeditor5-list": "^12.1.0",
+    "@ckeditor/ckeditor5-media-embed": "^11.1.4",
+    "@ckeditor/ckeditor5-paragraph": "^11.0.5",
+    "@ckeditor/ckeditor5-table": "^14.0.0",
+    "@ckeditor/ckeditor5-ui": "^14.0.0",
     "eslint": "^5.5.0",
     "eslint-config-ckeditor5": "^2.0.0",
     "husky": "^1.3.1",
@@ -51,7 +51,7 @@
   "author": "CKSource (http://cksource.com/)",
   "license": "GPL-2.0-or-later",
   "homepage": "https://ckeditor.com/ckeditor-5",
-  "bugs": "https://github.com/ckeditor/ckeditor5-core/issues",
+  "bugs": "https://github.com/ckeditor/ckeditor5/issues",
   "repository": {
     "type": "git",
     "url": "https://github.com/ckeditor/ckeditor5-core.git"

+ 1 - 1
packages/ckeditor5-core/src/editingkeystrokehandler.js

@@ -20,7 +20,7 @@ import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';
  *		editor.keystrokes.set( 'Ctrl+Shift+Z', 'redo' );
  *		editor.keystrokes.set( 'Ctrl+Y', 'redo' );
  *
- * @extends utils/keystrokehandler~KeystrokeHandler
+ * @extends module:utils/keystrokehandler~KeystrokeHandler
  */
 export default class EditingKeystrokeHandler extends KeystrokeHandler {
 	/**

+ 6 - 1
packages/ckeditor5-core/src/editor/editor.js

@@ -91,11 +91,16 @@ export default class Editor {
 		 */
 		this.commands = new CommandCollection();
 
+		const languageConfig = this.config.get( 'language' ) || {};
+
 		/**
 		 * @readonly
 		 * @member {module:utils/locale~Locale}
 		 */
-		this.locale = new Locale( this.config.get( 'language' ) );
+		this.locale = new Locale( {
+			uiLanguage: typeof languageConfig === 'string' ? languageConfig : languageConfig.ui,
+			contentLanguage: this.config.get( 'language.content' )
+		} );
 
 		/**
 		 * Shorthand for {@link module:utils/locale~Locale#t}.

+ 35 - 9
packages/ckeditor5-core/src/editor/editorconfig.jsdoc

@@ -167,18 +167,17 @@
  */
 
 /**
- * The editor UI's language.
+ * The language of the editor UI and its content.
  *
- * The language code is defined in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) standard.
- * CKEditor 5 currently supports around 20 languages and the number is growing.
+ * Note: You do not have to specify this option if your build is optimized for one UI language or if it is
+ * the default language (English is the default language for CDN builds), unless you want to change
+ * the language of your content.
  *
- * Note: You do not have to specify this option if your build is optimized for one language or if it is the default language
- * (English is the default language for CDN builds).
- *
- * Simple usage:
+ * Simple usage (change the language of the UI and the content):
  *
  *		ClassicEditor
  *			.create( document.querySelector( '#editor' ), {
+ *				// The UI of the editor as well as its content will be in German.
  *				language: 'de'
  *			} )
  *			.then( editor => {
@@ -188,14 +187,41 @@
  *				console.error( error );
  *			} );
  *
- * After this step you need to attach the corresponding translation file. Translation files are available on CDN for predefined builds:
+ * Use different languages for the UI and the content using the object syntax:
+ *
+ *		ClassicEditor
+ *			.create( document.querySelector( '#editor' ), {
+ *				language: {
+ *	 				// The UI will be in English.
+ *					ui: 'en',
+ *
+ *					// But the content will be edited in Arabic.
+ *					content: 'ar'
+ * 				}
+ *			} )
+ *			.then( editor => {
+ *				console.log( editor );
+ *			} )
+ *			.catch( error => {
+ *				console.error( error );
+ *			} );
+ *
+ * The language of the content has an impact on the editing experience, for instance it affects screen readers
+ * and spell checkers. It is also particularly useful for typing in certain languages (e.g. right–to–left ones)
+ * because it changes the default alignment of the text.
+ *
+ * The language codes are defined in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) standard.
+ *
+ * You need to add the corresponding translation file for the new UI language to work.
+ * Translation files are available on CDN for predefined builds:
+ *
  *		`<script src="https://cdn.ckeditor.com/ckeditor5/[version.number]/[distribution]/lang/[lang].js"></script>`
  *
  * But you can add them manually by coping from the `node_modules/@ckeditor/ckeditor5-build-[name]/build/lang/[lang].js'`.
  *
  * Check the {@glink features/ui-language UI language guide} for more information about the localization options and translation process.
  *
- * @member {String} module:core/editor/editorconfig~EditorConfig#language
+ * @member {String|Object} module:core/editor/editorconfig~EditorConfig#language
  */
 
 /**

+ 17 - 2
packages/ckeditor5-core/tests/editor/editor.js

@@ -193,10 +193,25 @@ describe( 'Editor', () => {
 			expect( editor.t ).to.equal( editor.locale.t );
 		} );
 
-		it( 'is configured with the config.language', () => {
+		it( 'is configured with the config.language (UI and the content)', () => {
 			const editor = new TestEditor( { language: 'pl' } );
 
-			expect( editor.locale.language ).to.equal( 'pl' );
+			expect( editor.locale.uiLanguage ).to.equal( 'pl' );
+			expect( editor.locale.contentLanguage ).to.equal( 'pl' );
+		} );
+
+		it( 'is configured with the config.language (different for UI and the content)', () => {
+			const editor = new TestEditor( { language: { ui: 'pl', content: 'ar' } } );
+
+			expect( editor.locale.uiLanguage ).to.equal( 'pl' );
+			expect( editor.locale.contentLanguage ).to.equal( 'ar' );
+		} );
+
+		it( 'is configured with the config.language (just the content)', () => {
+			const editor = new TestEditor( { language: { content: 'ar' } } );
+
+			expect( editor.locale.uiLanguage ).to.equal( 'en' );
+			expect( editor.locale.contentLanguage ).to.equal( 'ar' );
 		} );
 	} );