diff --git a/docs/_snippets/features/wproofreader.html b/docs/_snippets/features/wproofreader.html index 935acb224c2..9d3d9fe16e0 100644 --- a/docs/_snippets/features/wproofreader.html +++ b/docs/_snippets/features/wproofreader.html @@ -1,11 +1,3 @@ - -

Typos hapen. We striving to correct them. Hover on the marked words for instant correction suggestions or click the dialog icon in the bottom right corner to have the whole text proofread at once.

You can also paste your own text here to have its spelling and grammar checked.

diff --git a/docs/_snippets/features/wproofreader.js b/docs/_snippets/features/wproofreader.js index 0a96d824907..855b4dbac74 100644 --- a/docs/_snippets/features/wproofreader.js +++ b/docs/_snippets/features/wproofreader.js @@ -3,15 +3,61 @@ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ -/* globals ClassicEditor, console, window, document */ +/* globals console, window, document */ + +import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; +import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset'; +import EasyImage from '@ckeditor/ckeditor5-easy-image/src/easyimage'; +import WProofreader from '@webspellchecker/wproofreader-ckeditor5/src/wproofreader'; import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config'; ClassicEditor .create( document.querySelector( '#snippet-wproofreader' ), { + plugins: [ ArticlePluginSet, EasyImage, WProofreader ], + wproofreader: { + serviceId: '1:Eebp63-lWHbt2-ASpHy4-AYUpy2-fo3mk4-sKrza1-NsuXy4-I1XZC2-0u2F54-aqYWd1-l3Qf14-umd', + srcUrl: 'https://svc.webspellchecker.net/spellcheck31/wscbundle/wscbundle.js' + }, cloudServices: CS_CONFIG, toolbar: { + items: [ + 'heading', + '|', + 'bold', + 'italic', + 'bulletedList', + 'numberedList', + '|', + 'outdent', + 'indent', + '|', + 'blockQuote', + 'link', + 'mediaEmbed', + 'insertTable', + '|', + 'undo', + 'redo' + ], viewportTopOffset: window.getViewportTopOffsetConfig() + }, + image: { + styles: [ + 'full', + 'alignLeft', + 'alignRight' + ], + toolbar: [ + 'imageStyle:alignLeft', + 'imageStyle:full', + 'imageStyle:alignRight', + '|', + 'imageTextAlternative' + ] + }, + table: { + contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ] } } ) .then( editor => { diff --git a/docs/features/spelling-and-grammar-checking.md b/docs/features/spelling-and-grammar-checking.md index 418644792b1..c8a8724c0ae 100644 --- a/docs/features/spelling-and-grammar-checking.md +++ b/docs/features/spelling-and-grammar-checking.md @@ -5,8 +5,6 @@ menu-title: Spelling and grammar checking # Proofreading, spelling and grammar checking -{@snippet build-classic-source} - The spell checker for CKEditor 5 is a commercial solution provided by our partner, [WebSpellChecker](https://webspellchecker.com/). You can report any issues in its [GitHub repository](https://github.com/WebSpellChecker/wproofreader). The license can be purchased [here](https://ckeditor.com/contact/). @@ -29,63 +27,84 @@ There are also over 150 additional languages and specialized dictionaries such a ## Installation -WProofreader is installed separately from CKEditor 5 and does not need to be combined into an editor build as other features. To use this tool, it is necessary to load the WProofreader script on your page and provide the configuration. +WProofreader is delivered as a CKEditor 5 plugin, so it could be combined into an editor build as other features. To add this feature to your rich-text editor, install the [`@webspellchecker/wproofreader-ckeditor5`](https://www.npmjs.com/package/@webspellchecker/wproofreader-ckeditor5) package: + +```bash +npm install --save @webspellchecker/wproofreader-ckeditor5 +``` + +Then, add it to your plugin list: + +```js +import WProofreader from '@webspellchecker/wproofreader-ckeditor5/src/wproofreader'; +// ... + +ClassicEditor + .create( editorElement, { + plugins: [ ..., WProofreader ], + // ... + } ) + .then( ... ) + .catch( ... ); +``` + + + Read more about {@link builds/guides/integration/installing-plugins installing plugins}. + -The proofreader can be used either as a [cloud solution](#wproofreader-cloud) or [hosted on your own server](#wproofreader-server). +At this step, it is required to provide a proper configuration. The proofreader can be used either as a [cloud solution](#wproofreader-cloud) or [hosted on your own server](#wproofreader-server). ### WProofreader Cloud After signing up for a [trial or paid version](https://ckeditor.com/contact/), you will receive your service ID which is used to activate the service. -Add the following configuration to your page: - -```html - -``` +Add the following configuration to your editor: -And then load the proofreader script: +```js +import WProofreader from '@webspellchecker/wproofreader-ckeditor5/src/wproofreader'; +// ... -```html - +ClassicEditor + .create( editorElement, { + plugins: [ ..., WProofreader ], + wproofreader: { + serviceId: 'your-service-ID', + srcUrl: 'https://svc.webspellchecker.net/spellcheck31/wscbundle/wscbundle.js' + } + } ) ``` -Refer to the [official documentation](https://github.com/WebSpellChecker/wproofreader#wproofreader-cloud) for more details about the cloud setup and available configuration options. +Refer to the [official documentation](https://github.com/WebSpellChecker/wproofreader-ckeditor5#install-instructions) for more details about the cloud setup and available configuration options. ### WProofreader Server After signing up for a [trial or paid version](https://ckeditor.com/contact/), you will receive access to the WebSpellChecker Server package to install on your own server. -You will need to add the following configuration to your page: - -```html - -``` - -Then specify the path to the service on your page: - -```html - +You will need to add the following configuration to your editor: + +```js +import WProofreader from '@webspellchecker/wproofreader-ckeditor5/src/wproofreader'; +// ... + +ClassicEditor + .create( editorElement, { + plugins: [ ..., WProofreader ], + wproofreader: { + serviceProtocol: 'https', + serviceHost: 'localhost', + servicePort: '2880', + servicePath: '/', + srcUrl: 'https://host_name/virtual_directory/wscbundle/wscbundle.js' + } + } ) ``` -Refer to the [official documentation](https://github.com/WebSpellChecker/wproofreader#wproofreader-server) for more details about the server setup and available configuration options. +Refer to the [official documentation](https://github.com/WebSpellChecker/wproofreader-ckeditor5#install-instructions) for more details about the server setup and available configuration options. ## Configuration -WProofreader configuration is set outside the CKEditor 5 configuration. Refer to the [WProofreader API](http://dev.webspellchecker.net/api/wscbundle/) for further information. +WProofreader configuration is set inside the CKEditor 5 configuration in `wproofreader` object. Refer to the [WProofreader API](https://webspellchecker.com/docs/api/wscbundle/Options.html) for further information. ## Contribute -You can report issues and request features in the [official WProofreader repository](https://github.com/WebSpellChecker/wproofreader/issues). +You can report issues and request features in the [official WProofreader for CKEditor 5 repository](https://github.com/WebSpellChecker/wproofreader-ckeditor5/issues). diff --git a/docs/framework/guides/architecture/editing-engine.md b/docs/framework/guides/architecture/editing-engine.md index abdd9b101d9..606eede6d73 100644 --- a/docs/framework/guides/architecture/editing-engine.md +++ b/docs/framework/guides/architecture/editing-engine.md @@ -226,14 +226,14 @@ editor.data; // The data pipeline (DataController). ### Element types and custom data -The structure of the view resembles the structure in the DOM very closely. The semantics of HTML is defined in its specification. The view structure comes "DTD-free", so in order to provide additional information and to better express the semantics of the content, the view structure implements 6 element types ({@link module:engine/view/containerelement~ContainerElement}, {@link module:engine/view/attributeelement~AttributeElement}, {@link module:engine/view/emptyelement~EmptyElement}, {@link module:engine/view/rawelement~RawElement}, {@link module:engine/view/uielement~UIElement}, and {@link module:engine/view/editableelement~EditableElement}) and so called {@link module:engine/view/element~Element#getCustomProperty "custom properties"} (i.e. custom element properties which are not rendered). This additional information provided by editor features is then used by the {@link module:engine/view/renderer~Renderer} and [converters](#conversion). +The structure of the view resembles the structure in the DOM very closely. The semantics of HTML is defined in its specification. The view structure comes "DTD-free", so in order to provide additional information and to better express the semantics of the content, the view structure implements 6 element types ({@link module:engine/view/containerelement~ContainerElement}, {@link module:engine/view/attributeelement~AttributeElement}, {@link module:engine/view/emptyelement~EmptyElement}, {@link module:engine/view/rawelement~RawElement}, {@link module:engine/view/uielement~UIElement}, and {@link module:engine/view/editableelement~EditableElement}) and so called {@link module:engine/view/element~Element#getCustomProperty "custom properties"} (i.e. custom element properties which are not rendered). This additional information provided by the editor features is then used by the {@link module:engine/view/renderer~Renderer} and [converters](#conversion). The element types can be defined as follows: * **Container element** – The elements that build the structure of the content. Used for block elements such as `

`, `

`, `
`, `
  • `, etc. * **Attribute element** – The elements that cannot hold container elements inside them. Most model text attributes are converted to view attribute elements. They are used mostly for inline styling elements such as ``, ``, ``, ``. Similar attribute elements are flattened by the view writer, so e.g. `x` would automatically be optimized to `x`. * **Empty element** – The elements that must not have any child nodes, for example ``. -* **UI elements** – The elements that are not a part of the "data" but need to be "inlined" in the content. They are ignored by the selection (it jumps over them) and the view writer in general. The contents of these elements and events coming from them are filtered out, too. +* **UI element** – The elements that are not a part of the "data" but need to be "inlined" in the content. They are ignored by the selection (it jumps over them) and the view writer in general. The contents of these elements and events coming from them are filtered out, too. * **Raw element** – The elements that work as data containers ("wrappers", "sandboxes") but their children are transparent to the editor. Useful when non-standard data must be rendered but the editor should not be concerned what it is and how it works. Users cannot put the selection inside a raw element, split it into smaller chunks or directly modify its content. * **Editable element** – The elements used as "nested editables" of non-editable fragments of the content, for example a caption in the image widget, where the `
    ` wrapping the image is not editable (it is a widget) and the `
    ` inside it is an editable element. diff --git a/package.json b/package.json index 47a6c3d3562..6874bfe4755 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "@ckeditor/ckeditor5-react": "^2.1.0", "@ckeditor/ckeditor5-real-time-collaboration": "^21.0.0", "@ckeditor/ckeditor5-track-changes": "^21.0.0", + "@webspellchecker/wproofreader-ckeditor5": "^1.0.5", "@wiris/mathtype-ckeditor5": "7.20.0", "babel-standalone": "^6.26.0", "coveralls": "^3.1.0", diff --git a/packages/ckeditor5-adapter-ckfinder/lang/translations/ko.po b/packages/ckeditor5-adapter-ckfinder/lang/translations/ko.po index ce88f251290..9091420381e 100644 --- a/packages/ckeditor5-adapter-ckfinder/lang/translations/ko.po +++ b/packages/ckeditor5-adapter-ckfinder/lang/translations/ko.po @@ -18,4 +18,4 @@ msgstr "" msgctxt "A generic error message displayed on upload failure. The file name is concatenated to this text." msgid "Cannot upload file:" -msgstr "파일 업로드 불가" +msgstr "파일 업로드할 수 없음: " diff --git a/packages/ckeditor5-alignment/lang/translations/ko.po b/packages/ckeditor5-alignment/lang/translations/ko.po index 08bd7992789..eee9fc740ca 100644 --- a/packages/ckeditor5-alignment/lang/translations/ko.po +++ b/packages/ckeditor5-alignment/lang/translations/ko.po @@ -18,19 +18,19 @@ msgstr "" msgctxt "Toolbar button tooltip for aligning the text to the left." msgid "Align left" -msgstr "왼쪽 맞춤" +msgstr "왼쪽 정렬" msgctxt "Toolbar button tooltip for aligning the text to the right." msgid "Align right" -msgstr "오른쪽 맞춤" +msgstr "오른쪽 정렬" msgctxt "Toolbar button tooltip for aligning the text to center." msgid "Align center" -msgstr "가운데 맞춤" +msgstr "가운데 정렬" msgctxt "Toolbar button tooltip for making the text justified." msgid "Justify" -msgstr "양쪽 맞춤" +msgstr "양쪽 정렬" msgctxt "Dropdown button tooltip for the text alignment feature." msgid "Text alignment" diff --git a/packages/ckeditor5-alignment/lang/translations/zh.po b/packages/ckeditor5-alignment/lang/translations/zh.po index 12fc8d2ac6e..8224a1435a1 100644 --- a/packages/ckeditor5-alignment/lang/translations/zh.po +++ b/packages/ckeditor5-alignment/lang/translations/zh.po @@ -38,4 +38,4 @@ msgstr "文字對齊" msgctxt "Label used by assistive technologies describing the text alignment feature toolbar." msgid "Text alignment toolbar" -msgstr "" +msgstr "文字對齊" diff --git a/packages/ckeditor5-autoformat/docs/features/autoformat.md b/packages/ckeditor5-autoformat/docs/features/autoformat.md index c0472bdd71d..d5a1fccd0fb 100644 --- a/packages/ckeditor5-autoformat/docs/features/autoformat.md +++ b/packages/ckeditor5-autoformat/docs/features/autoformat.md @@ -42,8 +42,9 @@ Example: In addition to enabling automatic text formatting, you may want to check the following productivity features: -* {@link features/text-transformation Automatic text transformation} – It enables automatic turning snippets such as `(tm)` into `™` and `"foo"` into `“foo”`. -* {@link features/mentions Mentions} – It brings support for smart autocompletion. +* {@link features/text-transformation Automatic text transformation} – Enables automatic turning snippets such as `(tm)` into `™` and `"foo"` into `“foo”`. +* {@link features/link#autolink-feature Autolink} – Turns the links and email addresses typed or pasted into the editor into active URLs. +* {@link features/mentions Mentions} – Brings support for smart autocompletion. ## Installation diff --git a/packages/ckeditor5-autoformat/tests/blockautoformatediting.js b/packages/ckeditor5-autoformat/tests/blockautoformatediting.js index 38e376de881..32c22ab0c97 100644 --- a/packages/ckeditor5-autoformat/tests/blockautoformatediting.js +++ b/packages/ckeditor5-autoformat/tests/blockautoformatediting.js @@ -167,7 +167,7 @@ describe( 'blockAutoformatEditing', () => { editor.conversion.for( 'downcast' ) .elementToElement( { model: 'softBreak', - view: ( modelElement, viewWriter ) => viewWriter.createEmptyElement( 'br' ) + view: ( modelElement, { writer } ) => writer.createEmptyElement( 'br' ) } ); const spy = testUtils.sinon.spy(); @@ -207,7 +207,7 @@ describe( 'blockAutoformatEditing', () => { editor.conversion.for( 'downcast' ) .elementToElement( { model: 'softBreak', - view: ( modelElement, viewWriter ) => viewWriter.createEmptyElement( 'br' ) + view: ( modelElement, { writer } ) => writer.createEmptyElement( 'br' ) } ); const spy = testUtils.sinon.spy(); diff --git a/packages/ckeditor5-autosave/lang/translations/ko.po b/packages/ckeditor5-autosave/lang/translations/ko.po index 64f5357b34d..588c8aa359f 100644 --- a/packages/ckeditor5-autosave/lang/translations/ko.po +++ b/packages/ckeditor5-autosave/lang/translations/ko.po @@ -18,4 +18,4 @@ msgstr "" msgctxt "A message that the data is being saved." msgid "Saving changes" -msgstr "변경사항 저장" +msgstr "변경된 내용을 저장하고 있습니다" diff --git a/packages/ckeditor5-basic-styles/lang/translations/ko.po b/packages/ckeditor5-basic-styles/lang/translations/ko.po index de5f573dde6..9f463a40292 100644 --- a/packages/ckeditor5-basic-styles/lang/translations/ko.po +++ b/packages/ckeditor5-basic-styles/lang/translations/ko.po @@ -30,7 +30,7 @@ msgstr "밑줄" msgctxt "Toolbar button tooltip for the Code feature." msgid "Code" -msgstr "소스" +msgstr "코드" msgctxt "Toolbar button tooltip for the Strikethrough feature." msgid "Strikethrough" diff --git a/packages/ckeditor5-ckfinder/lang/translations/ko.po b/packages/ckeditor5-ckfinder/lang/translations/ko.po new file mode 100644 index 00000000000..ffc168b5c69 --- /dev/null +++ b/packages/ckeditor5-ckfinder/lang/translations/ko.po @@ -0,0 +1,37 @@ +# Copyright (c) 2003-2020, 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: Korean (https://www.transifex.com/ckeditor/teams/11143/ko/)\n" +"Language: ko\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "Toolbar button tooltip for inserting an image or file via a CKFinder file browser." +msgid "Insert image or file" +msgstr "사진이나 파일을 삽입" + +msgctxt "Error message displayed when inserting a resized version of an image failed." +msgid "Could not obtain resized image URL." +msgstr "크기가 조절된 사진의 URL을 가져오지 못했습니다." + +msgctxt "Title of a notification displayed when inserting a resized version of an image failed." +msgid "Selecting resized image failed" +msgstr "크기가 조절된 이미지 선택 실패" + +msgctxt "Error message displayed when an image cannot be inserted at the current position." +msgid "Could not insert image at the current position." +msgstr "현재 위치에 사진을 삽입할 수 없습니다." + +msgctxt "Title of a notification displayed when an image cannot be inserted at the current position." +msgid "Inserting image failed" +msgstr "사진 삽입 실패" diff --git a/packages/ckeditor5-code-block/lang/translations/ko.po b/packages/ckeditor5-code-block/lang/translations/ko.po new file mode 100644 index 00000000000..1f3bf78d7e9 --- /dev/null +++ b/packages/ckeditor5-code-block/lang/translations/ko.po @@ -0,0 +1,25 @@ +# Copyright (c) 2003-2020, 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: Korean (https://www.transifex.com/ckeditor/teams/11143/ko/)\n" +"Language: ko\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "A label of the button that allows inserting a new code block into the editor content." +msgid "Insert code block" +msgstr "코드 블럭 삽입" + +msgctxt "A language of the code block in the editor content when no specific programming language is associated with it." +msgid "Plain text" +msgstr "평문" diff --git a/packages/ckeditor5-code-block/lang/translations/zh.po b/packages/ckeditor5-code-block/lang/translations/zh.po new file mode 100644 index 00000000000..bc7cd08ff23 --- /dev/null +++ b/packages/ckeditor5-code-block/lang/translations/zh.po @@ -0,0 +1,25 @@ +# Copyright (c) 2003-2020, 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: Chinese (Taiwan) (https://www.transifex.com/ckeditor/teams/11143/zh_TW/)\n" +"Language: zh_TW\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "A label of the button that allows inserting a new code block into the editor content." +msgid "Insert code block" +msgstr "插入程式碼區塊" + +msgctxt "A language of the code block in the editor content when no specific programming language is associated with it." +msgid "Plain text" +msgstr "純文字" diff --git a/packages/ckeditor5-core/lang/translations/ko.po b/packages/ckeditor5-core/lang/translations/ko.po index 3be062cc2f2..dae881cba36 100644 --- a/packages/ckeditor5-core/lang/translations/ko.po +++ b/packages/ckeditor5-core/lang/translations/ko.po @@ -26,4 +26,4 @@ msgstr "취소" msgctxt "The label used by a button next to the color palette in the color picker that removes the color (resets it to an empty value, example usages in font color or table properties)." msgid "Remove color" -msgstr "색상 지우기" +msgstr "색깔 제거" diff --git a/packages/ckeditor5-core/src/editor/utils/dataapimixin.js b/packages/ckeditor5-core/src/editor/utils/dataapimixin.js index 057d8bb8883..be18fb1d6fd 100644 --- a/packages/ckeditor5-core/src/editor/utils/dataapimixin.js +++ b/packages/ckeditor5-core/src/editor/utils/dataapimixin.js @@ -71,7 +71,8 @@ export default DataApiMixin; * the right format for you. * * @method #getData - * @param {Object} [options] + * @param {Object} [options] Additional configuration for the retrieved data. + * Editor features may introduce more configuration options that can be set through this parameter. * @param {String} [options.rootName='main'] Root name. * @param {String} [options.trim='empty'] Whether returned data should be trimmed. This option is set to `'empty'` by default, * which means that whenever editor content is considered empty, an empty string is returned. To turn off trimming diff --git a/packages/ckeditor5-engine/docs/_snippets/framework/extending-content-add-unsafe-link-class.html b/packages/ckeditor5-engine/docs/_snippets/framework/extending-content-add-unsafe-link-class.html index e89fc38bb4e..fedd11bacf5 100644 --- a/packages/ckeditor5-engine/docs/_snippets/framework/extending-content-add-unsafe-link-class.html +++ b/packages/ckeditor5-engine/docs/_snippets/framework/extending-content-add-unsafe-link-class.html @@ -8,6 +8,6 @@ diff --git a/packages/ckeditor5-engine/docs/_snippets/framework/extending-content-allow-div-attributes.html b/packages/ckeditor5-engine/docs/_snippets/framework/extending-content-allow-div-attributes.html index e6a6a577f12..3dc66517e1e 100644 --- a/packages/ckeditor5-engine/docs/_snippets/framework/extending-content-allow-div-attributes.html +++ b/packages/ckeditor5-engine/docs/_snippets/framework/extending-content-allow-div-attributes.html @@ -1,12 +1,12 @@
    -

    Special section A: It has set "style" and "id" attributes.

    +

    Special section A: It has both the "style" and "id" attributes set.

    Regular content of the editor.

    -

    Special section B: It has set "style", "id" and spellcheck="false" attributes.

    +

    Special section B: It has the "style", "id" and spellcheck="false" attributes set.

    This section disables the native browser spellchecker.

    diff --git a/packages/ckeditor5-engine/docs/_snippets/framework/extending-content-custom-element-converter.html b/packages/ckeditor5-engine/docs/_snippets/framework/extending-content-custom-element-converter.html index 0c58bd5e388..8ddc1601430 100644 --- a/packages/ckeditor5-engine/docs/_snippets/framework/extending-content-custom-element-converter.html +++ b/packages/ckeditor5-engine/docs/_snippets/framework/extending-content-custom-element-converter.html @@ -1,27 +1,45 @@ diff --git a/packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-extending-output.md b/packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-extending-output.md index 9ad66ca6726..1e160d216b6 100644 --- a/packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-extending-output.md +++ b/packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-extending-output.md @@ -16,17 +16,17 @@ If you want to learn how to load some extra content (element, attributes, classe ### Code architecture -It is recommended that the code that customizes the editor data and editing pipelines is delivered as {@link framework/guides/architecture/core-editor-architecture#plugins plugins} and all examples in this guide follow this convention. +It is recommended for the code that customizes the editor data and editing pipelines to be delivered as {@link framework/guides/architecture/core-editor-architecture#plugins plugins} and all examples in this guide follow this convention. Also for the sake of simplicity all examples use the same {@link module:editor-classic/classiceditor~ClassicEditor `ClassicEditor`}, but keep in mind that code snippets will work with other editors, too. -Finally, none of the converters covered in this guide require to import any module from CKEditor 5 Framework, hence, you can write them without rebuilding the editor. In other words, such converters can easily be added to existing {@link builds/guides/overview CKEditor 5 builds}. +Finally, none of the converters covered in this guide requires to import any modules from CKEditor 5 Framework, hence, you can write them without rebuilding the editor. In other words, such converters can easily be added to existing {@link builds/guides/overview CKEditor 5 builds}. ### Granular converters You can create separate converters for the data and editing (downcast) pipelines. The former (`dataDowncast`) will customize the data in the editor output (e.g. when {@link builds/guides/integration/saving-data#manually-retrieving-the-data obtaining the editor data}). The latter (`editingDowncast`) will only work for the content of the editor when editing. -If you do not want to complicate your conversion, you can just add a single (`downcast`) converter which will apply both to the data and the editing view. We did that in all examples to keep them simple but keep in mind you have options: +If you do not want to complicate your conversion, you can just add a single (`downcast`) converter which will apply both to the data and the editing view. We did that in all the examples to keep them simple but keep in mind you have several options: ```js // Adds a conversion dispatcher for the editing downcast pipeline only. @@ -47,32 +47,32 @@ editor.conversion.for( 'downcast' ).add( dispatcher => { ### CKEditor 5 inspector -{@link framework/guides/development-tools#ckeditor-5-inspector CKEditor 5 inspector} is an invaluable help when working with the model and view structures. It allows browsing their structure and checking selection positions like in typical browser developer tools. Make sure to enable the inspector when playing with CKEditor 5. +The {@link framework/guides/development-tools#ckeditor-5-inspector CKEditor 5 inspector} is an invaluable help when working with the model and view structures. It allows browsing their structure and checking selection positions like in typical browser developer tools. Make sure to enable the inspector when playing with CKEditor 5. ## Adding a CSS class to inline elements In this example all links (`...`) get the `.my-green-link` CSS class. This includes all links in the editor output (`editor.getData()`) and all links in the edited content (existing and future ones). - - Note that the same behavior can be obtained with {@link features/link#custom-link-attributes-decorators link decorators}: - - ```js - ClassicEditor - .create( ..., { - // ... - link: { - decorators: { - addGreenLink: { - mode: 'automatic', - attributes: { - class: 'my-green-link' - } + +Note that the same behavior can be obtained with {@link features/link#custom-link-attributes-decorators link decorators}: + +```js +ClassicEditor + .create( ..., { + // ... + link: { + decorators: { + addGreenLink: { + mode: 'automatic', + attributes: { + class: 'my-green-link' } } } - } ) - ``` - + } + } ) +``` + {@snippet framework/extending-content-add-link-class} @@ -136,21 +136,20 @@ Add some CSS styles for `.my-green-link` to see the customization in action: ## Adding an HTML attribute to certain inline elements -In this example all links (`...`) that do not have "ckeditor.com" in their `href="..."` get the `target="_blank"` attribute. This includes all links in the editor output (`editor.getData()`) and all links in the edited content (existing and future ones). +In this example all the links (`...`) that do not have "ckeditor.com" in their `href="..."` get the `target="_blank"` attribute. This includes all links in the editor output (`editor.getData()`) and all links in the edited content (existing and future ones). - - Note that similar behavior can be obtained with {@link module:link/link~LinkConfig#addTargetToExternalLinks link decorators}: - - ```js - ClassicEditor - .create( ..., { - // ... - link: { - addTargetToExternalLinks: true - } - } ) - ``` - + +Note that similar behavior can be obtained with {@link module:link/link~LinkConfig#addTargetToExternalLinks link decorators}: + +```js +ClassicEditor + .create( ..., { + // ... + link: { + addTargetToExternalLinks: true + } + } ) +``` {@snippet framework/extending-content-add-external-link-target} @@ -216,27 +215,27 @@ a[target="_blank"]::after { In this example all links (`...`) that do not have `https://` in their `href="..."` attribute get the `.unsafe-link` CSS class. This includes all links in the editor output (`editor.getData()`) and all links in the edited content (existing and future ones). - - Note that the same behavior can be obtained with {@link features/link#custom-link-attributes-decorators link decorators}: - - ```js - ClassicEditor - .create( ..., { - // ... - link: { - decorators: { - markUnsafeLink: { - mode: 'automatic', - callback: url => /^(http:)?\/\//.test( url ), - attributes: { - class: 'unsafe-link' - } + +Note that the same behavior can be obtained with {@link features/link#custom-link-attributes-decorators link decorators}: + +```js +ClassicEditor + .create( ..., { + // ... + link: { + decorators: { + markUnsafeLink: { + mode: 'automatic', + callback: url => /^(http:)?\/\//.test( url ), + attributes: { + class: 'unsafe-link' } } } - } ) - ``` - + } + } ) +``` + {@snippet framework/extending-content-add-unsafe-link-class} @@ -302,7 +301,7 @@ Add some CSS styles for "unsafe" links to make them visible: ## Adding a CSS class to block elements -In this example all second–level headings (`

    ...

    `) get the `.my-heading` CSS class. This includes all heading elements in the editor output (`editor.getData()`) and in the edited content (existing and future ones). +In this example all second–level headings (`

    ...

    `) get the `.my-heading` CSS class. This includes all the heading elements in the editor output (`editor.getData()`) and in the edited content (existing and future ones). {@snippet framework/extending-content-add-heading-class} diff --git a/packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-introduction.md b/packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-introduction.md index d6c3545d08a..3464af18ff9 100644 --- a/packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-introduction.md +++ b/packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-introduction.md @@ -12,13 +12,13 @@ order: 10 This guide extends the {@link framework/guides/architecture/editing-engine introduction to CKEditor 5 editing engine architecture}. Therefore, we highly recommend reading the former guide first. -In this guide we will dive deeper into some of the conversion concepts related to model attributes. +In this guide you will dive deeper into some of the conversion concepts. ## Inline and block content -Generally speaking, there are two main types of the content in the editor view and data output: inline and block. +Generally speaking, there are two main types of content in the editor view and data output: inline and block. -The inline content means elements like ``, `` or ``. Unlike `

    `, `

    ` or `
    `, inline elements do not structure the data. Instead, they mark some text in a specific (visual and semantical) way. These elements are a characteristic of a text. For instance, you could say that some part of the text is bold, or is linked, etc.. This concept has its reflection in the model of the rich-text editor where `` or `` are not represented as elements. Instead, they are attributes of the text. +The inline content means elements like ``, `` or ``. Unlike `

    `, `

    ` or `
    `, inline elements do not structure the data. Instead, they format some text in a specific (visual and semantical) way. These elements are a characteristic of a text. For instance, you could say that some part of the text is bold, or is linked, etc. This concept has its reflection in the model of the rich-text editor where `` or `` are not represented as elements. Instead, they are the attributes of the text. For example — in the model, you might have a `` element with the "Foo bar" text, where "bar" has the `bold` attribute set to `true`. A pseudo–code of this *model* data structure could look as follows: @@ -30,7 +30,7 @@ For example — in the model, you might have a `` element with th ``` - Throughout the rest of this guide the following, shorter convention will be used to represent model text attributes: + Throughout the rest of this guide the following, shorter convention will be used to represent model text attributes for the sake of clarity: ```html Foo <$text bold="true">bar @@ -39,11 +39,11 @@ For example — in the model, you might have a `` element with th Note that there is no `` or any other additional element there, it is just some text with an attribute. -So, when does this text become wrapped with a `` element? This happens during the conversion to the view. It is also important to know which type of a view element needs to be used. In case of elements that represent inline formatting, this should be an {@link module:engine/view/attributeelement~AttributeElement}. +So, when does this text become wrapped with a `` element? This happens during the conversion to the view. It is also important to know what type of a view element needs to be used. In the case of the elements that represent inline formatting, this should be an {@link module:engine/view/attributeelement~AttributeElement}. ## Conversion of multiple text attributes -A model text node may have multiple attributes (e.g. be bolded and linked) and all of them are converted to their respective view elements by independent converters. +A model text node may have multiple attributes (e.g. be bolded and linked) and all of them are converted into their respective view elements by independent converters. Keep in mind that in the model, attributes do not have any specific order. This is contrary to the editor view or HTML output, where inline elements are nested in one another. Fortunately, the nesting happens automatically during the conversion from the model to the view. This makes working in the model simpler, as features do not need to take care of breaking or rearranging elements in the model. @@ -73,7 +73,7 @@ Note that the `` element is converted in such way that it always becomes the

    ``` -There are two links with the same `href` attribute next to each other in the generated view (editor output), which is semantically wrong. To make sure that it never happens, the view element that represents a link must have a *priority* defined. Most elements, like for instance ``, do not care about it and stick to the default priority (`10`). The {@link features/link link feature} ensures that all view `
    ` elements have the priority set to `5` so they are kept outside other elements. +There are two links with the same `href` attribute next to each other in the generated view (editor output), which is semantically wrong. To make sure that it never happens, the view element that represents a link must have a *priority* defined. Most elements, like for instance ``, do not care about it and stick to the default priority (`10`). The {@link features/link link feature} ensures that all `` view elements have the priority set to `5` therefore they are kept outside other elements. ## Merging attribute elements during conversion @@ -112,9 +112,9 @@ But this is not the most optimal output you can get from the rich-text editor. W

    ``` -Obviously a single `` makes more sense. And thanks to the merging mechanism built into the conversion process, this would be the actual result of the conversion. +Obviously a single `` makes more sense. And thanks to the merging mechanism built into the conversion process, this would be the actual output of the conversion. -Why is it so? In the above scenario, two model attributes are converted to `` elements. When the first attribute (say, `fontFamily`) is converted, there is no `` in the view yet. So the first `` is added with the `style` attribute. But then, when `fontSize` is converted, the `` is already in the view. The {@link module:engine/view/downcastwriter~DowncastWriter downcast writer} recognizes it and checks whether the elements can be merged, following these 3 rules: +Why is it so? In the above scenario, two model attributes are converted to `` elements. When the first attribute (say, `fontFamily`) is converted, there is no `` in the view yet. So the first `` is added with the `style` attribute. But then, when `fontSize` is converted, the `` is already in the view. The {@link module:engine/view/downcastwriter~DowncastWriter downcast writer} recognizes it and checks whether these elements can be merged, following these 3 rules: 1. Both elements must have the same {@link module:engine/view/element~Element#name name}. 2. Both elements must have the same {@link module:engine/view/attributeelement~AttributeElement#priority priority}. diff --git a/packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-preserving-custom-content.md b/packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-preserving-custom-content.md index 062ed1f4cac..311eaa21f90 100644 --- a/packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-preserving-custom-content.md +++ b/packages/ckeditor5-engine/docs/framework/guides/deep-dive/conversion-preserving-custom-content.md @@ -16,42 +16,41 @@ Eventually, this knowledge will allow you to create your custom features on top ### Code architecture -It is recommended that the code that customizes the editor data and editing pipelines is delivered as {@link framework/guides/architecture/core-editor-architecture#plugins plugins} and all examples in this guide follow this convention. +It is recommended for the code that customizes the editor data and editing pipelines to be delivered as {@link framework/guides/architecture/core-editor-architecture#plugins plugins} and all examples in this guide follow this convention. Also for the sake of simplicity all examples use the same {@link module:editor-classic/classiceditor~ClassicEditor `ClassicEditor`}, but keep in mind that code snippets will work with other editors, too. -Finally, none of the converters covered in this guide require to import any module from CKEditor 5 Framework, hence, you can write them without rebuilding the editor. In other words, such converters can easily be added to existing {@link builds/guides/overview CKEditor 5 builds}. +Finally, none of the converters covered in this guide requires to import any modules from CKEditor 5 Framework, hence, you can write them without rebuilding the editor. In other words, such converters can easily be added to existing {@link builds/guides/overview CKEditor 5 builds}. ### CKEditor 5 inspector -{@link framework/guides/development-tools#ckeditor-5-inspector CKEditor 5 inspector} is an invaluable help when working with the model and view structures. It allows browsing their structure and checking selection positions like in typical browser developer tools. Make sure to enable the inspector when playing with CKEditor 5. +The {@link framework/guides/development-tools#ckeditor-5-inspector CKEditor 5 inspector} is an invaluable help when working with the model and view structures. It allows browsing their structure and checking selection positions like in typical browser developer tools. Make sure to enable the inspector when playing with CKEditor 5. ## Loading content with a custom attribute -In this example links (`
    ...`) loaded into the editor content will preserve their `target` attribute, which is not supported by the {@link features/link Link} feature. The DOM `target` attribute will be stored in the editor model as a `linkTarget` attribute. +In this example the links (`...`) loaded into the editor content will preserve their `target` attribute, which is by default *not* supported by the {@link features/link Link} feature. The DOM `target` attribute will be stored in the editor model as a `linkTarget` attribute. -Unlike the {@link framework/guides/deep-dive/conversion-extending-output#adding-an-html-attribute-to-certain-inline-elements downcast–only solution}, this approach does not change the content loaded into the editor. Links without the `target` attribute will not get one and links with the attribute will preserve its value. +Unlike the {@link framework/guides/deep-dive/conversion-extending-output#adding-an-html-attribute-to-certain-inline-elements downcast–only solution}, this approach does not change the content loaded into the editor. Any links without the `target` attribute will not get one while all the links with the attribute will preserve its value. - - Note that the same behavior can be obtained with {@link features/link#custom-link-attributes-decorators link decorators}: - - ```js - ClassicEditor - .create( ..., { - // ... - link: { - decorators: { - addGreenLink: { - mode: 'automatic', - attributes: { - class: 'my-green-link' - } + +Note that the same behavior can be obtained with {@link features/link#custom-link-attributes-decorators link decorators}: + +```js +ClassicEditor + .create( ..., { + // ... + link: { + decorators: { + addGreenLink: { + mode: 'automatic', + attributes: { + class: 'my-green-link' } } } - } ) - ``` - + } + } ) +``` {@snippet framework/extending-content-allow-link-target} @@ -119,7 +118,7 @@ a[target]::after { ## Loading content with all attributes -In this example `
    ` elements (`
    ...
    `) loaded into the editor content will preserve their attributes. All the DOM attributes will be stored in the editor model as corresponding attributes. +In this example the `
    ` elements (`
    ...
    `) loaded into the editor content will preserve their attributes. All the DOM attributes will be stored in the editor model as corresponding attributes. {@snippet framework/extending-content-allow-div-attributes} @@ -128,10 +127,10 @@ All attributes are allowed on `
    ` elements thanks to custom "upcast" and "do Allowing every possible attribute on a `
    ` element in the model is done by adding an {@link module:engine/model/schema~Schema#addAttributeCheck addAttributeCheck()} callback. - Allowing every attribute on `
    ` elements might introduce security issues — including XSS attacks. The production code should use only application-related attributes and/or properly encode data. + Allowing every attribute on `
    ` elements might introduce security issues — including XSS attacks. The production code should use only application-related attributes and/or properly encode the data. -Adding "upcast" and "downcast" converters for the `
    ` element is enough for cases where its attributes do not change. If the attributes in the model are modified, these `elementToElement()` converters will not be called as the `
    ` is already converted. To overcome this, a lower-level API is used. +Adding "upcast" and "downcast" converters for the `
    ` element is enough for these cases where its attributes do not change. If the attributes in the model are modified, however, these `elementToElement()` converters will not be called as the `
    ` is already converted. To overcome this, a lower-level API is used. Instead of using predefined converters, the {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event-attribute `attribute`} event listener is registered for the "downcast" dispatcher. @@ -150,7 +149,7 @@ function ConvertDivAttributes( editor ) { } } ); - // View-to-model converter converting a view
    with all its attributes to the model. + // The view-to-model converter converting a view
    with all its attributes to the model. editor.conversion.for( 'upcast' ).elementToElement( { view: 'div', model: ( viewElement, modelWriter ) => { @@ -158,13 +157,13 @@ function ConvertDivAttributes( editor ) { } } ); - // Model-to-view converter for the
    element (attributes are converted separately). + // The model-to-view converter for the
    element (attributes are converted separately). editor.conversion.for( 'downcast' ).elementToElement( { model: 'div', view: 'div' } ); - // Model-to-view converter for
    attributes. + // The model-to-view converter for
    attributes. // Note that a lower-level, event-based API is used here. editor.conversion.for( 'downcast' ).add( dispatcher => { dispatcher.on( 'attribute', ( evt, data, conversionApi ) => { @@ -229,8 +228,8 @@ function HandleFontSizeValue( editor ) { value: viewElement => { const value = parseFloat( viewElement.getStyle( 'font-size' ) ).toFixed( 0 ); - // It might be needed to further convert the value to meet business requirements. - // In the sample the font size is configured to handle only the sizes: + // It might be necessary to further convert the value to meet business requirements. + // In the sample the font size is configured to handle only these sizes: // 12, 14, 'default', 18, 20, 22, 24, 26, 28, 30 // Other sizes will be converted to the model but the UI might not be aware of them. @@ -241,7 +240,7 @@ function HandleFontSizeValue( editor ) { converterPriority: 'high' } ); - // Add a special converter for the font size feature to convert all (even not configured) + // Add a special converter for the font size feature to convert all (even the not configured) // model attribute values. editor.conversion.for( 'downcast' ).attributeToElement( { model: { @@ -278,7 +277,7 @@ ClassicEditor ## Adding extra attributes to elements contained in a figure -The {@link features/image Image} and {@link features/table Table} features wrap view elements (`` for Image nad `` for Table) in `
    `. During the downcast conversion, the model element is mapped to `
    ` and not the inner element. In such cases the default `conversion.attributeToAttribute()` conversion helpers could lose information about the element that the attribute should be set on. +The {@link features/image image} and {@link features/table table} features wrap view elements (`` for image and `
    ` for table, respectively) in a `
    ` element. During the downcast conversion, the model element is mapped to `
    ` and not the inner element. In such cases the default `conversion.attributeToAttribute()` conversion helpers could lose information about the element that the attribute should be set on. To overcome this limitation it is sufficient to write a custom converter that adds custom attributes to elements already converted by base features. The key point is to add these converters with a lower priority than the base converters so they will be called after the base ones. @@ -288,11 +287,11 @@ The sample below is extensible. To add your own attributes to preserve, just add ```js /** - * Plugin that converts custom attributes for elements that are wrapped in
    in the view. + * A plugin that converts custom attributes for elements that are wrapped in
    in the view. */ class CustomFigureAttributes { /** - * Plugin's constructor - receives editor instance on creation. + * Plugin's constructor - receives an editor instance on creation. */ constructor( editor ) { // Save reference to the editor. @@ -300,9 +299,9 @@ class CustomFigureAttributes { } /** - * Setups conversion and extends table & image features schema. + * Sets the conversion up and extends the table & image features schema. * - * Schema extending must be done in the “afterInit()” call because plugins define their schema in “init()“. + * Schema extending must be done in the "afterInit()" call because plugins define their schema in "init()". */ afterInit() { const editor = this.editor; @@ -320,23 +319,24 @@ class CustomFigureAttributes { } /** - * Sets up a conversion that preservers classes on and
    elements. + * Sets up a conversion that preserves classes on and
    elements. */ function setupCustomClassConversion( viewElementName, modelElementName, editor ) { - // The 'customClass' attribute will store custom classes from the data in the model so schema definitions allow this attribute. + // The 'customClass' attribute stores custom classes from the data in the model so that schema definitions allow this attribute. editor.model.schema.extend( modelElementName, { allowAttributes: [ 'customClass' ] } ); - // Define upcast converters for the and
    elements with a "low" priority so they are run after the default converters. + // Defines upcast converters for the and
    elements with a "low" priority so they are run after the default converters. editor.conversion.for( 'upcast' ).add( upcastCustomClasses( viewElementName ), { priority: 'low' } ); - // Define downcast converters for a model element with a "low" priority so they are run after the default converters. - // Use `downcastCustomClassesToFigure` if you'd like to keep your classes on
    element or `downcastCustomClassesToChild` if you'd like to keep your classes on a
    child element, i.e. . + // Defines downcast converters for a model element with a "low" priority so they are run after the default converters. + // Use `downcastCustomClassesToFigure` if you want to keep your classes on
    element or `downcastCustomClassesToChild` + // if you would like to keep your classes on a
    child element, i.e. . editor.conversion.for( 'downcast' ).add( downcastCustomClassesToFigure( modelElementName ), { priority: 'low' } ); // editor.conversion.for( 'downcast' ).add( downcastCustomClassesToChild( viewElementName, modelElementName ), { priority: 'low' } ); } /** - * Sets up a conversion for a custom attribute on view elements contained inside a
    . + * Sets up a conversion for a custom attribute on the view elements contained inside a
    . * * This method: * - Adds proper schema rules. @@ -344,7 +344,7 @@ function setupCustomClassConversion( viewElementName, modelElementName, editor ) * - Adds a downcast converter. */ function setupCustomAttributeConversion( viewElementName, modelElementName, viewAttribute, editor ) { - // Extend the schema to store an attribute in the model. + // Extends the schema to store an attribute in the model. const modelAttribute = `custom${ viewAttribute }`; editor.model.schema.extend( modelElementName, { allowAttributes: [ modelAttribute ] } ); diff --git a/packages/ckeditor5-engine/docs/framework/guides/deep-dive/schema.md b/packages/ckeditor5-engine/docs/framework/guides/deep-dive/schema.md index 9854fa07105..9be18b0b72d 100644 --- a/packages/ckeditor5-engine/docs/framework/guides/deep-dive/schema.md +++ b/packages/ckeditor5-engine/docs/framework/guides/deep-dive/schema.md @@ -11,9 +11,9 @@ This article assumes that you have already read the {@link framework/guides/arch The editor's schema is available in the {@link module:engine/model/model~Model#schema `editor.model.schema`} property. It defines allowed model structures (how model elements can be nested), allowed attributes (of both elements and text nodes), and other characteristics (inline vs. block, atomicity in regards of external actions). This information is later used by editing features and the editing engine to decide how to process the model, where to enable features, etc. -Schema rules can be defined by using the {@link module:engine/model/schema~Schema#register `Schema#register()`} or {@link module:engine/model/schema~Schema#extend `Schema#extend()`} methods. The former can be used only once for a given item name which ensures that only a single editing feature can introduce this item. Similarly, `extend()` can only be used for defined items. +Schema rules can be defined by using the {@link module:engine/model/schema~Schema#register `Schema#register()`} or the {@link module:engine/model/schema~Schema#extend `Schema#extend()`} methods. The former can be used only once for a given item name which ensures that only a single editing feature can introduce this item. Similarly, `extend()` can only be used for defined items. -Elements and attributes are checked by features separately by using the {@link module:engine/model/schema~Schema#checkChild `Schema#checkChild()`} and {@link module:engine/model/schema~Schema#checkAttribute `Schema#checkAttribute()`} methods. +Elements and attributes are checked by features separately by using the {@link module:engine/model/schema~Schema#checkChild `Schema#checkChild()`} and the {@link module:engine/model/schema~Schema#checkAttribute `Schema#checkAttribute()`} methods. ## Defining allowed structures @@ -47,7 +47,7 @@ While this would be incorrect: ## Defining additional semantics -In addition to setting allowed structures, the schema can also define additional traits of model elements. By using the `is*` properties, a feature author may declare how a certain element should be treated by other features and the engine. +In addition to setting allowed structures, the schema can also define additional traits of model elements. By using the `is*` properties, a feature author may declare how a certain element should be treated by other features and by the engine. Here is a table listing various model elements and their properties registered in the schema: @@ -292,7 +292,7 @@ The engine and various features then check it via {@link module:engine/model/sch For an image caption like in the example above it does not make much sense to select the caption box, then copy or drag it somewhere else. -A caption without the image that it describes makes little sense. However, the image is more self-sufficient. Most likely users should be able to select the entire image (with all its internals), then copy or move it around. The {@link module:engine/model/schema~SchemaItemDefinition#isObject `isObject`} property should be used to mark such behavior. +A caption without the image it describes makes little sense. The image, however, is more self-sufficient. Most likely users should be able to select the entire image (with all its internals), then copy or move it around. The {@link module:engine/model/schema~SchemaItemDefinition#isObject `isObject`} property should be used to mark such behavior. ```js schema.register( 'myImage', { @@ -324,7 +324,7 @@ It is important to remember that a block should not allow another block inside. In the editor, all HTML formatting elements such as `` or `` are represented by text attributes. Therefore, inline model elements are not supposed to be used for these scenarios. -Currently, the {@link module:engine/model/schema~SchemaItemDefinition#isInline `isInline`} property is used for the `$text` token (so, text nodes) and elements such as `` or placeholder elements such as in the {@link framework/guides/tutorials/implementing-an-inline-widget Implementing an inline widget} tutorial. +Currently, the {@link module:engine/model/schema~SchemaItemDefinition#isInline `isInline`} property is used for the `$text` token (so, text nodes) and elements such as `` or placeholder elements such as described in the {@link framework/guides/tutorials/implementing-an-inline-widget Implementing an inline widget} tutorial. The support for inline elements in CKEditor 5 is so far limited to self-contained elements. Because of this, all elements marked with `isInline` should also be marked with `isObject`. @@ -401,7 +401,7 @@ schema.register( 'paragraph', { } ); ``` -Which can be read as: +And this can be read as: * The `` element will be allowed in elements in which `<$block>` is allowed (e.g. in `<$root>`). * The `` element will allow all nodes that are allowed in `<$block>` (e.g. `$text`). @@ -427,7 +427,7 @@ The side effect of such a definition inheritance is that now `
    ` is a ## Defining advanced rules in `checkChild()` callbacks -The {@link module:engine/model/schema~Schema#checkChild `Schema#checkChild()`} method which is the base method used to check whether some element is allowed in a given structure is {@link module:utils/observablemixin~ObservableMixin#decorate a decorated method}. It means that you can add listeners to implement your specific rules which are not limited by the {@link module:engine/model/schema~SchemaItemDefinition declarative `SchemaItemDefinition` API}. +The {@link module:engine/model/schema~Schema#checkChild `Schema#checkChild()`} method which is the a base method used to check whether some element is allowed in a given structure is {@link module:utils/observablemixin~ObservableMixin#decorate a decorated method}. It means that you can add listeners to implement your specific rules which are not limited by the {@link module:engine/model/schema~SchemaItemDefinition declarative `SchemaItemDefinition` API}. These listeners can be added either by listening directly to the {@link module:engine/model/schema~Schema#event:checkChild} event or by using the handy {@link module:engine/model/schema~Schema#addChildCheck `Schema#addChildCheck()`} method. @@ -485,7 +485,7 @@ While this is a relatively simple scenario (unlike most real-time collaborative Therefore, if your editor needs to implement such rules, you should do that through {@link module:engine/model/document~Document#registerPostFixer model's post-fixers} fixing incorrect content or actively prevent such situations (e.g. by disabling certain features). It means that these constraints will be defined specifically for your scenario by your code which makes their implementation much easier. -To sum up, the answer to who and how should implement additional constraints is: Your features or your editor through the CKEditor 5 API. +To sum up, the answer to who and how should implement additional constraints is: your features or your editor through the CKEditor 5 API. ## Who checks the schema? diff --git a/packages/ckeditor5-engine/src/controller/datacontroller.js b/packages/ckeditor5-engine/src/controller/datacontroller.js index e779e3da0c6..8f536d88c21 100644 --- a/packages/ckeditor5-engine/src/controller/datacontroller.js +++ b/packages/ckeditor5-engine/src/controller/datacontroller.js @@ -24,6 +24,7 @@ import ViewDocument from '../view/document'; import ViewDowncastWriter from '../view/downcastwriter'; import ModelRange from '../model/range'; +import { autoParagraphEmptyRoots } from '../model/utils/autoparagraphing'; /** * Controller for the data pipeline. The data pipeline controls how data is retrieved from the document @@ -140,21 +141,28 @@ export default class DataController { this.on( 'init', () => { this.fire( 'ready' ); }, { priority: 'lowest' } ); + + // Fix empty roots after DataController is 'ready' (note that init method could be decorated and stopped). + // We need to handle this event because initial data could be empty and post-fixer would not get triggered. + this.on( 'ready', () => { + this.model.enqueueChange( 'transparent', autoParagraphEmptyRoots ); + }, { priority: 'lowest' } ); } /** * Returns the model's data converted by downcast dispatchers attached to {@link #downcastDispatcher} and * formatted by the {@link #processor data processor}. * - * @param {Object} [options] + * @param {Object} [options] Additional configuration for the retrieved data. `DataController` provides two optional + * properties: `rootName` and `trim`. Other properties of this object are specified by various editor features. * @param {String} [options.rootName='main'] Root name. * @param {String} [options.trim='empty'] Whether returned data should be trimmed. This option is set to `empty` by default, * which means whenever editor content is considered empty, an empty string will be returned. To turn off trimming completely * use `'none'`. In such cases exact content will be returned (for example `

     

    ` for an empty editor). * @returns {String} Output data. */ - get( options ) { - const { rootName = 'main', trim = 'empty' } = options || {}; + get( options = {} ) { + const { rootName = 'main', trim = 'empty' } = options; if ( !this._checkIfRootsExists( [ rootName ] ) ) { /** @@ -177,7 +185,7 @@ export default class DataController { return ''; } - return this.stringify( root ); + return this.stringify( root, options ); } /** @@ -187,11 +195,12 @@ export default class DataController { * * @param {module:engine/model/element~Element|module:engine/model/documentfragment~DocumentFragment} modelElementOrFragment * Element whose content will be stringified. + * @param {Object} [options] Additional configuration passed to the conversion process. * @returns {String} Output data. */ - stringify( modelElementOrFragment ) { + stringify( modelElementOrFragment, options ) { // Model -> view. - const viewDocumentFragment = this.toView( modelElementOrFragment ); + const viewDocumentFragment = this.toView( modelElementOrFragment, options ); // View -> data. return this.processor.toData( viewDocumentFragment ); @@ -205,9 +214,11 @@ export default class DataController { * * @param {module:engine/model/element~Element|module:engine/model/documentfragment~DocumentFragment} modelElementOrFragment * Element or document fragment whose content will be converted. + * @param {Object} [options] Additional configuration that will be available through + * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi#options} during the conversion process. * @returns {module:engine/view/documentfragment~DocumentFragment} Output view DocumentFragment. */ - toView( modelElementOrFragment ) { + toView( modelElementOrFragment, options ) { const viewDocument = this.viewDocument; const viewWriter = this._viewWriter; @@ -220,6 +231,9 @@ export default class DataController { this.mapper.bindElements( modelElementOrFragment, viewDocumentFragment ); + // Make additional options available during conversion process through `conversionApi`. + this.downcastDispatcher.conversionApi.options = options; + // We have no view controller and rendering to DOM in DataController so view.change() block is not used here. this.downcastDispatcher.convertInsert( modelRange, viewWriter ); @@ -233,6 +247,9 @@ export default class DataController { } } + // Clean `conversionApi`. + delete this.downcastDispatcher.conversionApi.options; + return viewDocumentFragment; } diff --git a/packages/ckeditor5-engine/src/conversion/downcastdispatcher.js b/packages/ckeditor5-engine/src/conversion/downcastdispatcher.js index aa2ab403506..1fdc18a22f4 100644 --- a/packages/ckeditor5-engine/src/conversion/downcastdispatcher.js +++ b/packages/ckeditor5-engine/src/conversion/downcastdispatcher.js @@ -11,7 +11,6 @@ import Consumable from './modelconsumable'; import Range from '../model/range'; import EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin'; import mix from '@ckeditor/ckeditor5-utils/src/mix'; -import { extend } from 'lodash-es'; /** * Downcast dispatcher is a central point of downcasting (conversion from the model to the view), which is a process of reacting to changes @@ -115,7 +114,7 @@ export default class DowncastDispatcher { * * @member {module:engine/conversion/downcastdispatcher~DowncastConversionApi} */ - this.conversionApi = extend( { dispatcher: this }, conversionApi ); + this.conversionApi = Object.assign( { dispatcher: this }, conversionApi ); } /** @@ -669,3 +668,9 @@ function shouldMarkerChangeBeConverted( modelPosition, marker, mapper ) { * * @member {module:engine/view/downcastwriter~DowncastWriter} #writer */ + +/** + * An object with an additional configuration which can be used during conversion process. Available only for data downcast conversion. + * + * @member {Object} #options + */ diff --git a/packages/ckeditor5-engine/src/conversion/downcasthelpers.js b/packages/ckeditor5-engine/src/conversion/downcasthelpers.js index 59fabb004b7..20a75fd6f56 100644 --- a/packages/ckeditor5-engine/src/conversion/downcasthelpers.js +++ b/packages/ckeditor5-engine/src/conversion/downcasthelpers.js @@ -52,8 +52,10 @@ export default class DowncastHelpers extends ConversionHelpers { * * editor.conversion.for( 'downcast' ).elementToElement( { * model: 'heading', - * view: ( modelElement, viewWriter ) => { - * return viewWriter.createContainerElement( 'h' + modelElement.getAttribute( 'level' ) ) + * view: ( modelElement, conversionApi ) => { + * const { writer } = conversionApi; + * + * return writer.createContainerElement( 'h' + modelElement.getAttribute( 'level' ) ); * } * } ); * @@ -64,7 +66,7 @@ export default class DowncastHelpers extends ConversionHelpers { * @param {Object} config Conversion configuration. * @param {String} config.model The name of the model element to convert. * @param {module:engine/view/elementdefinition~ElementDefinition|Function} config.view A view element definition or a function - * that takes the model element and {@link module:engine/view/downcastwriter~DowncastWriter view downcast writer} + * that takes the model element and {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} * as parameters and returns a view container element. * @returns {module:engine/conversion/downcasthelpers~DowncastHelpers} */ @@ -120,8 +122,10 @@ export default class DowncastHelpers extends ConversionHelpers { * * editor.conversion.for( 'downcast' ).attributeToElement( { * model: 'bold', - * view: ( modelAttributeValue, viewWriter ) => { - * return viewWriter.createAttributeElement( 'span', { + * view: ( modelAttributeValue, conversionApi ) => { + * const { writer } = conversionApi; + * + * return writer.createAttributeElement( 'span', { * style: 'font-weight:' + modelAttributeValue * } ); * } @@ -132,8 +136,10 @@ export default class DowncastHelpers extends ConversionHelpers { * key: 'color', * name: '$text' * }, - * view: ( modelAttributeValue, viewWriter ) => { - * return viewWriter.createAttributeElement( 'span', { + * view: ( modelAttributeValue, conversionApi ) => { + * const { writer } = conversionApi; + * + * return writer.createAttributeElement( 'span', { * style: 'color:' + modelAttributeValue * } ); * } @@ -147,9 +153,10 @@ export default class DowncastHelpers extends ConversionHelpers { * @param {String|Object} config.model The key of the attribute to convert from or a `{ key, values }` object. `values` is an array * of `String`s with possible values if the model attribute is an enumerable. * @param {module:engine/view/elementdefinition~ElementDefinition|Function|Object} config.view A view element definition or a function - * that takes the model attribute value and {@link module:engine/view/downcastwriter~DowncastWriter view downcast writer} - * as parameters and returns a view attribute element. If `config.model.values` is - * given, `config.view` should be an object assigning values from `config.model.values` to view element definitions or functions. + * that takes the model attribute value and + * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} as parameters and returns a view + * attribute element. If `config.model.values` is given, `config.view` should be an object assigning values from `config.model.values` + * to view element definitions or functions. * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority. * @returns {module:engine/conversion/downcasthelpers~DowncastHelpers} */ @@ -201,7 +208,10 @@ export default class DowncastHelpers extends ConversionHelpers { * * editor.conversion.for( 'downcast' ).attributeToAttribute( { * model: 'styled', - * view: modelAttributeValue => ( { key: 'class', value: 'styled-' + modelAttributeValue } ) + * view: modelAttributeValue => ( { + * key: 'class', + * value: 'styled-' + modelAttributeValue + * } ) * } ); * * **Note**: Downcasting to a style property requires providing `value` as an object: @@ -225,7 +235,8 @@ export default class DowncastHelpers extends ConversionHelpers { * @param {String|Object} config.model The key of the attribute to convert from or a `{ key, values, [ name ] }` object describing * the attribute key, possible values and, optionally, an element name to convert from. * @param {String|Object|Function} config.view A view attribute key, or a `{ key, value }` object or a function that takes - * the model attribute value and returns a `{ key, value }` object. If `key` is `'class'`, `value` can be a `String` or an + * the model attribute value and {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} + * as parameters and returns a `{ key, value }` object. If `key` is `'class'`, `value` can be a `String` or an * array of `String`s. If `key` is `'style'`, `value` is an object with key-value pairs. In other cases, `value` is a `String`. * If `config.model.values` is set, `config.view` should be an object assigning values from `config.model.values` to * `{ key, value }` objects or a functions. @@ -269,8 +280,10 @@ export default class DowncastHelpers extends ConversionHelpers { * * editor.conversion.for( 'editingDowncast' ).markerToElement( { * model: 'search', - * view: ( markerData, viewWriter ) => { - * return viewWriter.createUIElement( 'span', { + * view: ( markerData, conversionApi ) => { + * const { writer } = conversionApi; + * + * return writer.createUIElement( 'span', { * 'data-marker': 'search', * 'data-start': markerData.isOpening * } ); @@ -278,7 +291,8 @@ export default class DowncastHelpers extends ConversionHelpers { * } ); * * If a function is passed as the `config.view` parameter, it will be used to generate both boundary elements. The function - * receives the `data` object as a parameter and should return an instance of the + * receives the `data` object and {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} + * as a parameters and should return an instance of the * {@link module:engine/view/uielement~UIElement view UI element}. The `data` object and * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi `conversionApi`} are passed from * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:addMarker}. Additionally, @@ -291,8 +305,9 @@ export default class DowncastHelpers extends ConversionHelpers { * @method #markerToElement * @param {Object} config Conversion configuration. * @param {String} config.model The name of the model marker (or model marker group) to convert. - * @param {module:engine/view/elementdefinition~ElementDefinition|Function} config.view A view element definition or a function - * that takes the model marker data as a parameter and returns a view UI element. + * @param {module:engine/view/elementdefinition~ElementDefinition|Function} config.view A view element definition or a function that + * takes the model marker data and {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} + * as a parameters and returns a view UI element. * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority. * @returns {module:engine/conversion/downcasthelpers~DowncastHelpers} */ @@ -329,7 +344,7 @@ export default class DowncastHelpers extends ConversionHelpers { * * editor.conversion.for( 'downcast' ).markerToHighlight( { * model: 'comment', - * view: data => { + * view: ( data, converstionApi ) => { * // Assuming that the marker name is in a form of comment:commentType. * const commentType = data.markerName.split( ':' )[ 1 ]; * @@ -340,7 +355,8 @@ export default class DowncastHelpers extends ConversionHelpers { * } ); * * If a function is passed as the `config.view` parameter, it will be used to generate the highlight descriptor. The function - * receives the `data` object as a parameter and should return a + * receives the `data` object and {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} + * as a parameters and should return a * {@link module:engine/conversion/downcasthelpers~HighlightDescriptor highlight descriptor}. * The `data` object properties are passed from {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:addMarker}. * @@ -351,7 +367,9 @@ export default class DowncastHelpers extends ConversionHelpers { * @param {Object} config Conversion configuration. * @param {String} config.model The name of the model marker (or model marker group) to convert. * @param {module:engine/conversion/downcasthelpers~HighlightDescriptor|Function} config.view A highlight descriptor - * that will be used for highlighting or a function that takes the model marker data as a parameter and returns a highlight descriptor. + * that will be used for highlighting or a function that takes the model marker data and + * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} as a parameters + * and returns a highlight descriptor. * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority. * @returns {module:engine/conversion/downcasthelpers~DowncastHelpers} */ @@ -464,8 +482,9 @@ export default class DowncastHelpers extends ConversionHelpers { * @method #markerToData * @param {Object} config Conversion configuration. * @param {String} config.model The name of the model marker (or model marker group) to convert. - * @param {Function} [config.view] A function that takes the model marker name as a parameter and returns an object with the `group` - * and `name` properties. + * @param {Function} [config.view] A function that takes the model marker name and + * {@link module:engine/conversion/downcastdispatcher~DowncastConversionApi downcast conversion API} as a parameters + * and returns an object with the `group` and `name` properties. * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority. * @returns {module:engine/conversion/downcasthelpers~DowncastHelpers} */ @@ -703,10 +722,10 @@ export function wrap( elementCreator ) { return ( evt, data, conversionApi ) => { // Recreate current wrapping node. It will be used to unwrap view range if the attribute value has changed // or the attribute was removed. - const oldViewElement = elementCreator( data.attributeOldValue, conversionApi.writer ); + const oldViewElement = elementCreator( data.attributeOldValue, conversionApi ); // Create node to wrap with. - const newViewElement = elementCreator( data.attributeNewValue, conversionApi.writer ); + const newViewElement = elementCreator( data.attributeNewValue, conversionApi ); if ( !oldViewElement && !newViewElement ) { return; @@ -766,7 +785,7 @@ export function wrap( elementCreator ) { */ export function insertElement( elementCreator ) { return ( evt, data, conversionApi ) => { - const viewElement = elementCreator( data.item, conversionApi.writer ); + const viewElement = elementCreator( data.item, conversionApi ); if ( !viewElement ) { return; @@ -803,10 +822,10 @@ export function insertUIElement( elementCreator ) { // Create two view elements. One will be inserted at the beginning of marker, one at the end. // If marker is collapsed, only "opening" element will be inserted. data.isOpening = true; - const viewStartElement = elementCreator( data, conversionApi.writer ); + const viewStartElement = elementCreator( data, conversionApi ); data.isOpening = false; - const viewEndElement = elementCreator( data, conversionApi.writer ); + const viewEndElement = elementCreator( data, conversionApi ); if ( !viewStartElement || !viewEndElement ) { return; @@ -880,7 +899,7 @@ function removeUIElement() { // @returns {Function} Add marker converter. function insertMarkerData( viewCreator ) { return ( evt, data, conversionApi ) => { - const viewMarkerData = viewCreator( data.markerName ); + const viewMarkerData = viewCreator( data.markerName, conversionApi ); if ( !viewMarkerData ) { return; @@ -961,7 +980,7 @@ function insertMarkerAsElement( position, isStart, conversionApi, data, viewMark // @returns {Function} Remove marker converter. function removeMarkerData( viewCreator ) { return ( evt, data, conversionApi ) => { - const viewData = viewCreator( data.markerName ); + const viewData = viewCreator( data.markerName, conversionApi ); if ( !viewData ) { return; @@ -1036,8 +1055,8 @@ function removeMarkerData( viewCreator ) { // @returns {Function} Set/change attribute converter. function changeAttribute( attributeCreator ) { return ( evt, data, conversionApi ) => { - const oldAttribute = attributeCreator( data.attributeOldValue, data ); - const newAttribute = attributeCreator( data.attributeNewValue, data ); + const oldAttribute = attributeCreator( data.attributeOldValue, conversionApi ); + const newAttribute = attributeCreator( data.attributeNewValue, conversionApi ); if ( !oldAttribute && !newAttribute ) { return; @@ -1487,7 +1506,7 @@ function normalizeToElementConfig( view, viewElementType ) { return view; } - return ( modelData, viewWriter ) => createViewElementFromDefinition( view, viewWriter, viewElementType ); + return ( modelData, conversionApi ) => createViewElementFromDefinition( view, conversionApi, viewElementType ); } // Creates a view element instance from the provided {@link module:engine/view/elementdefinition~ElementDefinition} and class. @@ -1496,13 +1515,14 @@ function normalizeToElementConfig( view, viewElementType ) { // @param {module:engine/view/downcastwriter~DowncastWriter} viewWriter // @param {'container'|'attribute'|'ui'} viewElementType // @returns {module:engine/view/element~Element} -function createViewElementFromDefinition( viewElementDefinition, viewWriter, viewElementType ) { +function createViewElementFromDefinition( viewElementDefinition, conversionApi, viewElementType ) { if ( typeof viewElementDefinition == 'string' ) { // If `viewElementDefinition` is given as a `String`, normalize it to an object with `name` property. viewElementDefinition = { name: viewElementDefinition }; } let element; + const viewWriter = conversionApi.writer; const attributes = Object.assign( {}, viewElementDefinition.attributes ); if ( viewElementType == 'container' ) { @@ -1543,11 +1563,11 @@ function createViewElementFromDefinition( viewElementDefinition, viewWriter, vie function getFromAttributeCreator( config ) { if ( config.model.values ) { - return ( modelAttributeValue, viewWriter ) => { + return ( modelAttributeValue, conversionApi ) => { const view = config.view[ modelAttributeValue ]; if ( view ) { - return view( modelAttributeValue, viewWriter ); + return view( modelAttributeValue, conversionApi ); } return null; diff --git a/packages/ckeditor5-engine/src/conversion/upcastdispatcher.js b/packages/ckeditor5-engine/src/conversion/upcastdispatcher.js index 76ced552ea1..82f1ccacf4b 100644 --- a/packages/ckeditor5-engine/src/conversion/upcastdispatcher.js +++ b/packages/ckeditor5-engine/src/conversion/upcastdispatcher.js @@ -11,6 +11,7 @@ import ViewConsumable from './viewconsumable'; import ModelRange from '../model/range'; import ModelPosition from '../model/position'; import { SchemaContext } from '../model/schema'; +import { isParagraphable, wrapInParagraph } from '../model/utils/autoparagraphing'; import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; import EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin'; @@ -349,22 +350,32 @@ export default class UpcastDispatcher { * @see module:engine/conversion/upcastdispatcher~UpcastConversionApi#splitToAllowedParent */ _splitToAllowedParent( node, modelCursor ) { + const { schema, writer } = this.conversionApi; + // Try to find allowed parent. - const allowedParent = this.conversionApi.schema.findAllowedParent( modelCursor, node ); + let allowedParent = schema.findAllowedParent( modelCursor, node ); - // When there is no parent that allows to insert node then return `null`. - if ( !allowedParent ) { - return null; - } + if ( allowedParent ) { + // When current position parent allows to insert node then return this position. + if ( allowedParent === modelCursor.parent ) { + return { position: modelCursor }; + } - // When current position parent allows to insert node then return this position. - if ( allowedParent === modelCursor.parent ) { - return { position: modelCursor }; + // When allowed parent is in context tree (it's outside the converted tree). + if ( this._modelCursor.parent.getAncestors().includes( allowedParent ) ) { + allowedParent = null; + } } - // When allowed parent is in context tree. - if ( this._modelCursor.parent.getAncestors().includes( allowedParent ) ) { - return null; + if ( !allowedParent ) { + // Check if the node wrapped with a paragraph would be accepted by the schema. + if ( !isParagraphable( modelCursor, node, schema ) ) { + return null; + } + + return { + position: wrapInParagraph( modelCursor, writer ) + }; } // Split element to allowed parent. diff --git a/packages/ckeditor5-engine/src/conversion/upcasthelpers.js b/packages/ckeditor5-engine/src/conversion/upcasthelpers.js index 95ccde9c6c8..656b142e47e 100644 --- a/packages/ckeditor5-engine/src/conversion/upcasthelpers.js +++ b/packages/ckeditor5-engine/src/conversion/upcasthelpers.js @@ -10,6 +10,7 @@ import { cloneDeep } from 'lodash-es'; import { attachLinkToDocumentation } from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; import priorities from '@ckeditor/ckeditor5-utils/src/priorities'; +import { isParagraphable, wrapInParagraph } from '../model/utils/autoparagraphing'; /* global console */ @@ -59,7 +60,9 @@ export default class UpcastHelpers extends ConversionHelpers { * name: 'p', * classes: 'heading' * }, - * model: ( viewElement, modelWriter ) => { + * model: ( viewElement, conversionApi ) => { + * const modelWriter = conversionApi.writer; + * * return modelWriter.createElement( 'heading', { level: viewElement.getAttribute( 'data-level' ) } ); * } * } ); @@ -71,8 +74,9 @@ export default class UpcastHelpers extends ConversionHelpers { * @param {Object} config Conversion configuration. * @param {module:engine/view/matcher~MatcherPattern} [config.view] Pattern matching all view elements which should be converted. If not * set, the converter will fire for every view element. - * @param {String|module:engine/model/element~Element|Function} config.model Name of the model element, a model element - * instance or a function that takes a view element and returns a model element. The model element will be inserted in the model. + * @param {String|module:engine/model/element~Element|Function} config.model Name of the model element, a model element instance or a + * function that takes a view element and {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} + * and returns a model element. The model element will be inserted in the model. * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority. * @returns {module:engine/conversion/upcasthelpers~UpcastHelpers} */ @@ -135,7 +139,7 @@ export default class UpcastHelpers extends ConversionHelpers { * }, * model: { * key: 'fontSize', - * value: viewElement => { + * value: ( viewElement, conversionApi ) => { * const fontSize = viewElement.getStyle( 'font-size' ); * const value = fontSize.substr( 0, fontSize.length - 2 ); * @@ -157,7 +161,8 @@ export default class UpcastHelpers extends ConversionHelpers { * @param {Object} config Conversion configuration. * @param {module:engine/view/matcher~MatcherPattern} config.view Pattern matching all view elements which should be converted. * @param {String|Object} config.model Model attribute key or an object with `key` and `value` properties, describing - * the model attribute. `value` property may be set as a function that takes a view element and returns the value. + * the model attribute. `value` property may be set as a function that takes a view element and + * {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} and returns the value. * If `String` is given, the model attribute value will be set to `true`. * @param {module:utils/priorities~PriorityString} [config.converterPriority='low'] Converter priority. * @returns {module:engine/conversion/upcasthelpers~UpcastHelpers} @@ -231,7 +236,7 @@ export default class UpcastHelpers extends ConversionHelpers { * }, * model: { * key: 'styled' - * value: viewElement => { + * value: ( viewElement, conversionApi ) => { * const regexp = /styled-([\S]+)/; * const match = viewElement.getAttribute( 'class' ).match( regexp ); * @@ -263,7 +268,7 @@ export default class UpcastHelpers extends ConversionHelpers { * }, * model: { * key: 'lineHeight', - * value: viewElement => viewElement.getStyle( 'line-height' ) + * value: ( viewElement, conversionApi ) => viewElement.getStyle( 'line-height' ) * } * } ); * @@ -278,7 +283,8 @@ export default class UpcastHelpers extends ConversionHelpers { * property specifying a view element name from/on which the attribute should be converted. `value` can be given as a `String`, * a `RegExp` or a function callback, that takes view attribute value as the only parameter and returns `Boolean`. * @param {String|Object} config.model Model attribute key or an object with `key` and `value` properties, describing - * the model attribute. `value` property may be set as a function that takes a view element and returns the value. + * the model attribute. `value` property may be set as a function that takes a view element and + * {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} and returns the value. * If `String` is given, the model attribute value will be same as view attribute value. * @param {module:utils/priorities~PriorityString} [config.converterPriority='low'] Converter priority. * @returns {module:engine/conversion/upcasthelpers~UpcastHelpers} @@ -310,7 +316,7 @@ export default class UpcastHelpers extends ConversionHelpers { * * editor.conversion.for( 'upcast' ).elementToMarker( { * view: 'marker-search', - * model: viewElement => 'comment:' + viewElement.getAttribute( 'data-comment-id' ) + * model: ( viewElement, conversionApi ) => 'comment:' + viewElement.getAttribute( 'data-comment-id' ) * } ); * * editor.conversion.for( 'upcast' ).elementToMarker( { @@ -400,13 +406,13 @@ export default class UpcastHelpers extends ConversionHelpers { * // Using a custom function which is the same as the default conversion: * editor.conversion.for( 'upcast' ).dataToMarker( { * view: 'comment', - * model: name => 'comment:' + name, + * model: ( name, conversionApi ) => 'comment:' + name, * } ); * * // Using the converter priority: * editor.conversion.for( 'upcast' ).dataToMarker( { * view: 'comment', - * model: name => 'comment:' + name, + * model: ( name, conversionApi ) => 'comment:' + name, * converterPriority: 'high' * } ); * @@ -416,8 +422,8 @@ export default class UpcastHelpers extends ConversionHelpers { * @method #dataToMarker * @param {Object} config Conversion configuration. * @param {String} config.view The marker group name to convert. - * @param {Function} [config.model] A function that takes the `name` part from the view element or attribute and returns the marker - * name. + * @param {Function} [config.model] A function that takes the `name` part from the view element or attribute and + * {@link module:engine/conversion/upcastdispatcher~UpcastConversionApi upcast conversion API} and returns the marker name. * @param {module:utils/priorities~PriorityString} [config.converterPriority='normal'] Converter priority. * @returns {module:engine/conversion/upcasthelpers~UpcastHelpers} */ @@ -459,20 +465,33 @@ export function convertToModelFragment() { * @returns {Function} {@link module:engine/view/text~Text View text} converter. */ export function convertText() { - return ( evt, data, conversionApi ) => { - if ( conversionApi.schema.checkChild( data.modelCursor, '$text' ) ) { - if ( conversionApi.consumable.consume( data.viewItem ) ) { - const text = conversionApi.writer.createText( data.viewItem.data ); + return ( evt, data, { schema, consumable, writer } ) => { + let position = data.modelCursor; - conversionApi.writer.insert( text, data.modelCursor ); + // When node is already converted then do nothing. + if ( !consumable.test( data.viewItem ) ) { + return; + } - data.modelRange = conversionApi.writer.createRange( - data.modelCursor, - data.modelCursor.getShiftedBy( text.offsetSize ) - ); - data.modelCursor = data.modelRange.end; + if ( !schema.checkChild( position, '$text' ) ) { + if ( !isParagraphable( position, '$text', schema ) ) { + return; } + + position = wrapInParagraph( position, writer ); } + + consumable.consume( data.viewItem ); + + const text = writer.createText( data.viewItem.data ); + + writer.insert( text, position ); + + data.modelRange = writer.createRange( + position, + position.getShiftedBy( text.offsetSize ) + ); + data.modelCursor = data.modelRange.end; }; } @@ -697,7 +716,7 @@ function upcastAttributeToMarker( config ) { function addMarkerElements( position, markerViewNames ) { for ( const markerViewName of markerViewNames ) { - const markerName = config.model( markerViewName ); + const markerName = config.model( markerViewName, conversionApi ); const element = conversionApi.writer.createElement( '$marker', { 'data-name': markerName } ); conversionApi.writer.insert( element, position ); @@ -754,7 +773,7 @@ function prepareToElementConverter( config ) { return; } - const modelElement = getModelElement( config.model, data.viewItem, conversionApi.writer ); + const modelElement = getModelElement( config.model, data.viewItem, conversionApi ); if ( !modelElement ) { return; @@ -775,12 +794,12 @@ function prepareToElementConverter( config ) { // // @param {String|Function|module:engine/model/element~Element} model Model conversion configuration. // @param {module:engine/view/node~Node} input The converted view node. -// @param {module:engine/model/writer~Writer} writer A writer instance to use to create the model element. -function getModelElement( model, input, writer ) { +// @param {module:engine/conversion/upcastdispatcher~UpcastConversionApi} conversionApi The upcast conversion API. +function getModelElement( model, input, conversionApi ) { if ( model instanceof Function ) { - return model( input, writer ); + return model( input, conversionApi ); } else { - return writer.createElement( model ); + return conversionApi.writer.createElement( model ); } } @@ -858,7 +877,8 @@ function prepareToAttributeConverter( config, shallow ) { } const modelKey = config.model.key; - const modelValue = typeof config.model.value == 'function' ? config.model.value( data.viewItem ) : config.model.value; + const modelValue = typeof config.model.value == 'function' ? + config.model.value( data.viewItem, conversionApi ) : config.model.value; // Do not convert if attribute building function returned falsy value. if ( modelValue === null ) { @@ -939,10 +959,10 @@ function setAttributeOn( modelRange, modelAttribute, shallow, conversionApi ) { function normalizeElementToMarkerConfig( config ) { const oldModel = config.model; - config.model = ( viewElement, modelWriter ) => { - const markerName = typeof oldModel == 'string' ? oldModel : oldModel( viewElement ); + config.model = ( viewElement, conversionApi ) => { + const markerName = typeof oldModel == 'string' ? oldModel : oldModel( viewElement, conversionApi ); - return modelWriter.createElement( '$marker', { 'data-name': markerName } ); + return conversionApi.writer.createElement( '$marker', { 'data-name': markerName } ); }; } @@ -956,11 +976,11 @@ function normalizeDataToMarkerConfig( config, type ) { // Upcast and elements. configForElements.view = config.view + '-' + type; - configForElements.model = ( viewElement, modelWriter ) => { + configForElements.model = ( viewElement, conversionApi ) => { const viewName = viewElement.getAttribute( 'name' ); - const markerName = config.model( viewName ); + const markerName = config.model( viewName, conversionApi ); - return modelWriter.createElement( '$marker', { 'data-name': markerName } ); + return conversionApi.writer.createElement( '$marker', { 'data-name': markerName } ); }; return configForElements; diff --git a/packages/ckeditor5-engine/src/dev-utils/model.js b/packages/ckeditor5-engine/src/dev-utils/model.js index 57e497e6978..57cde34a686 100644 --- a/packages/ckeditor5-engine/src/dev-utils/model.js +++ b/packages/ckeditor5-engine/src/dev-utils/model.js @@ -229,8 +229,8 @@ export function stringify( node, selectionOrPositionOrRange = null, markers = nu downcastDispatcher.on( 'insert:$text', insertText() ); downcastDispatcher.on( 'attribute', ( evt, data, conversionApi ) => { if ( data.item instanceof ModelSelection || data.item instanceof DocumentSelection || data.item.is( '$textProxy' ) ) { - const converter = wrap( ( modelAttributeValue, viewWriter ) => { - return viewWriter.createAttributeElement( + const converter = wrap( ( modelAttributeValue, { writer } ) => { + return writer.createAttributeElement( 'model-text-with-attributes', { [ data.attributeKey ]: stringifyAttributeValue( modelAttributeValue ) } ); @@ -248,7 +248,7 @@ export function stringify( node, selectionOrPositionOrRange = null, markers = nu downcastDispatcher.on( 'selection', convertRangeSelection() ); downcastDispatcher.on( 'selection', convertCollapsedSelection() ); - downcastDispatcher.on( 'addMarker', insertUIElement( ( data, writer ) => { + downcastDispatcher.on( 'addMarker', insertUIElement( ( data, { writer } ) => { const name = data.markerName + ':' + ( data.isOpening ? 'start' : 'end' ); return writer.createUIElement( name ); diff --git a/packages/ckeditor5-engine/src/dev-utils/view.js b/packages/ckeditor5-engine/src/dev-utils/view.js index 82e8ded214a..2937fbcf70f 100644 --- a/packages/ckeditor5-engine/src/dev-utils/view.js +++ b/packages/ckeditor5-engine/src/dev-utils/view.js @@ -51,9 +51,9 @@ const allowedTypes = { * the default `main` name will be used. * @param {Boolean} [options.showType=false] When set to `true`, the type of elements will be printed (`` * instead of `

    `, `` instead of `` and `` instead of ``). - * @param {Boolean} [options.showPriority=false] When set to `true`, attribute element's priority will be printed + * @param {Boolean} [options.showPriority=false] When set to `true`, the attribute element's priority will be printed * (``, ``). - * @param {Boolean} [options.showAttributeElementId=false] When set to `true`, attribute element's id will be printed + * @param {Boolean} [options.showAttributeElementId=false] When set to `true`, the attribute element's ID will be printed * (``). * @param {Boolean} [options.renderUIElements=false] When set to `true`, the inner content of each * {@link module:engine/view/uielement~UIElement} will be printed. diff --git a/packages/ckeditor5-engine/src/model/model.js b/packages/ckeditor5-engine/src/model/model.js index c8a0e9850ab..bbb93457114 100644 --- a/packages/ckeditor5-engine/src/model/model.js +++ b/packages/ckeditor5-engine/src/model/model.js @@ -25,6 +25,7 @@ import deleteContent from './utils/deletecontent'; import modifySelection from './utils/modifyselection'; import getSelectedContent from './utils/getselectedcontent'; import { injectSelectionPostFixer } from './utils/selection-post-fixer'; +import { autoParagraphEmptyRoots } from './utils/autoparagraphing'; import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; // @if CK_DEBUG_ENGINE // const { dumpTrees } = require( '../dev-utils/utils' ); @@ -122,6 +123,9 @@ export default class Model { injectSelectionPostFixer( this ); + // Post-fixer which takes care of adding empty paragraph elements to the empty roots. + this.document.registerPostFixer( autoParagraphEmptyRoots ); + // @if CK_DEBUG_ENGINE // this.on( 'applyOperation', () => { // @if CK_DEBUG_ENGINE // dumpTrees( this.document, this.document.version ); // @if CK_DEBUG_ENGINE // }, { priority: 'lowest' } ); diff --git a/packages/ckeditor5-engine/src/model/utils/autoparagraphing.js b/packages/ckeditor5-engine/src/model/utils/autoparagraphing.js new file mode 100644 index 00000000000..c058b675247 --- /dev/null +++ b/packages/ckeditor5-engine/src/model/utils/autoparagraphing.js @@ -0,0 +1,77 @@ +/** + * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license + */ + +/** + * @module engine/model/utils/autoparagraphing + */ + +/** + * Fixes all empty roots. + * + * @protected + * @param {module:engine/model/writer~Writer} writer The model writer. + * @returns {Boolean} `true` if any change has been applied, `false` otherwise. + */ +export function autoParagraphEmptyRoots( writer ) { + const { schema, document } = writer.model; + + for ( const rootName of document.getRootNames() ) { + const root = document.getRoot( rootName ); + + if ( root.isEmpty && !schema.checkChild( root, '$text' ) ) { + // If paragraph element is allowed in the root, create paragraph element. + if ( schema.checkChild( root, 'paragraph' ) ) { + writer.insertElement( 'paragraph', root ); + + // Other roots will get fixed in the next post-fixer round. Those will be triggered + // in the same batch no matter if this method was triggered by the post-fixing or not + // (the above insertElement call will trigger the post-fixers). + return true; + } + } + } + + return false; +} + +/** + * Checks if the given node wrapped with a paragraph would be accepted by the schema in the given position. + * + * @protected + * @param {module:engine/model/position~Position} position The position at which to check. + * @param {module:engine/model/node~Node|String} nodeOrType The child node or child type to check. + * @param {module:engine/model/schema~Schema} schema A schema instance used for element validation. + */ +export function isParagraphable( position, nodeOrType, schema ) { + const context = schema.createContext( position ); + + // When paragraph is allowed in this context... + if ( !schema.checkChild( context, 'paragraph' ) ) { + return false; + } + + // And a node would be allowed in this paragraph... + if ( !schema.checkChild( context.push( 'paragraph' ), nodeOrType ) ) { + return false; + } + + return true; +} + +/** + * Inserts a new paragraph at the given position and returns a position inside that paragraph. + * + * @protected + * @param {module:engine/model/position~Position} position The position where a paragraph should be inserted. + * @param {module:engine/model/writer~Writer} writer The model writer. + * @returns {module:engine/model/position~Position} Position inside the created paragraph. + */ +export function wrapInParagraph( position, writer ) { + const paragraph = writer.createElement( 'paragraph' ); + + writer.insert( paragraph, position ); + + return writer.createPositionAt( paragraph, 0 ); +} diff --git a/packages/ckeditor5-engine/src/view/domconverter.js b/packages/ckeditor5-engine/src/view/domconverter.js index 4beac20d1ac..f3d8beab359 100644 --- a/packages/ckeditor5-engine/src/view/domconverter.js +++ b/packages/ckeditor5-engine/src/view/domconverter.js @@ -32,20 +32,21 @@ const BR_FILLER_REF = BR_FILLER( document ); * `DomConverter` is a set of tools to do transformations between DOM nodes and view nodes. It also handles * {@link module:engine/view/domconverter~DomConverter#bindElements bindings} between these nodes. * - * The instance of `DOMConverter` is available under {@link module:engine/view/view~View#domConverter `editor.editing.view.domConverter`}. + * An instance of the DOM converter is available under + * {@link module:engine/view/view~View#domConverter `editor.editing.view.domConverter`}. * - * `DomConverter` does not check which nodes should be rendered (use {@link module:engine/view/renderer~Renderer}), does not keep a - * state of a tree nor keeps synchronization between tree view and DOM tree (use {@link module:engine/view/document~Document}). + * The DOM converter does not check which nodes should be rendered (use {@link module:engine/view/renderer~Renderer}), does not keep the + * state of a tree nor keeps the synchronization between the tree view and the DOM tree (use {@link module:engine/view/document~Document}). * - * `DomConverter` keeps DOM elements to View element bindings, so when the converter gets destroyed, the bindings are lost. + * The DOM converter keeps DOM elements to view element bindings, so when the converter gets destroyed, the bindings are lost. * Two converters will keep separate binding maps, so one tree view can be bound with two DOM trees. */ export default class DomConverter { /** - * Creates DOM converter. + * Creates a DOM converter. * * @param {module:engine/view/document~Document} document The view document instance. - * @param {Object} options Object with configuration options. + * @param {Object} options An object with configuration options. * @param {module:engine/view/filler~BlockFillerMode} [options.blockFillerMode='br'] The type of the block filler to use. */ constructor( document, options = {} ) { @@ -56,7 +57,7 @@ export default class DomConverter { this.document = document; /** - * The mode of a block filler used by DOM converter. + * The mode of a block filler used by the DOM converter. * * @readonly * @member {'br'|'nbsp'} module:engine/view/domconverter~DomConverter#blockFillerMode @@ -86,7 +87,7 @@ export default class DomConverter { /** * Block {@link module:engine/view/filler filler} creator, which is used to create all block fillers during the - * view to DOM conversion and to recognize block fillers during the DOM to view conversion. + * view-to-DOM conversion and to recognize block fillers during the DOM-to-view conversion. * * @readonly * @private @@ -95,7 +96,7 @@ export default class DomConverter { this._blockFiller = this.blockFillerMode == 'br' ? BR_FILLER : NBSP_FILLER; /** - * DOM to View mapping. + * The DOM-to-view mapping. * * @private * @member {WeakMap} module:engine/view/domconverter~DomConverter#_domToViewMapping @@ -103,7 +104,7 @@ export default class DomConverter { this._domToViewMapping = new WeakMap(); /** - * View to DOM mapping. + * The view-to-DOM mapping. * * @private * @member {WeakMap} module:engine/view/domconverter~DomConverter#_viewToDomMapping @@ -111,7 +112,7 @@ export default class DomConverter { this._viewToDomMapping = new WeakMap(); /** - * Holds mapping between fake selection containers and corresponding view selections. + * Holds the mapping between fake selection containers and corresponding view selections. * * @private * @member {WeakMap} module:engine/view/domconverter~DomConverter#_fakeSelectionMapping @@ -894,15 +895,15 @@ export default class DomConverter { } /** - * Checks if given selection's boundaries are at correct places. + * Checks if the given selection's boundaries are at correct places. * * The following places are considered as incorrect for selection boundaries: * - * * before or in the middle of the inline filler sequence, + * * before or in the middle of an inline filler sequence, * * inside a DOM element which represents {@link module:engine/view/uielement~UIElement a view UI element}, * * inside a DOM element which represents {@link module:engine/view/rawelement~RawElement a view raw element}. * - * @param {Selection} domSelection DOM Selection object to be checked. + * @param {Selection} domSelection The DOM selection object to be checked. * @returns {Boolean} `true` if the given selection is at a correct place, `false` otherwise. */ isDomSelectionCorrect( domSelection ) { diff --git a/packages/ckeditor5-engine/src/view/downcastwriter.js b/packages/ckeditor5-engine/src/view/downcastwriter.js index cf0e83eb1ac..f9ebbc58b1f 100644 --- a/packages/ckeditor5-engine/src/view/downcastwriter.js +++ b/packages/ckeditor5-engine/src/view/downcastwriter.js @@ -155,7 +155,7 @@ export default class DowncastWriter { } /** - * Creates new {@link module:engine/view/attributeelement~AttributeElement}. + * Creates a new {@link module:engine/view/attributeelement~AttributeElement}. * * writer.createAttributeElement( 'strong' ); * writer.createAttributeElement( 'a', { href: 'foo.bar' } ); @@ -188,7 +188,7 @@ export default class DowncastWriter { } /** - * Creates new {@link module:engine/view/containerelement~ContainerElement}. + * Creates a new {@link module:engine/view/containerelement~ContainerElement}. * * writer.createContainerElement( 'p' ); * @@ -210,7 +210,7 @@ export default class DowncastWriter { } /** - * Creates new {@link module:engine/view/editableelement~EditableElement}. + * Creates a new {@link module:engine/view/editableelement~EditableElement}. * * writer.createEditableElement( 'div' ); * writer.createEditableElement( 'div', { id: 'foo-1234' } ); @@ -230,7 +230,7 @@ export default class DowncastWriter { } /** - * Creates new {@link module:engine/view/emptyelement~EmptyElement}. + * Creates a new {@link module:engine/view/emptyelement~EmptyElement}. * * writer.createEmptyElement( 'img' ); * writer.createEmptyElement( 'img', { id: 'foo-1234' } ); @@ -244,12 +244,12 @@ export default class DowncastWriter { } /** - * Creates new {@link module:engine/view/uielement~UIElement}. + * Creates a new {@link module:engine/view/uielement~UIElement}. * * writer.createUIElement( 'span' ); * writer.createUIElement( 'span', { id: 'foo-1234' } ); * - * Custom render function can be provided as third parameter: + * A custom render function can be provided as the third parameter: * * writer.createUIElement( 'span', null, function( domDocument ) { * const domElement = this.toDomElement( domDocument ); @@ -263,10 +263,10 @@ export default class DowncastWriter { * * You should not use UI elements as data containers. Check out {@link #createRawElement} instead. * - * @param {String} name Name of the element. - * @param {Object} [attributes] Elements attributes. - * @param {Function} [renderFunction] Custom render function. - * @returns {module:engine/view/uielement~UIElement} Created element. + * @param {String} name The name of the element. + * @param {Object} [attributes] Element attributes. + * @param {Function} [renderFunction] A custom render function. + * @returns {module:engine/view/uielement~UIElement} The created element. */ createUIElement( name, attributes, renderFunction ) { const uiElement = new UIElement( this.document, name, attributes ); @@ -288,18 +288,19 @@ export default class DowncastWriter { * Raw elements work as data containers ("wrappers", "sandboxes") but their children are not managed or * even recognized by the editor. This encapsulation allows integrations to maintain custom DOM structures * in the editor content without, for instance, worrying about compatibility with other editor features. - * Raw elements make a perfect tool for integration with external frameworks and data sources. + * Raw elements are a perfect tool for integration with external frameworks and data sources. * - * Unlike {@link #createUIElement ui elements}, raw elements act like a "real" editor content (similar to + * Unlike {@link #createUIElement UI elements}, raw elements act like "real" editor content (similar to * {@link module:engine/view/containerelement~ContainerElement} or {@link module:engine/view/emptyelement~EmptyElement}), * and they are considered by the editor selection. * - * You should not use raw elements to render UI in the editor content. Check out {@link #createUIElement `#createUIElement()`} instead. + * You should not use raw elements to render the UI in the editor content. Check out {@link #createUIElement `#createUIElement()`} + * instead. * - * @param {String} name Name of the element. - * @param {Object} [attributes] Elements attributes. - * @param {Function} [renderFunction] Custom render function. - * @returns {module:engine/view/rawelement~RawElement} Created element. + * @param {String} name The name of the element. + * @param {Object} [attributes] Element attributes. + * @param {Function} [renderFunction] A custom render function. + * @returns {module:engine/view/rawelement~RawElement} The created element. */ createRawElement( name, attributes, renderFunction ) { const rawElement = new RawElement( this.document, name, attributes ); @@ -310,12 +311,12 @@ export default class DowncastWriter { } /** - * Adds or overwrite element's attribute with a specified key and value. + * Adds or overwrites the element's attribute with a specified key and value. * * writer.setAttribute( 'href', 'http://ckeditor.com', linkElement ); * - * @param {String} key Attribute key. - * @param {String} value Attribute value. + * @param {String} key The attribute key. + * @param {String} value The attribute value. * @param {module:engine/view/element~Element} element */ setAttribute( key, value, element ) { diff --git a/packages/ckeditor5-engine/src/view/rawelement.js b/packages/ckeditor5-engine/src/view/rawelement.js index b770163d3bf..1ac5d76c265 100644 --- a/packages/ckeditor5-engine/src/view/rawelement.js +++ b/packages/ckeditor5-engine/src/view/rawelement.js @@ -14,41 +14,41 @@ import Node from './node'; /** * The raw element class. * - * Raw elements work as data containers ("wrappers", "sandboxes") but their children are not managed or + * The raw elements work as data containers ("wrappers", "sandboxes") but their children are not managed or * even recognized by the editor. This encapsulation allows integrations to maintain custom DOM structures * in the editor content without, for instance, worrying about compatibility with other editor features. - * Raw elements make a perfect tool for integration with external frameworks and data sources. + * Raw elements are a perfect tool for integration with external frameworks and data sources. * - * Unlike {@link module:engine/view/uielement~UIElement ui elements}, raw elements act like a real editor + * Unlike {@link module:engine/view/uielement~UIElement UI elements}, raw elements act like real editor * content (similar to {@link module:engine/view/containerelement~ContainerElement} or * {@link module:engine/view/emptyelement~EmptyElement}), they are considered by the editor selection and * {@link module:widget/utils~toWidget they can work as widgets}. * - * To create a new raw element use the + * To create a new raw element, use the * {@link module:engine/view/downcastwriter~DowncastWriter#createRawElement `downcastWriter#createRawElement()`} method. * * @extends module:engine/view/element~Element */ export default class RawElement extends Element { /** - * Creates new instance of RawElement. + * Creates a new instance of a raw element. * - * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-rawelement-cannot-add` when `children` parameter - * is passed, to inform that usage of `RawElement` is incorrect (adding child nodes to `RawElement` is forbidden). + * Throws the `view-rawelement-cannot-add` {@link module:utils/ckeditorerror~CKEditorError CKEditorError} when the `children` + * parameter is passed to inform that the usage of `RawElement` is incorrect (adding child nodes to `RawElement` is forbidden). * * @see module:engine/view/downcastwriter~DowncastWriter#createRawElement * @protected * @param {module:engine/view/document~Document} document The document instance to which this element belongs. - * @param {String} name Node name. - * @param {Object|Iterable} [attrs] Collection of attributes. + * @param {String} name A node name. + * @param {Object|Iterable} [attrs] The collection of attributes. * @param {module:engine/view/node~Node|Iterable.} [children] - * A list of nodes to be inserted into created element. + * A list of nodes to be inserted into the created element. */ constructor( document, name, attrs, children ) { super( document, name, attrs, children ); /** - * Returns `null` because filler is not needed for RawElements. + * Returns `null` because filler is not needed for raw elements. * * @method #getFillerOffset * @returns {null} Always returns null. @@ -72,15 +72,15 @@ export default class RawElement extends Element { * Assuming that the object being checked is a raw element, you can also check its * {@link module:engine/view/rawelement~RawElement#name name}: * - * rawElement.is( 'img' ); // -> true if this is a img element + * rawElement.is( 'img' ); // -> true if this is an img element * rawElement.is( 'rawElement', 'img' ); // -> same as above * text.is( 'img' ); -> false * * {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method. * - * @param {String} type Type to check when `name` parameter is present. + * @param {String} type The type to check when the `name` parameter is present. * Otherwise, it acts like the `name` parameter. - * @param {String} [name] Element name. + * @param {String} [name] The element name. * @returns {Boolean} */ is( type, name = null ) { @@ -99,9 +99,9 @@ export default class RawElement extends Element { } /** - * Overrides {@link module:engine/view/element~Element#_insertChild} method. - * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-rawelement-cannot-add` to prevent - * adding any child nodes to a `RawElement`. + * Overrides the {@link module:engine/view/element~Element#_insertChild} method. + * Throws the `view-rawelement-cannot-add` {@link module:utils/ckeditorerror~CKEditorError CKEditorError} to prevent + * adding any child nodes to a raw element. * * @protected */ @@ -120,11 +120,11 @@ export default class RawElement extends Element { } /** - * Allows rendering the children of a {@link module:engine/view/rawelement~RawElement} on the DOM level. + * This allows rendering the children of a {@link module:engine/view/rawelement~RawElement} on the DOM level. * This method is called by the {@link module:engine/view/domconverter~DomConverter} with the raw DOM element - * passed as an argument leaving the number and shape of the children up to the integrator. + * passed as an argument, leaving the number and shape of the children up to the integrator. * - * This method **must be defined** for the `RawElement` to work: + * This method **must be defined** for the raw element to work: * * const myRawElement = downcastWriter.createRawElement( 'div' ); * @@ -137,7 +137,7 @@ export default class RawElement extends Element { */ } -// Returns `null` because block filler is not needed for RawElements. +// Returns `null` because block filler is not needed for raw elements. // // @returns {null} function getFillerOffset() { diff --git a/packages/ckeditor5-engine/tests/controller/datacontroller.js b/packages/ckeditor5-engine/tests/controller/datacontroller.js index e21c1bf2967..94647822dab 100644 --- a/packages/ckeditor5-engine/tests/controller/datacontroller.js +++ b/packages/ckeditor5-engine/tests/controller/datacontroller.js @@ -155,8 +155,8 @@ describe( 'DataController', () => { const viewFragment = new ViewDocumentFragment( viewDocument, [ parseView( 'foo' ) ] ); - // Model fragment in root. - expect( stringify( data.toModel( viewFragment ) ) ).to.equal( '' ); + // Model fragment in root (note that it is auto-paragraphed because $text is not allowed directly in $root). + expect( stringify( data.toModel( viewFragment ) ) ).to.equal( 'foo' ); // Model fragment in inline root. expect( stringify( data.toModel( viewFragment, [ 'inlineRoot' ] ) ) ).to.equal( 'foo' ); @@ -454,6 +454,82 @@ describe( 'DataController', () => { data.get( { rootName: 'nonexistent' } ); }, /datacontroller-get-non-existent-root:/ ); } ); + + it( 'should allow to provide additional options for retrieving data - insert conversion', () => { + schema.register( 'paragraph', { inheritAllFrom: '$block' } ); + + data.downcastDispatcher.on( 'insert:paragraph', ( evt, data, conversionApi ) => { + conversionApi.consumable.consume( data.item, 'insert' ); + + const viewPosition = conversionApi.mapper.toViewPosition( data.range.start ); + const viewElement = conversionApi.writer.createContainerElement( 'p', { + attribute: conversionApi.options.attributeValue + } ); + + conversionApi.mapper.bindElements( data.item, viewElement ); + conversionApi.writer.insert( viewPosition, viewElement ); + }, { priority: 'high' } ); + + setData( model, 'foo' ); + + expect( data.get( { attributeValue: 'foo' } ) ).to.equal( '

    foo

    ' ); + expect( data.get( { attributeValue: 'bar' } ) ).to.equal( '

    foo

    ' ); + } ); + + it( 'should allow to provide additional options for retrieving data - attribute conversion', () => { + schema.register( 'paragraph', { inheritAllFrom: '$block', allowAttributes: [ 'foo' ] } ); + downcastHelpers.elementToElement( { model: 'paragraph', view: 'p' } ); + + data.downcastDispatcher.on( 'attribute:foo', ( evt, data, conversionApi ) => { + if ( data.attributeNewValue === conversionApi.options.skipAttribute ) { + return; + } + + const viewRange = conversionApi.mapper.toViewRange( data.range ); + const viewElement = conversionApi.writer.createAttributeElement( data.attributeNewValue ); + + conversionApi.writer.wrap( viewRange, viewElement ); + } ); + + setData( model, 'f<$text foo="a">oob<$text foo="b">ar' ); + + expect( data.get() ).to.equal( '

    foobar

    ' ); + expect( data.get( { skipAttribute: 'a' } ) ).to.equal( '

    foobar

    ' ); + expect( data.get( { skipAttribute: 'b' } ) ).to.equal( '

    foobar

    ' ); + } ); + + it( 'should allow to provide additional options for retrieving data - addMarker conversion', () => { + schema.register( 'paragraph', { inheritAllFrom: '$block' } ); + downcastHelpers.elementToElement( { model: 'paragraph', view: 'p' } ); + + data.downcastDispatcher.on( 'addMarker', ( evt, data, conversionApi ) => { + if ( conversionApi.options.skipMarker ) { + return; + } + + const viewElement = conversionApi.writer.createAttributeElement( 'marker' ); + const viewRange = conversionApi.mapper.toViewRange( data.markerRange ); + + conversionApi.writer.wrap( viewRange, viewElement ); + } ); + + setData( model, 'foo' ); + + const root = model.document.getRoot(); + + model.change( writer => { + const start = writer.createPositionFromPath( root, [ 0, 1 ] ); + const end = writer.createPositionFromPath( root, [ 0, 2 ] ); + + writer.addMarker( 'marker', { + range: writer.createRange( start, end ), + usingOperation: false + } ); + } ); + + expect( data.get( { skipMarker: false } ) ).to.equal( '

    foo

    ' ); + expect( data.get( { skipMarker: true } ) ).to.equal( '

    foo

    ' ); + } ); } ); describe( 'stringify()', () => { @@ -478,6 +554,24 @@ describe( 'DataController', () => { expect( data.stringify( modelDocumentFragment ) ).to.equal( '

    foo

    bar

    ' ); } ); + + it( 'should allow to provide additional options to the conversion process', () => { + const spy = sinon.spy(); + + data.downcastDispatcher.on( 'insert:paragraph', ( evt, data, conversionApi ) => { + spy( conversionApi.options ); + }, { priority: 'high' } ); + + const modelDocumentFragment = parseModel( 'foobar', schema ); + + const options = { foo: 'bar' }; + + data.stringify( modelDocumentFragment ); + expect( spy.lastCall.args[ 0 ] ).to.not.equal( options ); + + data.stringify( modelDocumentFragment, options ); + expect( spy.lastCall.args[ 0 ] ).to.equal( options ); + } ); } ); describe( 'toView()', () => { @@ -590,6 +684,36 @@ describe( 'DataController', () => { expect( mappedViewRange.end.nodeBefore ).to.equal( firstViewElement ); expect( mappedViewRange.end.nodeAfter ).to.equal( viewDocumentFragment.getChild( 1 ) ); } ); + + it( 'should allow to provide additional options to the conversion process', () => { + const root = model.document.getRoot(); + const spy = sinon.spy(); + + data.downcastDispatcher.on( 'insert:paragraph', ( evt, data, conversionApi ) => { + spy( conversionApi.options ); + }, { priority: 'high' } ); + + data.downcastDispatcher.on( 'addMarker:marker', ( evt, data, conversionApi ) => { + spy( conversionApi.options ); + }, { priority: 'high' } ); + + setData( model, 'foo' ); + + model.change( writer => { + writer.addMarker( 'marker', { + range: model.createRange( model.createPositionFromPath( root, [ 0, 1 ] ) ), + usingOperation: false + } ); + } ); + + const options = { foo: 'bar' }; + + data.toView( root, options ); + + sinon.assert.calledTwice( spy ); + expect( spy.firstCall.args[ 0 ] ).to.equal( options ); + expect( spy.lastCall.args[ 0 ] ).to.equal( options ); + } ); } ); describe( 'destroy()', () => { diff --git a/packages/ckeditor5-engine/tests/conversion/downcasthelpers.js b/packages/ckeditor5-engine/tests/conversion/downcasthelpers.js index 08e46918267..2eed767080e 100644 --- a/packages/ckeditor5-engine/tests/conversion/downcasthelpers.js +++ b/packages/ckeditor5-engine/tests/conversion/downcasthelpers.js @@ -104,7 +104,7 @@ describe( 'DowncastHelpers', () => { it( 'config.view is a function', () => { downcastHelpers.elementToElement( { model: 'heading', - view: ( modelElement, viewWriter ) => viewWriter.createContainerElement( 'h' + modelElement.getAttribute( 'level' ) ) + view: ( modelElement, { writer } ) => writer.createContainerElement( 'h' + modelElement.getAttribute( 'level' ) ) } ); model.change( writer => { @@ -225,8 +225,8 @@ describe( 'DowncastHelpers', () => { it( 'config.view is a function', () => { downcastHelpers.attributeToElement( { model: 'bold', - view: ( modelAttributeValue, viewWriter ) => { - return viewWriter.createAttributeElement( 'span', { style: 'font-weight:' + modelAttributeValue } ); + view: ( modelAttributeValue, { writer } ) => { + return writer.createAttributeElement( 'span', { style: 'font-weight:' + modelAttributeValue } ); } } ); @@ -243,15 +243,15 @@ describe( 'DowncastHelpers', () => { key: 'color', name: '$text' }, - view: ( modelAttributeValue, viewWriter ) => { - return viewWriter.createAttributeElement( 'span', { style: 'color:' + modelAttributeValue } ); + view: ( modelAttributeValue, { writer } ) => { + return writer.createAttributeElement( 'span', { style: 'color:' + modelAttributeValue } ); } } ); downcastHelpers.elementToElement( { model: 'smiley', - view: ( modelElement, viewWriter ) => { - return viewWriter.createEmptyElement( 'img', { + view: ( modelElement, { writer } ) => { + return writer.createEmptyElement( 'img', { src: 'smile.jpg', class: 'smiley' } ); @@ -283,7 +283,7 @@ describe( 'DowncastHelpers', () => { downcastHelpers.attributeToElement( { model: 'bold', - view: ( modelAttributeValue, viewWriter ) => viewWriter.createAttributeElement( 'b' ) + view: ( modelAttributeValue, { writer } ) => writer.createAttributeElement( 'b' ) } ); model.change( writer => { @@ -304,9 +304,9 @@ describe( 'DowncastHelpers', () => { downcastHelpers.attributeToElement( { model: 'style', - view: ( modelAttributeValue, viewWriter ) => { + view: ( modelAttributeValue, { writer } ) => { if ( modelAttributeValue == 'bold' ) { - return viewWriter.createAttributeElement( 'b' ); + return writer.createAttributeElement( 'b' ); } } } ); @@ -333,8 +333,8 @@ describe( 'DowncastHelpers', () => { downcastHelpers.attributeToElement( { model: 'link', - view: ( modelAttributeValue, viewWriter ) => { - return viewWriter.createAttributeElement( 'a', { href: modelAttributeValue } ); + view: ( modelAttributeValue, { writer } ) => { + return writer.createAttributeElement( 'a', { href: modelAttributeValue } ); } } ); @@ -357,7 +357,7 @@ describe( 'DowncastHelpers', () => { downcastHelpers.attributeToElement( { model: 'bold', - view: ( modelAttributeValue, viewWriter ) => viewWriter.createAttributeElement( 'b' ) + view: ( modelAttributeValue, { writer } ) => writer.createAttributeElement( 'b' ) } ); model.change( writer => { @@ -378,11 +378,11 @@ describe( 'DowncastHelpers', () => { downcastHelpers.attributeToElement( { model: 'bold', - view: ( modelAttributeValue, viewWriter ) => viewWriter.createAttributeElement( 'b' ) + view: ( modelAttributeValue, { writer } ) => writer.createAttributeElement( 'b' ) } ); downcastHelpers.attributeToElement( { model: 'bold', - view: ( modelAttributeValue, viewWriter ) => viewWriter.createAttributeElement( 'strong' ), + view: ( modelAttributeValue, { writer } ) => writer.createAttributeElement( 'strong' ), converterPriority: 'high' } ); @@ -423,7 +423,7 @@ describe( 'DowncastHelpers', () => { downcastHelpers.elementToElement( { model: 'image', view: 'img' } ); downcastHelpers.elementToElement( { model: 'paragraph', - view: ( modelItem, viewWriter ) => viewWriter.createContainerElement( 'p' ) + view: ( modelItem, { writer } ) => writer.createContainerElement( 'p' ) } ); downcastHelpers.attributeToAttribute( { @@ -605,7 +605,12 @@ describe( 'DowncastHelpers', () => { it( 'config.view is a function', () => { downcastHelpers.attributeToAttribute( { model: 'styled', - view: attributeValue => ( { key: 'class', value: 'styled-' + attributeValue } ) + view: ( attributeValue, conversionApi ) => { + // To ensure conversion API is provided. + expect( conversionApi.writer ).to.instanceof( DowncastWriter ); + + return { key: 'class', value: 'styled-' + attributeValue }; + } } ); model.change( writer => { @@ -677,41 +682,6 @@ describe( 'DowncastHelpers', () => { expect( viewToString( viewRoot ) ).to.equal( '

    foobar

    ' ); } ); - it( 'should convert insert/change/remove with attribute generating function as a parameter', () => { - downcastHelpers.elementToElement( { model: 'div', view: 'div' } ); - downcastHelpers.attributeToAttribute( { - model: 'theme', - view: ( value, data ) => { - if ( data.item instanceof ModelElement && data.item.childCount > 0 ) { - value += ' fix-content'; - } - - return { key: 'class', value }; - } - } ); - - const modelParagraph = new ModelElement( 'paragraph', { theme: 'nice' }, new ModelText( 'foobar' ) ); - const modelDiv = new ModelElement( 'div', { theme: 'nice' } ); - - model.change( writer => { - writer.insert( [ modelParagraph, modelDiv ], modelRootStart ); - } ); - - expect( viewToString( viewRoot ) ).to.equal( '

    foobar

    ' ); - - model.change( writer => { - writer.setAttribute( 'theme', 'awesome', modelParagraph ); - } ); - - expect( viewToString( viewRoot ) ).to.equal( '

    foobar

    ' ); - - model.change( writer => { - writer.removeAttribute( 'theme', modelParagraph ); - } ); - - expect( viewToString( viewRoot ) ).to.equal( '

    foobar

    ' ); - } ); - it( 'should be possible to override setAttribute', () => { downcastHelpers.attributeToAttribute( { model: 'class', @@ -807,8 +777,8 @@ describe( 'DowncastHelpers', () => { it( 'config.view is a function', () => { downcastHelpers.markerToElement( { model: 'search', - view: ( data, viewWriter ) => { - return viewWriter.createUIElement( 'span', { 'data-marker': 'search', 'data-start': data.isOpening } ); + view: ( data, { writer } ) => { + return writer.createUIElement( 'span', { 'data-marker': 'search', 'data-start': data.isOpening } ); } } ); @@ -838,7 +808,7 @@ describe( 'DowncastHelpers', () => { it( 'should insert and remove ui element', () => { downcastHelpers.markerToElement( { model: 'marker', - view: ( data, viewWriter ) => viewWriter.createUIElement( 'span', { 'class': 'marker' } ) + view: ( data, { writer } ) => writer.createUIElement( 'span', { 'class': 'marker' } ) } ); model.change( writer => { @@ -859,7 +829,7 @@ describe( 'DowncastHelpers', () => { downcastHelpers.markerToElement( { model: 'marker', - view: ( data, viewWriter ) => viewWriter.createUIElement( 'span', { 'class': 'marker' } ) + view: ( data, { writer } ) => writer.createUIElement( 'span', { 'class': 'marker' } ) } ); controller.downcastDispatcher.on( 'addMarker:marker', ( evt, data, conversionApi ) => { @@ -911,7 +881,7 @@ describe( 'DowncastHelpers', () => { it( 'should insert and remove ui element - element as a creator', () => { downcastHelpers.markerToElement( { model: 'marker', - view: ( data, viewWriter ) => viewWriter.createUIElement( 'span', { 'class': 'marker' } ) + view: ( data, { writer } ) => writer.createUIElement( 'span', { 'class': 'marker' } ) } ); model.change( writer => { @@ -931,7 +901,7 @@ describe( 'DowncastHelpers', () => { it( 'should insert and remove ui element - function as a creator', () => { downcastHelpers.markerToElement( { model: 'marker', - view: ( data, viewWriter ) => viewWriter.createUIElement( 'span', { 'class': data.markerName } ) + view: ( data, { writer } ) => writer.createUIElement( 'span', { 'class': data.markerName } ) } ); model.change( writer => { @@ -951,12 +921,12 @@ describe( 'DowncastHelpers', () => { it( 'should insert and remove different opening and ending element', () => { downcastHelpers.markerToElement( { model: 'marker', - view: ( data, viewWriter ) => { + view: ( data, { writer } ) => { if ( data.isOpening ) { - return viewWriter.createUIElement( 'span', { 'class': data.markerName, 'data-start': true } ); + return writer.createUIElement( 'span', { 'class': data.markerName, 'data-start': true } ); } - return viewWriter.createUIElement( 'span', { 'class': data.markerName, 'data-end': true } ); + return writer.createUIElement( 'span', { 'class': data.markerName, 'data-end': true } ); } } ); @@ -980,7 +950,7 @@ describe( 'DowncastHelpers', () => { downcastHelpers.markerToElement( { model: 'marker', - view: ( data, viewWriter ) => viewWriter.createUIElement( 'span', { 'class': 'marker' } ) + view: ( data, { writer } ) => writer.createUIElement( 'span', { 'class': 'marker' } ) } ); controller.downcastDispatcher.on( 'addMarker:marker', ( evt, data, conversionApi ) => { conversionApi.consumable.consume( data.item, 'addMarker:marker' ); @@ -1316,9 +1286,12 @@ describe( 'DowncastHelpers', () => { downcastHelpers.markerToData( { model: 'group', - view: markerName => { + view: ( markerName, conversionApi ) => { const namePart = markerName.split( ':' )[ 1 ]; + // To ensure conversion API is provided. + expect( conversionApi.writer ).to.instanceof( DowncastWriter ); + return { group: 'g', name: namePart + '_' + customData[ namePart ] @@ -1510,9 +1483,12 @@ describe( 'DowncastHelpers', () => { it( 'config.view is a function', () => { downcastHelpers.markerToHighlight( { model: 'comment', - view: data => { + view: ( data, conversionApi ) => { const commentType = data.markerName.split( ':' )[ 1 ]; + // To ensure conversion API is provided. + expect( conversionApi.writer ).to.instanceof( DowncastWriter ); + return { classes: [ 'comment', 'comment-' + commentType ] }; diff --git a/packages/ckeditor5-engine/tests/conversion/upcastdispatcher.js b/packages/ckeditor5-engine/tests/conversion/upcastdispatcher.js index 9a4c16edaa6..f38d72cd4f0 100644 --- a/packages/ckeditor5-engine/tests/conversion/upcastdispatcher.js +++ b/packages/ckeditor5-engine/tests/conversion/upcastdispatcher.js @@ -605,6 +605,43 @@ describe( 'UpcastDispatcher', () => { sinon.assert.calledOnce( spy ); } ); + it( + 'should auto-paragraph an element if it is not allowed at the insertion position' + + 'but would be inserted if auto-paragraphed', + () => { + const spy = sinon.spy(); + + model.schema.register( 'section', { + allowIn: '$root' + } ); + model.schema.register( 'span', { + allowIn: 'paragraph' + } ); + model.schema.extend( 'paragraph', { + allowIn: 'section' + } ); + + dispatcher.on( 'documentFragment', ( evt, data, conversionApi ) => { + const section = conversionApi.writer.createElement( 'section' ); + const position = ModelPosition._createAt( section, 0 ); + + const span = conversionApi.writer.createElement( 'span' ); + + const result = conversionApi.splitToAllowedParent( span, position ); + + expect( section.getChild( 0 ).name ).to.equal( 'paragraph' ); + expect( result ).to.deep.equal( { + position: ModelPosition._createAt( section.getChild( 0 ), 0 ) + } ); + + spy(); + } ); + + model.change( writer => dispatcher.convert( new ViewDocumentFragment( viewDocument ), writer ) ); + sinon.assert.calledOnce( spy ); + } + ); + it( 'should return null if element is not allowed in position and any of ancestors', () => { const spy = sinon.spy(); diff --git a/packages/ckeditor5-engine/tests/conversion/upcasthelpers.js b/packages/ckeditor5-engine/tests/conversion/upcasthelpers.js index bb4d51ee09f..ce1dd9de860 100644 --- a/packages/ckeditor5-engine/tests/conversion/upcasthelpers.js +++ b/packages/ckeditor5-engine/tests/conversion/upcasthelpers.js @@ -29,6 +29,7 @@ import Mapper from '../../src/conversion/mapper'; import ViewSelection from '../../src/view/selection'; import ViewRange from '../../src/view/range'; import { StylesProcessor } from '../../src/view/stylesmap'; +import Writer from '../../src/model/writer'; /* globals console */ @@ -108,8 +109,8 @@ describe( 'UpcastHelpers', () => { name: 'p', classes: 'heading' }, - model: ( viewElement, modelWriter ) => { - return modelWriter.createElement( 'heading', { level: viewElement.getAttribute( 'data-level' ) } ); + model: ( viewElement, { writer } ) => { + return writer.createElement( 'heading', { level: viewElement.getAttribute( 'data-level' ) } ); } } ); @@ -250,10 +251,13 @@ describe( 'UpcastHelpers', () => { }, model: { key: 'fontSize', - value: viewElement => { + value: ( viewElement, conversionApi ) => { const fontSize = viewElement.getStyle( 'font-size' ); const value = fontSize.substr( 0, fontSize.length - 2 ); + // To ensure conversion API is provided. + expect( conversionApi.writer ).to.instanceof( Writer ); + if ( value <= 10 ) { return 'small'; } else if ( value > 12 ) { @@ -504,10 +508,13 @@ describe( 'UpcastHelpers', () => { }, model: { key: 'styled', - value: viewElement => { + value: ( viewElement, conversionApi ) => { const regexp = /styled-([\S]+)/; const match = viewElement.getAttribute( 'class' ).match( regexp ); + // To ensure conversion API is provided. + expect( conversionApi.writer ).to.instanceof( Writer ); + return match[ 1 ]; } } @@ -660,7 +667,12 @@ describe( 'UpcastHelpers', () => { it( 'config.model is a function', () => { upcastHelpers.elementToMarker( { view: 'comment', - model: viewElement => 'comment:' + viewElement.getAttribute( 'data-comment-id' ) + model: ( viewElement, conversionApi ) => { + // To ensure conversion API is provided. + expect( conversionApi.writer ).to.instanceof( Writer ); + + return 'comment:' + viewElement.getAttribute( 'data-comment-id' ); + } } ); const frag = new ViewDocumentFragment( viewDocument, [ @@ -837,7 +849,14 @@ describe( 'UpcastHelpers', () => { } ); it( 'conversion callback, mixed, multiple markers, name', () => { - upcastHelpers.dataToMarker( { view: 'g', model: name => 'group:' + name.split( '_' )[ 0 ] } ); + upcastHelpers.dataToMarker( { + view: 'g', + model: ( name, conversionApi ) => { + // To ensure conversion API is provided. + expect( conversionApi.writer ).to.instanceof( Writer ); + + return 'group:' + name.split( '_' )[ 0 ]; + } } ); expectResult( viewParse( @@ -949,7 +968,7 @@ describe( 'upcast-converters', () => { it( 'should not convert text if it is wrong with schema', () => { schema.addChildCheck( ( ctx, childDef ) => { - if ( childDef.name == '$text' && ctx.endsWith( '$root' ) ) { + if ( ( childDef.name == '$text' || childDef.name == 'paragraph' ) && ctx.endsWith( '$root' ) ) { return false; } } ); @@ -969,6 +988,31 @@ describe( 'upcast-converters', () => { expect( conversionResult.getChild( 0 ).data ).to.equal( 'foobar' ); } ); + it( 'should auto-paragraph a text if it is not allowed at the insertion position but would be inserted if auto-paragraphed', () => { + schema.addChildCheck( ( ctx, childDef ) => { + if ( childDef.name == '$text' && ctx.endsWith( '$root' ) ) { + return false; + } + } ); + + const viewText = new ViewText( viewDocument, 'foobar' ); + dispatcher.on( 'text', convertText() ); + let conversionResult = model.change( writer => dispatcher.convert( viewText, writer, context ) ); + + expect( conversionResult ).to.be.instanceof( ModelDocumentFragment ); + expect( conversionResult.childCount ).to.equal( 1 ); + expect( conversionResult.getChild( 0 ).name ).to.equal( 'paragraph' ); + expect( conversionResult.getNodeByPath( [ 0, 0 ] ) ).to.be.instanceof( ModelText ); + expect( conversionResult.getNodeByPath( [ 0, 0 ] ).data ).to.equal( 'foobar' ); + + conversionResult = model.change( writer => dispatcher.convert( viewText, writer, [ '$block' ] ) ); + + expect( conversionResult ).to.be.instanceof( ModelDocumentFragment ); + expect( conversionResult.childCount ).to.equal( 1 ); + expect( conversionResult.getChild( 0 ) ).to.be.instanceof( ModelText ); + expect( conversionResult.getChild( 0 ).data ).to.equal( 'foobar' ); + } ); + it( 'should support unicode', () => { const viewText = new ViewText( viewDocument, 'நிலைக்கு' ); diff --git a/packages/ckeditor5-engine/tests/model/utils/deletecontent.js b/packages/ckeditor5-engine/tests/model/utils/deletecontent.js index 7ff06fc2cca..2c615a6834c 100644 --- a/packages/ckeditor5-engine/tests/model/utils/deletecontent.js +++ b/packages/ckeditor5-engine/tests/model/utils/deletecontent.js @@ -941,10 +941,15 @@ describe( 'DataController utils', () => { { rootName: 'bodyRoot' } ); - deleteContent( model, doc.selection, { doNotAutoparagraph: true } ); + // This must be tested inside a change block to check results before the post-fixers get triggered. + model.change( () => { + deleteContent( model, doc.selection, { doNotAutoparagraph: true } ); - expect( getData( model, { rootName: 'bodyRoot' } ) ) - .to.equal( '[]' ); + expect( getData( model, { rootName: 'bodyRoot' } ) ).to.equal( '[]' ); + } ); + + // Note that auto-paragraphing post-fixer injected a paragraph into the empty root. + expect( getData( model, { rootName: 'bodyRoot' } ) ).to.equal( '[]' ); } ); } ); diff --git a/packages/ckeditor5-engine/tests/model/utils/selection-post-fixer.js b/packages/ckeditor5-engine/tests/model/utils/selection-post-fixer.js index 8155bd1b072..4f5a39b2c23 100644 --- a/packages/ckeditor5-engine/tests/model/utils/selection-post-fixer.js +++ b/packages/ckeditor5-engine/tests/model/utils/selection-post-fixer.js @@ -75,7 +75,8 @@ describe( 'Selection post-fixer', () => { it( 'should not crash if there is no correct position for model selection', () => { setModelData( model, '' ); - expect( getModelData( model ) ).to.equal( '[]' ); + // Note that auto-paragraphing post-fixer injected a paragraph into the empty root. + expect( getModelData( model ) ).to.equal( '[]' ); } ); it( 'should react to structure changes', () => { diff --git a/packages/ckeditor5-enter/src/shiftenter.js b/packages/ckeditor5-enter/src/shiftenter.js index 970e206a231..01c43b197ad 100644 --- a/packages/ckeditor5-enter/src/shiftenter.js +++ b/packages/ckeditor5-enter/src/shiftenter.js @@ -51,7 +51,7 @@ export default class ShiftEnter extends Plugin { conversion.for( 'downcast' ) .elementToElement( { model: 'softBreak', - view: ( modelElement, viewWriter ) => viewWriter.createEmptyElement( 'br' ) + view: ( modelElement, { writer } ) => writer.createEmptyElement( 'br' ) } ); view.addObserver( EnterObserver ); diff --git a/packages/ckeditor5-font/lang/translations/ko.po b/packages/ckeditor5-font/lang/translations/ko.po index 04b042c0ba4..e5e4631ce46 100644 --- a/packages/ckeditor5-font/lang/translations/ko.po +++ b/packages/ckeditor5-font/lang/translations/ko.po @@ -38,7 +38,7 @@ msgstr "매우 큰" msgctxt "Tooltip for the font family dropdown." msgid "Font Family" -msgstr "글꼴" +msgstr "글꼴 집합" msgctxt "Dropdown option label for the default font family." msgid "Default" @@ -46,12 +46,12 @@ msgstr "기본" msgctxt "Label of a button that allows selecting a font color." msgid "Font Color" -msgstr "글자 색상" +msgstr "글자 색깔" msgctxt "Label of a button that allows selecting a font background color." msgid "Font Background Color" -msgstr "글자 배경색" +msgstr "글자 배경 색깔" msgctxt "Title of a color picker section containing the colors currently used in the document." msgid "Document colors" -msgstr "문서 색상들" +msgstr "문서 색깔들" diff --git a/packages/ckeditor5-font/lang/translations/zh.po b/packages/ckeditor5-font/lang/translations/zh.po index a2137e01f7f..6aa969503b9 100644 --- a/packages/ckeditor5-font/lang/translations/zh.po +++ b/packages/ckeditor5-font/lang/translations/zh.po @@ -54,4 +54,4 @@ msgstr "前景顏色" msgctxt "Title of a color picker section containing the colors currently used in the document." msgid "Document colors" -msgstr "" +msgstr "文件顏色" diff --git a/packages/ckeditor5-font/src/fontfamily/fontfamilyediting.js b/packages/ckeditor5-font/src/fontfamily/fontfamilyediting.js index aff3e416db4..206b6d63c27 100644 --- a/packages/ckeditor5-font/src/fontfamily/fontfamilyediting.js +++ b/packages/ckeditor5-font/src/fontfamily/fontfamilyediting.js @@ -92,7 +92,7 @@ export default class FontFamilyEditing extends Plugin { editor.conversion.for( 'downcast' ).attributeToElement( { model: FONT_FAMILY, - view: ( attributeValue, writer ) => { + view: ( attributeValue, { writer } ) => { return writer.createAttributeElement( 'span', { style: 'font-family:' + attributeValue }, { priority: 7 } ); } } ); diff --git a/packages/ckeditor5-font/src/fontsize/fontsizeediting.js b/packages/ckeditor5-font/src/fontsize/fontsizeediting.js index 2f07c8167af..5ab5606a42c 100644 --- a/packages/ckeditor5-font/src/fontsize/fontsizeediting.js +++ b/packages/ckeditor5-font/src/fontsize/fontsizeediting.js @@ -117,7 +117,7 @@ export default class FontSizeEditing extends Plugin { editor.conversion.for( 'downcast' ).attributeToElement( { model: FONT_SIZE, - view: ( attributeValue, writer ) => { + view: ( attributeValue, { writer } ) => { if ( !attributeValue ) { return; } diff --git a/packages/ckeditor5-font/src/utils.js b/packages/ckeditor5-font/src/utils.js index 67147c80efe..c9ca334eb41 100644 --- a/packages/ckeditor5-font/src/utils.js +++ b/packages/ckeditor5-font/src/utils.js @@ -82,7 +82,7 @@ export function renderUpcastAttribute( styleAttr ) { * @param {String} styleAttr */ export function renderDowncastElement( styleAttr ) { - return ( modelAttributeValue, viewWriter ) => viewWriter.createAttributeElement( 'span', { + return ( modelAttributeValue, { writer } ) => writer.createAttributeElement( 'span', { style: `${ styleAttr }:${ modelAttributeValue }` }, { priority: 7 } ); } diff --git a/packages/ckeditor5-font/tests/utils.js b/packages/ckeditor5-font/tests/utils.js index d79922f5373..654c1ac6ccb 100644 --- a/packages/ckeditor5-font/tests/utils.js +++ b/packages/ckeditor5-font/tests/utils.js @@ -60,7 +60,7 @@ describe( 'utils', () => { const fake = testUtils.sinon.fake(); const fakeViewWriter = { createAttributeElement: fake }; - downcastViewConverterFn( 'blue', fakeViewWriter ); + downcastViewConverterFn( 'blue', { writer: fakeViewWriter } ); sinon.assert.calledWithExactly( fake, 'span', { style: 'color:blue' }, { priority: 7 } ); } ); diff --git a/packages/ckeditor5-heading/lang/translations/ko.po b/packages/ckeditor5-heading/lang/translations/ko.po index 0501fb0df7b..5b952cdb9e6 100644 --- a/packages/ckeditor5-heading/lang/translations/ko.po +++ b/packages/ckeditor5-heading/lang/translations/ko.po @@ -30,31 +30,31 @@ msgstr "제목 선택" msgctxt "Dropdown option label for the heading level 1 format." msgid "Heading 1" -msgstr "제목1" +msgstr "제목 1" msgctxt "Dropdown option label for the heading level 2 format." msgid "Heading 2" -msgstr "제목2" +msgstr "제목 2" msgctxt "Dropdown option label for the heading level 3 format." msgid "Heading 3" -msgstr "제목3" +msgstr "제목 3" msgctxt "Dropdown option label for the heading level 4 format." msgid "Heading 4" -msgstr "제목4" +msgstr "제목 4" msgctxt "Dropdown option label for the heading level 5 format." msgid "Heading 5" -msgstr "제목5" +msgstr "제목 5" msgctxt "Dropdown option label for the heading level 6 format." msgid "Heading 6" -msgstr "제목6" +msgstr "제목 6" msgctxt "A default value of the placeholder for the content title." msgid "Type your title" -msgstr "제목 입력" +msgstr "제목을 입력해주세요" msgctxt "A default value of the placeholder for the content body." msgid "Type or paste your content here." diff --git a/packages/ckeditor5-heading/lang/translations/zh.po b/packages/ckeditor5-heading/lang/translations/zh.po index 97204e6887c..a8c6b7c52aa 100644 --- a/packages/ckeditor5-heading/lang/translations/zh.po +++ b/packages/ckeditor5-heading/lang/translations/zh.po @@ -54,8 +54,8 @@ msgstr "標題 6" msgctxt "A default value of the placeholder for the content title." msgid "Type your title" -msgstr "" +msgstr "輸入你的標題" msgctxt "A default value of the placeholder for the content body." msgid "Type or paste your content here." -msgstr "" +msgstr "在此輸入或貼上你的內容。" diff --git a/packages/ckeditor5-highlight/lang/translations/ko.po b/packages/ckeditor5-highlight/lang/translations/ko.po new file mode 100644 index 00000000000..5753c35a8aa --- /dev/null +++ b/packages/ckeditor5-highlight/lang/translations/ko.po @@ -0,0 +1,53 @@ +# Copyright (c) 2003-2020, 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: Korean (https://www.transifex.com/ckeditor/teams/11143/ko/)\n" +"Language: ko\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "Toolbar button tooltip for applying yellow marker (text highlight)." +msgid "Yellow marker" +msgstr "노란색 마커" + +msgctxt "Toolbar button tooltip for applying green marker (text highlight)." +msgid "Green marker" +msgstr "초록색 마커" + +msgctxt "Toolbar button tooltip for applying pink marker (text highlight)." +msgid "Pink marker" +msgstr "분홍색 마커" + +msgctxt "Toolbar button tooltip for applying blue marker (text highlight)." +msgid "Blue marker" +msgstr "파란색 마커" + +msgctxt "Toolbar button tooltip for applying red pen (text color)." +msgid "Red pen" +msgstr "빨간색 펜" + +msgctxt "Toolbar button tooltip for applying green pen (text color)." +msgid "Green pen" +msgstr "초록색 펜" + +msgctxt "Toolbar button tooltip for removing text highlight." +msgid "Remove highlight" +msgstr "강조 제거" + +msgctxt "Toolbar button tooltip for the text highlight feature." +msgid "Highlight" +msgstr "강조" + +msgctxt "Label used by assistive technologies describing the highlight feature toolbar." +msgid "Text highlight toolbar" +msgstr "글자 강조 툴바" diff --git a/packages/ckeditor5-highlight/lang/translations/zh.po b/packages/ckeditor5-highlight/lang/translations/zh.po index ef7dc44d792..1c8dedc159a 100644 --- a/packages/ckeditor5-highlight/lang/translations/zh.po +++ b/packages/ckeditor5-highlight/lang/translations/zh.po @@ -50,4 +50,4 @@ msgstr "高亮" msgctxt "Label used by assistive technologies describing the highlight feature toolbar." msgid "Text highlight toolbar" -msgstr "" +msgstr "高亮" diff --git a/packages/ckeditor5-horizontal-line/lang/translations/zh.po b/packages/ckeditor5-horizontal-line/lang/translations/zh.po new file mode 100644 index 00000000000..d7f91b9ccde --- /dev/null +++ b/packages/ckeditor5-horizontal-line/lang/translations/zh.po @@ -0,0 +1,21 @@ +# Copyright (c) 2003-2020, 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: Chinese (Taiwan) (https://www.transifex.com/ckeditor/teams/11143/zh_TW/)\n" +"Language: zh_TW\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "Horizontal line" +msgid "Horizontal line" +msgstr "水平線" diff --git a/packages/ckeditor5-horizontal-line/src/horizontallineediting.js b/packages/ckeditor5-horizontal-line/src/horizontallineediting.js index 3fd3d135b48..31dd3c4046d 100644 --- a/packages/ckeditor5-horizontal-line/src/horizontallineediting.js +++ b/packages/ckeditor5-horizontal-line/src/horizontallineediting.js @@ -42,24 +42,24 @@ export default class HorizontalLineEditing extends Plugin { conversion.for( 'dataDowncast' ).elementToElement( { model: 'horizontalLine', - view: ( modelElement, viewWriter ) => { - return viewWriter.createEmptyElement( 'hr' ); + view: ( modelElement, { writer } ) => { + return writer.createEmptyElement( 'hr' ); } } ); conversion.for( 'editingDowncast' ).elementToElement( { model: 'horizontalLine', - view: ( modelElement, viewWriter ) => { + view: ( modelElement, { writer } ) => { const label = t( 'Horizontal line' ); - const viewWrapper = viewWriter.createContainerElement( 'div' ); - const viewHrElement = viewWriter.createEmptyElement( 'hr' ); + const viewWrapper = writer.createContainerElement( 'div' ); + const viewHrElement = writer.createEmptyElement( 'hr' ); - viewWriter.addClass( 'ck-horizontal-line', viewWrapper ); - viewWriter.setCustomProperty( 'hr', true, viewWrapper ); + writer.addClass( 'ck-horizontal-line', viewWrapper ); + writer.setCustomProperty( 'hr', true, viewWrapper ); - viewWriter.insert( viewWriter.createPositionAt( viewWrapper, 0 ), viewHrElement ); + writer.insert( writer.createPositionAt( viewWrapper, 0 ), viewHrElement ); - return toHorizontalLineWidget( viewWrapper, viewWriter, label ); + return toHorizontalLineWidget( viewWrapper, writer, label ); } } ); diff --git a/packages/ckeditor5-image/lang/translations/de.po b/packages/ckeditor5-image/lang/translations/de.po index c0e176b72cf..16604006214 100644 --- a/packages/ckeditor5-image/lang/translations/de.po +++ b/packages/ckeditor5-image/lang/translations/de.po @@ -42,11 +42,11 @@ msgstr "rechtsbündiges Bild" msgctxt "Label for the Change image text alternative button." msgid "Change image text alternative" -msgstr "Alternativ Text ändern" +msgstr "Alternativtext ändern" msgctxt "Label for the image text alternative input." msgid "Text alternative" -msgstr "Textalternative" +msgstr "Alternativtext" msgctxt "Placeholder text for image caption displayed when caption is empty." msgid "Enter image caption" @@ -66,20 +66,20 @@ msgstr "Bild Werkzeugleiste" msgctxt "The label used for the dropdown in the image toolbar containing defined resize options" msgid "Resize image" -msgstr "" +msgstr "Bildgröße ändern" msgctxt "The label used for the standalone resize options buttons in the image toolbar" msgid "Resize image to %0" -msgstr "" +msgstr "Bildgröße ändern in %0" msgctxt "The accessibility label of the standalone image resize reset option button in the image toolbar for the screen readers" msgid "Resize image to the original size" -msgstr "" +msgstr "Bild in Originalgröße ändern" msgctxt "Default label for the resize option that resets the size of the image." msgid "Original" -msgstr "" +msgstr "Original" msgctxt "The accessibility label of the image resize dropdown list for the screen readers." msgid "Image resize list" -msgstr "" +msgstr "Bildgrößen-Liste" diff --git a/packages/ckeditor5-image/lang/translations/ko.po b/packages/ckeditor5-image/lang/translations/ko.po index d23bef24ec9..b214ccb4ca0 100644 --- a/packages/ckeditor5-image/lang/translations/ko.po +++ b/packages/ckeditor5-image/lang/translations/ko.po @@ -18,15 +18,15 @@ msgstr "" msgctxt "Label for the image widget." msgid "image widget" -msgstr "이미지 위젯" +msgstr "사진 위젯" msgctxt "Label for the Side image option." msgid "Side image" -msgstr "내부 우측 정렬" +msgstr "본문 옆에 배치" msgctxt "Label for the Full size image option." msgid "Full size image" -msgstr "문서 너비" +msgstr "꽉 찬 크기" msgctxt "Label for the Left aligned image option" msgid "Left aligned image" @@ -42,19 +42,19 @@ msgstr "오른쪽 정렬" msgctxt "Label for the Change image text alternative button." msgid "Change image text alternative" -msgstr "대체 텍스트 변경" +msgstr "대체 문구 변경" msgctxt "Label for the image text alternative input." msgid "Text alternative" -msgstr "대체 텍스트" +msgstr "대체 문구" msgctxt "Placeholder text for image caption displayed when caption is empty." msgid "Enter image caption" -msgstr "이미지 설명을 입력하세요" +msgstr "사진 설명을 입력하세요" msgctxt "Label for the insert image toolbar button." msgid "Insert image" -msgstr "이미지 삽입" +msgstr "사진 삽입" msgctxt "Title of the notification displayed when upload fails." msgid "Upload failed" @@ -62,24 +62,24 @@ msgstr "업로드 실패" msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget." msgid "Image toolbar" -msgstr "이미지 툴바" +msgstr "사진 툴바" msgctxt "The label used for the dropdown in the image toolbar containing defined resize options" msgid "Resize image" -msgstr "" +msgstr "사진 크기 조절" msgctxt "The label used for the standalone resize options buttons in the image toolbar" msgid "Resize image to %0" -msgstr "" +msgstr "사진의 크기를 %0으로 조절" msgctxt "The accessibility label of the standalone image resize reset option button in the image toolbar for the screen readers" msgid "Resize image to the original size" -msgstr "" +msgstr "사진을 원래 크기로 돌려놓기" msgctxt "Default label for the resize option that resets the size of the image." msgid "Original" -msgstr "" +msgstr "원본" msgctxt "The accessibility label of the image resize dropdown list for the screen readers." msgid "Image resize list" -msgstr "" +msgstr "사진 크기 목록" diff --git a/packages/ckeditor5-image/lang/translations/sr-latn.po b/packages/ckeditor5-image/lang/translations/sr-latn.po index dcb54108fba..ae0509a9814 100644 --- a/packages/ckeditor5-image/lang/translations/sr-latn.po +++ b/packages/ckeditor5-image/lang/translations/sr-latn.po @@ -66,20 +66,20 @@ msgstr "Slika traka sa alatkama" msgctxt "The label used for the dropdown in the image toolbar containing defined resize options" msgid "Resize image" -msgstr "" +msgstr "Promenite veličinu slike" msgctxt "The label used for the standalone resize options buttons in the image toolbar" msgid "Resize image to %0" -msgstr "" +msgstr "Promenite veličinu slike na% 0" msgctxt "The accessibility label of the standalone image resize reset option button in the image toolbar for the screen readers" msgid "Resize image to the original size" -msgstr "" +msgstr "Promenite veličinu slike do originalne veličine" msgctxt "Default label for the resize option that resets the size of the image." msgid "Original" -msgstr "" +msgstr "Original" msgctxt "The accessibility label of the image resize dropdown list for the screen readers." msgid "Image resize list" -msgstr "" +msgstr "Lista veličine slike" diff --git a/packages/ckeditor5-image/lang/translations/sr.po b/packages/ckeditor5-image/lang/translations/sr.po index f2f4cd4aae7..feda6923156 100644 --- a/packages/ckeditor5-image/lang/translations/sr.po +++ b/packages/ckeditor5-image/lang/translations/sr.po @@ -66,20 +66,20 @@ msgstr "Слика трака са алтакама" msgctxt "The label used for the dropdown in the image toolbar containing defined resize options" msgid "Resize image" -msgstr "" +msgstr "Промените величину слике" msgctxt "The label used for the standalone resize options buttons in the image toolbar" msgid "Resize image to %0" -msgstr "" +msgstr "Промените величину слике на% 0" msgctxt "The accessibility label of the standalone image resize reset option button in the image toolbar for the screen readers" msgid "Resize image to the original size" -msgstr "" +msgstr "Промените величину слике до оригиналне величине" msgctxt "Default label for the resize option that resets the size of the image." msgid "Original" -msgstr "" +msgstr "Оригинал" msgctxt "The accessibility label of the image resize dropdown list for the screen readers." msgid "Image resize list" -msgstr "" +msgstr "Листа величине слике" diff --git a/packages/ckeditor5-image/lang/translations/zh.po b/packages/ckeditor5-image/lang/translations/zh.po index 286dec4a1a8..31cad5e3e54 100644 --- a/packages/ckeditor5-image/lang/translations/zh.po +++ b/packages/ckeditor5-image/lang/translations/zh.po @@ -62,24 +62,24 @@ msgstr "上傳失敗" msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget." msgid "Image toolbar" -msgstr "" +msgstr "圖片工具" msgctxt "The label used for the dropdown in the image toolbar containing defined resize options" msgid "Resize image" -msgstr "" +msgstr "縮放圖片" msgctxt "The label used for the standalone resize options buttons in the image toolbar" msgid "Resize image to %0" -msgstr "" +msgstr "縮放圖片到 %0" msgctxt "The accessibility label of the standalone image resize reset option button in the image toolbar for the screen readers" msgid "Resize image to the original size" -msgstr "" +msgstr "縮放圖片到原始尺寸" msgctxt "Default label for the resize option that resets the size of the image." msgid "Original" -msgstr "" +msgstr "原始圖片" msgctxt "The accessibility label of the image resize dropdown list for the screen readers." msgid "Image resize list" -msgstr "" +msgstr "圖片縮放清單" diff --git a/packages/ckeditor5-image/src/image/imageediting.js b/packages/ckeditor5-image/src/image/imageediting.js index 41bf88a78ff..3ac97ee926c 100644 --- a/packages/ckeditor5-image/src/image/imageediting.js +++ b/packages/ckeditor5-image/src/image/imageediting.js @@ -61,12 +61,12 @@ export default class ImageEditing extends Plugin { conversion.for( 'dataDowncast' ).elementToElement( { model: 'image', - view: ( modelElement, viewWriter ) => createImageViewElement( viewWriter ) + view: ( modelElement, { writer } ) => createImageViewElement( writer ) } ); conversion.for( 'editingDowncast' ).elementToElement( { model: 'image', - view: ( modelElement, viewWriter ) => toImageWidget( createImageViewElement( viewWriter ), viewWriter, t( 'image widget' ) ) + view: ( modelElement, { writer } ) => toImageWidget( createImageViewElement( writer ), writer, t( 'image widget' ) ) } ); conversion.for( 'downcast' ) @@ -82,7 +82,7 @@ export default class ImageEditing extends Plugin { src: true } }, - model: ( viewImage, modelWriter ) => modelWriter.createElement( 'image', { src: viewImage.getAttribute( 'src' ) } ) + model: ( viewImage, { writer } ) => writer.createElement( 'image', { src: viewImage.getAttribute( 'src' ) } ) } ) .attributeToAttribute( { view: { diff --git a/packages/ckeditor5-image/tests/image/converters.js b/packages/ckeditor5-image/tests/image/converters.js index a6b69008722..7f121c05d12 100644 --- a/packages/ckeditor5-image/tests/image/converters.js +++ b/packages/ckeditor5-image/tests/image/converters.js @@ -37,8 +37,8 @@ describe( 'Image converters', () => { isBlock: true } ); - const editingElementCreator = ( modelElement, viewWriter ) => - toImageWidget( createImageViewElement( viewWriter ), viewWriter, '' ); + const editingElementCreator = ( modelElement, { writer } ) => + toImageWidget( createImageViewElement( writer ), writer, '' ); editor.conversion.for( 'editingDowncast' ).elementToElement( { model: 'image', @@ -75,7 +75,7 @@ describe( 'Image converters', () => { src: true } }, - model: ( viewImage, writer ) => { + model: ( viewImage, { writer } ) => { imgConverterCalled = true; return writer.createElement( 'image', { src: viewImage.getAttribute( 'src' ) } ); diff --git a/packages/ckeditor5-indent/lang/translations/ko.po b/packages/ckeditor5-indent/lang/translations/ko.po index 3ee0a45d336..7d220a667e9 100644 --- a/packages/ckeditor5-indent/lang/translations/ko.po +++ b/packages/ckeditor5-indent/lang/translations/ko.po @@ -18,8 +18,8 @@ msgstr "" msgctxt "Toolbar button tooltip for the increase indentation feature." msgid "Increase indent" -msgstr "들여쓰기" +msgstr "들여쓰기 늘리기" msgctxt "Toolbar button tooltip for the decrease indentation feature." msgid "Decrease indent" -msgstr "내어쓰기" +msgstr "들여쓰기 줄이기" diff --git a/packages/ckeditor5-link/lang/translations/ko.po b/packages/ckeditor5-link/lang/translations/ko.po index 632b05b27ca..68edb0d25fc 100644 --- a/packages/ckeditor5-link/lang/translations/ko.po +++ b/packages/ckeditor5-link/lang/translations/ko.po @@ -30,7 +30,7 @@ msgstr "링크 주소" msgctxt "Label for the image link button." msgid "Link image" -msgstr "" +msgstr "사진 링크" msgctxt "Button opening the Link URL editing balloon." msgid "Edit link" diff --git a/packages/ckeditor5-link/lang/translations/zh.po b/packages/ckeditor5-link/lang/translations/zh.po index 1792efe04a4..e436d9e5e09 100644 --- a/packages/ckeditor5-link/lang/translations/zh.po +++ b/packages/ckeditor5-link/lang/translations/zh.po @@ -30,7 +30,7 @@ msgstr "連結˙ URL" msgctxt "Label for the image link button." msgid "Link image" -msgstr "" +msgstr "圖片連結" msgctxt "Button opening the Link URL editing balloon." msgid "Edit link" diff --git a/packages/ckeditor5-link/src/linkediting.js b/packages/ckeditor5-link/src/linkediting.js index d3043545862..17cfa8da618 100644 --- a/packages/ckeditor5-link/src/linkediting.js +++ b/packages/ckeditor5-link/src/linkediting.js @@ -75,8 +75,8 @@ export default class LinkEditing extends Plugin { .attributeToElement( { model: 'linkHref', view: createLinkElement } ); editor.conversion.for( 'editingDowncast' ) - .attributeToElement( { model: 'linkHref', view: ( href, writer ) => { - return createLinkElement( ensureSafeUrl( href ), writer ); + .attributeToElement( { model: 'linkHref', view: ( href, conversionApi ) => { + return createLinkElement( ensureSafeUrl( href ), conversionApi ); } } ); editor.conversion.for( 'upcast' ) @@ -190,7 +190,7 @@ export default class LinkEditing extends Plugin { editor.conversion.for( 'downcast' ).attributeToElement( { model: decorator.id, - view: ( manualDecoratorName, writer ) => { + view: ( manualDecoratorName, { writer } ) => { if ( manualDecoratorName ) { const attributes = manualDecorators.get( decorator.id ).attributes; const element = writer.createAttributeElement( 'a', attributes, { priority: 5 } ); diff --git a/packages/ckeditor5-link/src/utils.js b/packages/ckeditor5-link/src/utils.js index 6c5510cfdf3..3a2c241741b 100644 --- a/packages/ckeditor5-link/src/utils.js +++ b/packages/ckeditor5-link/src/utils.js @@ -31,9 +31,10 @@ export function isLinkElement( node ) { * Creates link {@link module:engine/view/attributeelement~AttributeElement} with the provided `href` attribute. * * @param {String} href + * @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi * @returns {module:engine/view/attributeelement~AttributeElement} */ -export function createLinkElement( href, writer ) { +export function createLinkElement( href, { writer } ) { // Priority 5 - https://github.com/ckeditor/ckeditor5-link/issues/121. const linkElement = writer.createAttributeElement( 'a', { href }, { priority: 5 } ); writer.setCustomProperty( 'link', true, linkElement ); diff --git a/packages/ckeditor5-link/tests/utils.js b/packages/ckeditor5-link/tests/utils.js index d1b3a8a0214..6bb8866873c 100644 --- a/packages/ckeditor5-link/tests/utils.js +++ b/packages/ckeditor5-link/tests/utils.js @@ -15,7 +15,8 @@ import { createLinkElement, isLinkElement, ensureSafeUrl, normalizeDecorators, i describe( 'utils', () => { describe( 'isLinkElement()', () => { it( 'should return true for elements created by createLinkElement', () => { - const element = createLinkElement( 'http://ckeditor.com', new ViewDowncastWriter( new ViewDocument() ) ); + const writer = new ViewDowncastWriter( new ViewDocument() ); + const element = createLinkElement( 'http://ckeditor.com', { writer } ); expect( isLinkElement( element ) ).to.be.true; } ); @@ -35,7 +36,8 @@ describe( 'utils', () => { describe( 'createLinkElement()', () => { it( 'should create link AttributeElement', () => { - const element = createLinkElement( 'http://cksource.com', new ViewDowncastWriter( new ViewDocument() ) ); + const writer = new ViewDowncastWriter( new ViewDocument() ); + const element = createLinkElement( 'http://cksource.com', { writer } ); expect( isLinkElement( element ) ).to.be.true; expect( element.priority ).to.equal( 5 ); diff --git a/packages/ckeditor5-list/lang/translations/ko.po b/packages/ckeditor5-list/lang/translations/ko.po index fc0b33a4375..132c5343f8d 100644 --- a/packages/ckeditor5-list/lang/translations/ko.po +++ b/packages/ckeditor5-list/lang/translations/ko.po @@ -18,12 +18,12 @@ msgstr "" msgctxt "Toolbar button tooltip for the Numbered List feature." msgid "Numbered List" -msgstr "번호매기기" +msgstr "번호 목록" msgctxt "Toolbar button tooltip for the Bulleted List feature." msgid "Bulleted List" -msgstr "글머리기호" +msgstr "불릿 목록" msgctxt "Toolbar button tooltip for the To-do List feature." msgid "To-do List" -msgstr "할일 목록" +msgstr "확인 목록" diff --git a/packages/ckeditor5-list/lang/translations/zh.po b/packages/ckeditor5-list/lang/translations/zh.po index 36cdb7d8457..397fcc722ae 100644 --- a/packages/ckeditor5-list/lang/translations/zh.po +++ b/packages/ckeditor5-list/lang/translations/zh.po @@ -26,4 +26,4 @@ msgstr "符號清單" msgctxt "Toolbar button tooltip for the To-do List feature." msgid "To-do List" -msgstr "" +msgstr "代辦清單" diff --git a/packages/ckeditor5-list/tests/todolistediting.js b/packages/ckeditor5-list/tests/todolistediting.js index 841fe506f74..e93fd6cb5ef 100644 --- a/packages/ckeditor5-list/tests/todolistediting.js +++ b/packages/ckeditor5-list/tests/todolistediting.js @@ -559,12 +559,12 @@ describe( 'TodoListEditing', () => { editor.conversion.for( 'downcast' ).markerToElement( { model: 'element1', - view: ( data, writer ) => writer.createUIElement( 'element1' ) + view: ( data, { writer } ) => writer.createUIElement( 'element1' ) } ); editor.conversion.for( 'downcast' ).markerToElement( { model: 'element2', - view: ( data, writer ) => writer.createUIElement( 'element2' ) + view: ( data, { writer } ) => writer.createUIElement( 'element2' ) } ); editor.conversion.for( 'downcast' ).markerToHighlight( { diff --git a/packages/ckeditor5-media-embed/docs/features/media-embed.md b/packages/ckeditor5-media-embed/docs/features/media-embed.md index b34f244d3cc..e8a0dc3102f 100644 --- a/packages/ckeditor5-media-embed/docs/features/media-embed.md +++ b/packages/ckeditor5-media-embed/docs/features/media-embed.md @@ -10,7 +10,7 @@ The {@link module:media-embed/mediaembed~MediaEmbed} feature brings support for ## Demo -You can use the "Insert media" button in the toolbar to embed media like the following examples. You can also paste the media URL directly into the editor content and it will be [automatically embedded](#automatic-media-embed-on-paste). +You can use the "Insert media" button in the toolbar to embed media like in the following examples. You can also paste the media URL directly into the editor content and it will be [automatically embedded](#automatic-media-embed-on-paste). * * @@ -74,7 +74,7 @@ Thanks to the ability to hardcode this URL to HTML transformation, the media emb ### Non-previewable media -Unfortunately, to show previews of media such as tweets, Instagram photos or Facebook posts, the editor would need to retrieve the content of those from an external service. Some of these media providers expose [oEmbed endpoints](https://oembed.com/) but not all and those endpoint responses often require further processing to be embeddable. Most importantly, though, the media embed feature is often not able to request those services due to [same-origin policy](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy). +Unfortunately, to show previews of media such as tweets, Instagram photos or Facebook posts, the editor would need to retrieve the content of these from an external service. Some of these media providers expose [oEmbed endpoints](https://oembed.com/) but not all and those endpoint responses often require further processing to be embeddable. Most importantly, though, the media embed feature is often not able to request those services due to [same-origin policy](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy). The above limitations can be overcome with the help of proxy services like Iframely or Embedly. However, the media embed feature [does not support asynchronous preview providers](https://github.com/ckeditor/ckeditor5-media-embed/issues/16) yet. Therefore, to still allow embedding tweets or Instagram photos, we chose to: @@ -145,7 +145,7 @@ Names of providers **without previews**: * `'facebook'`. - The default media provider configuration does not support all possible media URLs, only the most common are included. Services like Iframely or Embedly support thousands of media providers and it is up to you to define which you want to allow. + The default media provider configuration does not support all possible media URLs — only the most common are included. Services like Iframely or Embedly support thousands of media providers and it is up to you to define which you want to allow. #### Extending media providers diff --git a/packages/ckeditor5-media-embed/lang/translations/ko.po b/packages/ckeditor5-media-embed/lang/translations/ko.po index 5bba49aff0d..a2c84592199 100644 --- a/packages/ckeditor5-media-embed/lang/translations/ko.po +++ b/packages/ckeditor5-media-embed/lang/translations/ko.po @@ -26,19 +26,19 @@ msgstr "미디어 URL" msgctxt "The help text displayed under the media URL input helping users to discover the interface." msgid "Paste the media URL in the input." -msgstr "미디어 URL을 입력해주세요." +msgstr "미디어의 URL을 입력해주세요." msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding." msgid "Tip: Paste the URL into the content to embed faster." -msgstr "Tip: URL을 복사 후 붙여넣기하면 더 빠릅니다." +msgstr "팁: URL을 붙여넣기하면 더 빨리 삽입할 수 있습니다." msgctxt "An error message that informs about an empty value in the URL input." msgid "The URL must not be empty." -msgstr "URL이 비어있습니다." +msgstr "URL이 비어있을 수 없습니다." msgctxt "An error message that informs about unsupported media URL." msgid "This media URL is not supported." -msgstr "이 URL은 지원되지 않습니다." +msgstr "이 미디어 URL은 지원되지 않습니다." msgctxt "Toolbar button tooltip for the Media Embed feature." msgid "Insert media" diff --git a/packages/ckeditor5-media-embed/lang/translations/zh.po b/packages/ckeditor5-media-embed/lang/translations/zh.po index a169118cb7f..8c70f4086ab 100644 --- a/packages/ckeditor5-media-embed/lang/translations/zh.po +++ b/packages/ckeditor5-media-embed/lang/translations/zh.po @@ -22,23 +22,23 @@ msgstr "影音小工具" msgctxt "Label for the URL input in the Media Embed URL editing balloon." msgid "Media URL" -msgstr "影音URL" +msgstr "影音網址" msgctxt "The help text displayed under the media URL input helping users to discover the interface." msgid "Paste the media URL in the input." -msgstr "在輸入框貼上影音URL。" +msgstr "在輸入框貼上影音網址。" msgctxt "The tip displayed next to the media URL input informing about an easier way of embedding." msgid "Tip: Paste the URL into the content to embed faster." -msgstr "提示:在內容貼上URL更快崁入。" +msgstr "提示:在內容貼上網址更快崁入。" msgctxt "An error message that informs about an empty value in the URL input." msgid "The URL must not be empty." -msgstr "URL不能空白。" +msgstr "網址不能空白。" msgctxt "An error message that informs about unsupported media URL." msgid "This media URL is not supported." -msgstr "影音URL不支援。" +msgstr "不支援此影音網址。" msgctxt "Toolbar button tooltip for the Media Embed feature." msgid "Insert media" @@ -46,4 +46,4 @@ msgstr "插入影音" msgctxt "The label used by assistive technologies describing an image toolbar attached to an image widget." msgid "Media toolbar" -msgstr "" +msgstr "影音工具" diff --git a/packages/ckeditor5-media-embed/src/mediaembedediting.js b/packages/ckeditor5-media-embed/src/mediaembedediting.js index 00cc7907682..beec3b0d1ea 100644 --- a/packages/ckeditor5-media-embed/src/mediaembedediting.js +++ b/packages/ckeditor5-media-embed/src/mediaembedediting.js @@ -177,10 +177,10 @@ export default class MediaEmbedEditing extends Plugin { // Model -> Data conversion.for( 'dataDowncast' ).elementToElement( { model: 'media', - view: ( modelElement, viewWriter ) => { + view: ( modelElement, { writer } ) => { const url = modelElement.getAttribute( 'url' ); - return createMediaFigureElement( viewWriter, registry, url, { + return createMediaFigureElement( writer, registry, url, { renderMediaPreview: url && renderMediaPreview } ); } @@ -195,13 +195,13 @@ export default class MediaEmbedEditing extends Plugin { // Model -> View (element) conversion.for( 'editingDowncast' ).elementToElement( { model: 'media', - view: ( modelElement, viewWriter ) => { + view: ( modelElement, { writer } ) => { const url = modelElement.getAttribute( 'url' ); - const figure = createMediaFigureElement( viewWriter, registry, url, { + const figure = createMediaFigureElement( writer, registry, url, { renderForEditingView: true } ); - return toMediaWidget( figure, viewWriter, t( 'media widget' ) ); + return toMediaWidget( figure, writer, t( 'media widget' ) ); } } ); @@ -221,11 +221,11 @@ export default class MediaEmbedEditing extends Plugin { url: true } }, - model: ( viewMedia, modelWriter ) => { + model: ( viewMedia, { writer } ) => { const url = viewMedia.getAttribute( 'url' ); if ( registry.hasMedia( url ) ) { - return modelWriter.createElement( 'media', { url } ); + return writer.createElement( 'media', { url } ); } } } ) @@ -237,11 +237,11 @@ export default class MediaEmbedEditing extends Plugin { 'data-oembed-url': true } }, - model: ( viewMedia, modelWriter ) => { + model: ( viewMedia, { writer } ) => { const url = viewMedia.getAttribute( 'data-oembed-url' ); if ( registry.hasMedia( url ) ) { - return modelWriter.createElement( 'media', { url } ); + return writer.createElement( 'media', { url } ); } } } ); diff --git a/packages/ckeditor5-media-embed/src/mediaregistry.js b/packages/ckeditor5-media-embed/src/mediaregistry.js index fdb6673dc62..0aa4a8ae12d 100644 --- a/packages/ckeditor5-media-embed/src/mediaregistry.js +++ b/packages/ckeditor5-media-embed/src/mediaregistry.js @@ -59,7 +59,7 @@ export default class MediaRegistry { } ); /** - * The locale {@link module:utils/locale~Locale} instance. + * The {@link module:utils/locale~Locale} instance. * * @member {module:utils/locale~Locale} */ diff --git a/packages/ckeditor5-media-embed/src/utils.js b/packages/ckeditor5-media-embed/src/utils.js index 5adc64323b9..afef27cf8ae 100644 --- a/packages/ckeditor5-media-embed/src/utils.js +++ b/packages/ckeditor5-media-embed/src/utils.js @@ -52,13 +52,13 @@ export function isMediaWidget( viewElement ) { } /** - * Creates a view element representing the media. Either "semantic" one for the data pipeline: + * Creates a view element representing the media. Either a "semantic" one for the data pipeline: * *
    * *
    * - * or "non-semantic" (for the editing view pipeline): + * or a "non-semantic" (for the editing view pipeline): * *
    *
    [ non-semantic media preview for "foo" ]
    @@ -104,7 +104,7 @@ export function getSelectedMediaModelWidget( selection ) { * * @param {module:engine/model/model~Model} model * @param {String} url An URL of an embeddable media. - * @param {module:engine/model/position~Position} [insertPosition] Position to insert media. If not specified, + * @param {module:engine/model/position~Position} [insertPosition] Position to insert the media. If not specified, * the default behavior of {@link module:engine/model/model~Model#insertContent `model.insertContent()`} will * be applied. */ diff --git a/packages/ckeditor5-mention/docs/_snippets/examples/chat-with-mentions.js b/packages/ckeditor5-mention/docs/_snippets/examples/chat-with-mentions.js index ab05ec0854d..41746724c88 100644 --- a/packages/ckeditor5-mention/docs/_snippets/examples/chat-with-mentions.js +++ b/packages/ckeditor5-mention/docs/_snippets/examples/chat-with-mentions.js @@ -127,7 +127,7 @@ function MentionLinks( editor ) { // element. editor.conversion.for( 'downcast' ).attributeToElement( { model: 'mention', - view: ( modelAttributeValue, viewWriter ) => { + view: ( modelAttributeValue, { writer } ) => { // Do not convert empty attributes (lack of value means no mention). if ( !modelAttributeValue ) { return; @@ -142,7 +142,7 @@ function MentionLinks( editor ) { href = `https://example.com/social/${ modelAttributeValue.id.slice( 1 ) }`; } - return viewWriter.createAttributeElement( 'a', { + return writer.createAttributeElement( 'a', { class: 'mention', 'data-mention': modelAttributeValue.id, href diff --git a/packages/ckeditor5-mention/docs/_snippets/features/mention-customization.js b/packages/ckeditor5-mention/docs/_snippets/features/mention-customization.js index a28e132e00e..e51d0f0bcd5 100644 --- a/packages/ckeditor5-mention/docs/_snippets/features/mention-customization.js +++ b/packages/ckeditor5-mention/docs/_snippets/features/mention-customization.js @@ -68,13 +68,13 @@ function MentionCustomization( editor ) { // Downcast the model 'mention' text attribute to a view element. editor.conversion.for( 'downcast' ).attributeToElement( { model: 'mention', - view: ( modelAttributeValue, viewWriter ) => { + view: ( modelAttributeValue, { writer } ) => { // Do not convert empty attributes (lack of value means no mention). if ( !modelAttributeValue ) { return; } - return viewWriter.createAttributeElement( 'a', { + return writer.createAttributeElement( 'a', { class: 'mention', 'data-mention': modelAttributeValue.id, 'data-user-id': modelAttributeValue.userId, diff --git a/packages/ckeditor5-mention/docs/examples/chat-with-mentions.md b/packages/ckeditor5-mention/docs/examples/chat-with-mentions.md index 1a041ee14e7..7019d8a150b 100644 --- a/packages/ckeditor5-mention/docs/examples/chat-with-mentions.md +++ b/packages/ckeditor5-mention/docs/examples/chat-with-mentions.md @@ -308,7 +308,7 @@ function MentionLinks( editor ) { // element. editor.conversion.for( 'downcast' ).attributeToElement( { model: 'mention', - view: ( modelAttributeValue, viewWriter ) => { + view: ( modelAttributeValue, { writer } ) => { // Do not convert empty attributes (lack of value means no mention). if ( !modelAttributeValue ) { return; @@ -323,7 +323,7 @@ function MentionLinks( editor ) { href = `https://example.com/social/${ modelAttributeValue.id.slice( 1 ) }`; } - return viewWriter.createAttributeElement( 'a', { + return writer.createAttributeElement( 'a', { class: 'mention', 'data-mention': modelAttributeValue.id, href diff --git a/packages/ckeditor5-mention/docs/features/mentions.md b/packages/ckeditor5-mention/docs/features/mentions.md index da7debd40a5..51e9557e15f 100644 --- a/packages/ckeditor5-mention/docs/features/mentions.md +++ b/packages/ckeditor5-mention/docs/features/mentions.md @@ -23,8 +23,9 @@ You can type the "@" character to invoke the mention autocomplete UI. The demo b In addition to enabling mentions, you may want to check the following productivity features: -* {@link features/text-transformation Automatic text transformation} – It allows to automatically turn snippets such as `(tm)` into `™` and `"foo"` into `“foo”`. -* {@link features/autoformat Autoformatting} – It allows to quickly apply formatting to the content you are writing. +* {@link features/text-transformation Automatic text transformation} – Allows to automatically turn snippets such as `(tm)` into `™` and `"foo"` into `“foo”`. +* {@link features/link#autolink-feature Autolink} – Turns the links and email addresses typed or pasted into the editor into active URLs. +* {@link features/autoformat Autoformatting} – Allows to quickly apply formatting to the content you are writing. ## Configuration @@ -247,13 +248,13 @@ function MentionCustomization( editor ) { // Downcast the model 'mention' text attribute to a view element. editor.conversion.for( 'downcast' ).attributeToElement( { model: 'mention', - view: ( modelAttributeValue, viewWriter ) => { + view: ( modelAttributeValue, { writer } ) => { // Do not convert empty attributes (lack of value means no mention). if ( !modelAttributeValue ) { return; } - return viewWriter.createAttributeElement( 'a', { + return writer.createAttributeElement( 'a', { class: 'mention', 'data-mention': modelAttributeValue.id, 'data-user-id': modelAttributeValue.userId, @@ -339,13 +340,13 @@ function MentionCustomization( editor ) { // Downcast the model 'mention' text attribute to a view element. editor.conversion.for( 'downcast' ).attributeToElement( { model: 'mention', - view: ( modelAttributeValue, viewWriter ) => { + view: ( modelAttributeValue, { writer } ) => { // Do not convert empty attributes (lack of value means no mention). if ( !modelAttributeValue ) { return; } - return viewWriter.createAttributeElement( 'a', { + return writer.createAttributeElement( 'a', { class: 'mention', 'data-mention': modelAttributeValue.id, 'data-user-id': modelAttributeValue.userId, diff --git a/packages/ckeditor5-mention/src/mentionediting.js b/packages/ckeditor5-mention/src/mentionediting.js index ee4d6c18e48..4f6e67a06a3 100644 --- a/packages/ckeditor5-mention/src/mentionediting.js +++ b/packages/ckeditor5-mention/src/mentionediting.js @@ -129,9 +129,9 @@ function preventPartialMentionDowncast( dispatcher ) { // Creates a mention element from the mention data. // // @param {Object} mention -// @param {module:engine/view/downcastwriter~DowncastWriter} viewWriter +// @param {module:engine/conversion/downcastdispatcher~DowncastConversionApi} conversionApi // @returns {module:engine/view/attributeelement~AttributeElement} -function createViewMentionElement( mention, viewWriter ) { +function createViewMentionElement( mention, { writer } ) { if ( !mention ) { return; } @@ -146,7 +146,7 @@ function createViewMentionElement( mention, viewWriter ) { priority: 20 }; - return viewWriter.createAttributeElement( 'span', attributes, options ); + return writer.createAttributeElement( 'span', attributes, options ); } // Model post-fixer that disallows typing with selection when the selection is placed after the text node with the mention attribute or diff --git a/packages/ckeditor5-mention/tests/manual/mention-custom-view.js b/packages/ckeditor5-mention/tests/manual/mention-custom-view.js index 7caf2e9f0a4..635ddb87a17 100644 --- a/packages/ckeditor5-mention/tests/manual/mention-custom-view.js +++ b/packages/ckeditor5-mention/tests/manual/mention-custom-view.js @@ -41,12 +41,12 @@ class CustomMentionAttributeView extends Plugin { editor.conversion.for( 'downcast' ).attributeToElement( { model: 'mention', - view: ( modelAttributeValue, viewWriter ) => { + view: ( modelAttributeValue, { writer } ) => { if ( !modelAttributeValue ) { return; } - return viewWriter.createAttributeElement( 'a', { + return writer.createAttributeElement( 'a', { class: 'mention', 'data-mention': modelAttributeValue.id, 'href': modelAttributeValue.link diff --git a/packages/ckeditor5-mention/tests/manual/mention.js b/packages/ckeditor5-mention/tests/manual/mention.js index dd77886ed74..4c85094f64d 100644 --- a/packages/ckeditor5-mention/tests/manual/mention.js +++ b/packages/ckeditor5-mention/tests/manual/mention.js @@ -30,10 +30,10 @@ class InlineWidget extends Plugin { editor.conversion.for( 'editingDowncast' ).elementToElement( { model: 'placeholder', - view: ( modelItem, viewWriter ) => { - const widgetElement = createPlaceholderView( modelItem, viewWriter ); + view: ( modelItem, conversionApi ) => { + const widgetElement = createPlaceholderView( modelItem, conversionApi ); - return toWidget( widgetElement, viewWriter ); + return toWidget( widgetElement, conversionApi.writer ); } } ); @@ -66,11 +66,11 @@ class InlineWidget extends Plugin { this._createToolbarButton(); - function createPlaceholderView( modelItem, viewWriter ) { - const widgetElement = viewWriter.createContainerElement( 'placeholder' ); - const viewText = viewWriter.createText( '{' + modelItem.getAttribute( 'type' ) + '}' ); + function createPlaceholderView( modelItem, { writer } ) { + const widgetElement = writer.createContainerElement( 'placeholder' ); + const viewText = writer.createText( '{' + modelItem.getAttribute( 'type' ) + '}' ); - viewWriter.insert( viewWriter.createPositionAt( widgetElement, 0 ), viewText ); + writer.insert( writer.createPositionAt( widgetElement, 0 ), viewText ); return widgetElement; } diff --git a/packages/ckeditor5-mention/tests/mentionediting.js b/packages/ckeditor5-mention/tests/mentionediting.js index c1b5b26172c..0408a3ca0b5 100644 --- a/packages/ckeditor5-mention/tests/mentionediting.js +++ b/packages/ckeditor5-mention/tests/mentionediting.js @@ -188,12 +188,12 @@ describe( 'MentionEditing', () => { editor.conversion.for( 'downcast' ).attributeToElement( { model: 'mention', - view: ( modelAttributeValue, viewWriter ) => { + view: ( modelAttributeValue, { writer } ) => { if ( !modelAttributeValue ) { return; } - return viewWriter.createAttributeElement( 'a', { + return writer.createAttributeElement( 'a', { class: 'mention', 'data-mention': modelAttributeValue.id, 'href': modelAttributeValue.link @@ -672,12 +672,12 @@ function addCustomMentionConverters( editor ) { editor.conversion.for( 'downcast' ).attributeToElement( { model: 'mention', - view: ( modelAttributeValue, viewWriter ) => { + view: ( modelAttributeValue, { writer } ) => { if ( !modelAttributeValue ) { return; } - return viewWriter.createAttributeElement( 'b', { + return writer.createAttributeElement( 'b', { class: 'mention', 'data-mention': modelAttributeValue.id }, { diff --git a/packages/ckeditor5-mention/tests/mentionui.js b/packages/ckeditor5-mention/tests/mentionui.js index 578319f0019..ce99d5b5dcc 100644 --- a/packages/ckeditor5-mention/tests/mentionui.js +++ b/packages/ckeditor5-mention/tests/mentionui.js @@ -566,7 +566,7 @@ describe( 'MentionUI', () => { editor.conversion.for( 'downcast' ) .elementToElement( { model: 'softBreak', - view: ( modelElement, viewWriter ) => viewWriter.createEmptyElement( 'br' ) + view: ( modelElement, { writer } ) => writer.createEmptyElement( 'br' ) } ); setData( model, 'abc[] foo' ); diff --git a/packages/ckeditor5-page-break/lang/translations/zh.po b/packages/ckeditor5-page-break/lang/translations/zh.po new file mode 100644 index 00000000000..a73b7282928 --- /dev/null +++ b/packages/ckeditor5-page-break/lang/translations/zh.po @@ -0,0 +1,21 @@ +# Copyright (c) 2003-2020, 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: Chinese (Taiwan) (https://www.transifex.com/ckeditor/teams/11143/zh_TW/)\n" +"Language: zh_TW\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "Page break" +msgid "Page break" +msgstr "換頁" diff --git a/packages/ckeditor5-page-break/src/pagebreakediting.js b/packages/ckeditor5-page-break/src/pagebreakediting.js index 313902c9411..1e5e4bbffdf 100644 --- a/packages/ckeditor5-page-break/src/pagebreakediting.js +++ b/packages/ckeditor5-page-break/src/pagebreakediting.js @@ -42,8 +42,8 @@ export default class PageBreakEditing extends Plugin { conversion.for( 'dataDowncast' ).elementToElement( { model: 'pageBreak', - view: ( modelElement, viewWriter ) => { - const divElement = viewWriter.createContainerElement( 'div', { + view: ( modelElement, { writer } ) => { + const divElement = writer.createContainerElement( 'div', { class: 'page-break', // If user has no `.ck-content` styles, it should always break a page during print. style: 'page-break-after: always' @@ -51,11 +51,11 @@ export default class PageBreakEditing extends Plugin { // For a rationale of using span inside a div see: // https://github.com/ckeditor/ckeditor5-page-break/pull/1#discussion_r328934062. - const spanElement = viewWriter.createContainerElement( 'span', { + const spanElement = writer.createContainerElement( 'span', { style: 'display: none' } ); - viewWriter.insert( viewWriter.createPositionAt( divElement, 0 ), spanElement ); + writer.insert( writer.createPositionAt( divElement, 0 ), spanElement ); return divElement; } @@ -63,21 +63,21 @@ export default class PageBreakEditing extends Plugin { conversion.for( 'editingDowncast' ).elementToElement( { model: 'pageBreak', - view: ( modelElement, viewWriter ) => { + view: ( modelElement, { writer } ) => { const label = t( 'Page break' ); - const viewWrapper = viewWriter.createContainerElement( 'div' ); - const viewLabelElement = viewWriter.createContainerElement( 'span' ); - const innerText = viewWriter.createText( t( 'Page break' ) ); + const viewWrapper = writer.createContainerElement( 'div' ); + const viewLabelElement = writer.createContainerElement( 'span' ); + const innerText = writer.createText( t( 'Page break' ) ); - viewWriter.addClass( 'page-break', viewWrapper ); - viewWriter.setCustomProperty( 'pageBreak', true, viewWrapper ); + writer.addClass( 'page-break', viewWrapper ); + writer.setCustomProperty( 'pageBreak', true, viewWrapper ); - viewWriter.addClass( 'page-break__label', viewLabelElement ); + writer.addClass( 'page-break__label', viewLabelElement ); - viewWriter.insert( viewWriter.createPositionAt( viewWrapper, 0 ), viewLabelElement ); - viewWriter.insert( viewWriter.createPositionAt( viewLabelElement, 0 ), innerText ); + writer.insert( writer.createPositionAt( viewWrapper, 0 ), viewLabelElement ); + writer.insert( writer.createPositionAt( viewLabelElement, 0 ), innerText ); - return toPageBreakWidget( viewWrapper, viewWriter, label ); + return toPageBreakWidget( viewWrapper, writer, label ); } } ); diff --git a/packages/ckeditor5-paragraph/src/paragraph.js b/packages/ckeditor5-paragraph/src/paragraph.js index 1e6bee029c0..fde35067843 100644 --- a/packages/ckeditor5-paragraph/src/paragraph.js +++ b/packages/ckeditor5-paragraph/src/paragraph.js @@ -40,7 +40,6 @@ export default class Paragraph extends Plugin { init() { const editor = this.editor; const model = editor.model; - const data = editor.data; editor.commands.add( 'paragraph', new ParagraphCommand( editor ) ); editor.commands.add( 'insertParagraph', new InsertParagraphCommand( editor ) ); @@ -50,12 +49,9 @@ export default class Paragraph extends Plugin { editor.conversion.elementToElement( { model: 'paragraph', view: 'p' } ); - // Content autoparagraphing. -------------------------------------------------- - - // Handles element which has not been converted by any plugin and checks if it would be converted if - // we wrap it in a paragraph or change it to a paragraph. + // Conversion for paragraph-like elements which has not been converted by any plugin. editor.conversion.for( 'upcast' ).elementToElement( { - model: ( viewElement, modelWriter ) => { + model: ( viewElement, { writer } ) => { if ( !Paragraph.paragraphLikeElements.has( viewElement.name ) ) { return null; } @@ -65,69 +61,11 @@ export default class Paragraph extends Plugin { return null; } - return modelWriter.createElement( 'paragraph' ); + return writer.createElement( 'paragraph' ); }, view: /.+/, converterPriority: 'low' } ); - - data.upcastDispatcher.on( 'element', ( evt, data, conversionApi ) => { - // Do not try auto-paragraphing if the element was already converted. - if ( !conversionApi.consumable.test( data.viewItem, { name: data.viewItem.name } ) ) { - return; - } - - // If the element is not paragraph-like try wrapping it in a paragraph. - if ( isParagraphable( data.viewItem, data.modelCursor, conversionApi.schema ) ) { - Object.assign( data, wrapInParagraph( data.viewItem, data.modelCursor, conversionApi ) ); - } - }, { priority: 'low' } ); - - // Handles not converted text nodes and checks if would be converted if we wraps then by a paragraph. - data.upcastDispatcher.on( 'text', ( evt, data, conversionApi ) => { - // When node is already converted then do nothing. - if ( data.modelRange ) { - return; - } - - if ( isParagraphable( data.viewItem, data.modelCursor, conversionApi.schema ) ) { - Object.assign( data, wrapInParagraph( data.viewItem, data.modelCursor, conversionApi ) ); - } - }, { priority: 'lowest' } ); - - // Empty roots autoparagraphing. ----------------------------------------------- - - // Post-fixer which takes care of adding empty paragraph elements to empty roots. - // Besides fixing content on #changesDone we also need to handle editor.data#ready event because - // if initial data is empty or setData() wasn't even called there will be no #change fired. - model.document.registerPostFixer( writer => this._autoparagraphEmptyRoots( writer ) ); - - editor.data.on( 'ready', () => { - model.enqueueChange( 'transparent', writer => this._autoparagraphEmptyRoots( writer ) ); - }, { priority: 'lowest' } ); - } - - /** - * Fixes all empty roots. - * - * @private - * @returns {Boolean} `true` if any change has been applied, `false` otherwise. - */ - _autoparagraphEmptyRoots( writer ) { - const model = this.editor.model; - - for ( const rootName of model.document.getRootNames() ) { - const root = model.document.getRoot( rootName ); - - if ( root.isEmpty && root.rootName != '$graveyard' ) { - // If paragraph element is allowed in the root, create paragraph element. - if ( model.schema.checkChild( root, 'paragraph' ) ) { - writer.insertElement( 'paragraph', root ); - - return true; - } - } - } } } @@ -175,28 +113,6 @@ Paragraph.paragraphLikeElements = new Set( [ 'h6', 'li', 'p', - 'td' + 'td', + 'th' ] ); - -function wrapInParagraph( input, position, conversionApi ) { - const paragraph = conversionApi.writer.createElement( 'paragraph' ); - - conversionApi.writer.insert( paragraph, position ); - return conversionApi.convertItem( input, conversionApi.writer.createPositionAt( paragraph, 0 ) ); -} - -function isParagraphable( node, position, schema ) { - const context = schema.createContext( position ); - - // When paragraph is allowed in this context... - if ( !schema.checkChild( context, 'paragraph' ) ) { - return false; - } - - // And a node would be allowed in this paragraph... - if ( !schema.checkChild( context.push( 'paragraph' ), node ) ) { - return false; - } - - return true; -} diff --git a/packages/ckeditor5-paragraph/tests/paragraph.js b/packages/ckeditor5-paragraph/tests/paragraph.js index ea62ce79a56..062913914dd 100644 --- a/packages/ckeditor5-paragraph/tests/paragraph.js +++ b/packages/ckeditor5-paragraph/tests/paragraph.js @@ -76,18 +76,31 @@ describe( 'Paragraph feature', () => { } ); it( 'should autoparagraph any inline element', () => { - editor.model.schema.register( 'span', { allowWhere: '$text' } ); - editor.model.schema.extend( '$text', { allowIn: 'span' } ); + editor.model.schema.register( 'inline', { allowWhere: '$text' } ); + editor.model.schema.extend( '$text', { allowIn: 'inline' } ); - editor.conversion.for( 'downcast' ).elementToElement( { model: 'span', view: 'span' } ); - editor.conversion.for( 'upcast' ).elementToElement( { model: 'span', view: 'span' } ); + editor.conversion.for( 'downcast' ).elementToElement( { model: 'inline', view: 'span' } ); + editor.conversion.for( 'upcast' ).elementToElement( { model: 'inline', view: 'span' } ); editor.setData( 'foo' ); - expect( getModelData( model, { withoutSelection: true } ) ).to.equal( 'foo' ); + expect( getModelData( model, { withoutSelection: true } ) ).to.equal( 'foo' ); expect( editor.getData() ).to.equal( '

    foo

    ' ); } ); + it( 'should autoparagraph any inline element with children', () => { + editor.model.schema.register( 'inline', { allowWhere: '$text' } ); + editor.model.schema.extend( '$text', { allowIn: 'inline' } ); + + editor.conversion.for( 'downcast' ).elementToElement( { model: 'inline', view: 'span' } ); + editor.conversion.for( 'upcast' ).elementToElement( { model: 'inline', view: 'span' } ); + + editor.setData( 'f123oo' ); + + expect( getModelData( model, { withoutSelection: true } ) ).to.equal( 'f123oo' ); + expect( editor.getData() ).to.equal( '

    f123oo

    ' ); + } ); + it( 'should not autoparagraph text (in clipboard holder)', () => { const modelFragment = editor.data.parse( 'foo', [ '$clipboardHolder' ] ); diff --git a/packages/ckeditor5-restricted-editing/lang/translations/ko.po b/packages/ckeditor5-restricted-editing/lang/translations/ko.po new file mode 100644 index 00000000000..f862c691ac5 --- /dev/null +++ b/packages/ckeditor5-restricted-editing/lang/translations/ko.po @@ -0,0 +1,37 @@ +# Copyright (c) 2003-2020, 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: Korean (https://www.transifex.com/ckeditor/teams/11143/ko/)\n" +"Language: ko\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "A label of the button indicating that using this button will make a selected text non–editable." +msgid "Disable editing" +msgstr "편집 비활성화" + +msgctxt "A label of the button indicating that using this button will make a selected text editable." +msgid "Enable editing" +msgstr "편집 활성화" + +msgctxt "A label of the button that moves selection to the previous editable region in the content." +msgid "Previous editable region" +msgstr "이전 편집 가능한 구역" + +msgctxt "A label of the button that moves selection to the next editable region in the content." +msgid "Next editable region" +msgstr "다음 편집 가능한 구역" + +msgctxt "A label of the dropdown that provides controls to navigate editable regions in the content." +msgid "Navigate editable regions" +msgstr "편집 가능한 구역 탐색" diff --git a/packages/ckeditor5-restricted-editing/lang/translations/zh.po b/packages/ckeditor5-restricted-editing/lang/translations/zh.po new file mode 100644 index 00000000000..2fe1179af8c --- /dev/null +++ b/packages/ckeditor5-restricted-editing/lang/translations/zh.po @@ -0,0 +1,37 @@ +# Copyright (c) 2003-2020, 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: Chinese (Taiwan) (https://www.transifex.com/ckeditor/teams/11143/zh_TW/)\n" +"Language: zh_TW\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "A label of the button indicating that using this button will make a selected text non–editable." +msgid "Disable editing" +msgstr "停用編輯" + +msgctxt "A label of the button indicating that using this button will make a selected text editable." +msgid "Enable editing" +msgstr "啟用編輯" + +msgctxt "A label of the button that moves selection to the previous editable region in the content." +msgid "Previous editable region" +msgstr "上一個可編輯區域" + +msgctxt "A label of the button that moves selection to the next editable region in the content." +msgid "Next editable region" +msgstr "下一個可編輯區域" + +msgctxt "A label of the dropdown that provides controls to navigate editable regions in the content." +msgid "Navigate editable regions" +msgstr "編輯區域導航" diff --git a/packages/ckeditor5-restricted-editing/src/restrictededitingmodeediting.js b/packages/ckeditor5-restricted-editing/src/restrictededitingmodeediting.js index 1e47e64e1e0..2c60d329932 100644 --- a/packages/ckeditor5-restricted-editing/src/restrictededitingmodeediting.js +++ b/packages/ckeditor5-restricted-editing/src/restrictededitingmodeediting.js @@ -161,8 +161,8 @@ export default class RestrictedEditingModeEditing extends Plugin { // Additionally the editing pipeline should always display a collapsed markers. editor.conversion.for( 'editingDowncast' ).markerToElement( { model: 'restrictedEditingException', - view: ( markerData, viewWriter ) => { - return viewWriter.createUIElement( 'span', { + view: ( markerData, { writer } ) => { + return writer.createUIElement( 'span', { class: 'restricted-editing-exception restricted-editing-exception_collapsed' } ); } @@ -170,8 +170,8 @@ export default class RestrictedEditingModeEditing extends Plugin { editor.conversion.for( 'dataDowncast' ).markerToElement( { model: 'restrictedEditingException', - view: ( markerData, viewWriter ) => { - return viewWriter.createEmptyElement( 'span', { + view: ( markerData, { writer } ) => { + return writer.createEmptyElement( 'span', { class: 'restricted-editing-exception' } ); } diff --git a/packages/ckeditor5-restricted-editing/src/standardeditingmodeediting.js b/packages/ckeditor5-restricted-editing/src/standardeditingmodeediting.js index 85498f63692..f17967d71f0 100644 --- a/packages/ckeditor5-restricted-editing/src/standardeditingmodeediting.js +++ b/packages/ckeditor5-restricted-editing/src/standardeditingmodeediting.js @@ -45,10 +45,10 @@ export default class StandardEditingModeEditing extends Plugin { editor.conversion.for( 'downcast' ).attributeToElement( { model: 'restrictedEditingException', - view: ( modelAttributeValue, viewWriter ) => { + view: ( modelAttributeValue, { writer } ) => { if ( modelAttributeValue ) { // Make the restricted editing outer-most in the view. - return viewWriter.createAttributeElement( 'span', { class: 'restricted-editing-exception' }, { priority: -10 } ); + return writer.createAttributeElement( 'span', { class: 'restricted-editing-exception' }, { priority: -10 } ); } } } ); diff --git a/packages/ckeditor5-select-all/lang/translations/zh.po b/packages/ckeditor5-select-all/lang/translations/zh.po new file mode 100644 index 00000000000..3dbd7f11a4e --- /dev/null +++ b/packages/ckeditor5-select-all/lang/translations/zh.po @@ -0,0 +1,21 @@ +# Copyright (c) 2003-2020, 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: Chinese (Taiwan) (https://www.transifex.com/ckeditor/teams/11143/zh_TW/)\n" +"Language: zh_TW\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "The label of the select all toolbar button." +msgid "Select all" +msgstr "選取全部" diff --git a/packages/ckeditor5-special-characters/lang/translations/ko.po b/packages/ckeditor5-special-characters/lang/translations/ko.po new file mode 100644 index 00000000000..ba1ce72ee52 --- /dev/null +++ b/packages/ckeditor5-special-characters/lang/translations/ko.po @@ -0,0 +1,1037 @@ +# Copyright (c) 2003-2020, 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: Korean (https://www.transifex.com/ckeditor/teams/11143/ko/)\n" +"Language: ko\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "Name of the special characters plugins, visible in a dropdown and as a button tooltip." +msgid "Special characters" +msgstr "특수 문자" + +msgctxt "A label for the \"leftwards double arrow\" symbol." +msgid "leftwards double arrow" +msgstr "" + +msgctxt "A label for the \"rightwards double arrow\" symbol." +msgid "rightwards double arrow" +msgstr "" + +msgctxt "A label for the \"upwards double arrow\" symbol." +msgid "upwards double arrow" +msgstr "" + +msgctxt "A label for the \"downwards double arrow\" symbol." +msgid "downwards double arrow" +msgstr "" + +msgctxt "A label for the \"leftwards dashed arrow\" symbol." +msgid "leftwards dashed arrow" +msgstr "" + +msgctxt "A label for the \"rightwards dashed arrow\" symbol." +msgid "rightwards dashed arrow" +msgstr "" + +msgctxt "A label for the \"upwards dashed arrow\" symbol." +msgid "upwards dashed arrow" +msgstr "" + +msgctxt "A label for the \"downwards dashed arrow\" symbol." +msgid "downwards dashed arrow" +msgstr "" + +msgctxt "A label for the \"leftwards arrow to bar\" symbol." +msgid "leftwards arrow to bar" +msgstr "" + +msgctxt "A label for the \"rightwards arrow to bar\" symbol." +msgid "rightwards arrow to bar" +msgstr "" + +msgctxt "A label for the \"upwards arrow to bar\" symbol." +msgid "upwards arrow to bar" +msgstr "" + +msgctxt "A label for the \"downwards arrow to bar\" symbol." +msgid "downwards arrow to bar" +msgstr "" + +msgctxt "A label for the \"up down arrow with base\" symbol." +msgid "up down arrow with base" +msgstr "" + +msgctxt "A label for the \"back with leftwards arrow above\" symbol." +msgid "back with leftwards arrow above" +msgstr "" + +msgctxt "A label for the \"end with leftwards arrow above\" symbol." +msgid "end with leftwards arrow above" +msgstr "" + +msgctxt "A label for the \"on with exclamation mark with left right arrow above\" symbol." +msgid "on with exclamation mark with left right arrow above" +msgstr "" + +msgctxt "A label for the \"soon with rightwards arrow above\" symbol." +msgid "soon with rightwards arrow above" +msgstr "" + +msgctxt "A label for the \"top with upwards arrow above\" symbol." +msgid "top with upwards arrow above" +msgstr "" + +msgctxt "A label for the \"dollar sign\" symbol." +msgid "Dollar sign" +msgstr "" + +msgctxt "A label for the \"euro sign\" symbol." +msgid "Euro sign" +msgstr "" + +msgctxt "A label for the \"yen sign\" symbol." +msgid "Yen sign" +msgstr "" + +msgctxt "A label for the \"pound sign\" symbol." +msgid "Pound sign" +msgstr "" + +msgctxt "A label for the \"cent sign\" symbol." +msgid "Cent sign" +msgstr "" + +msgctxt "A label for the \"euro-currency sign\" symbol." +msgid "Euro-currency sign" +msgstr "" + +msgctxt "A label for the \"colon sign\" symbol." +msgid "Colon sign" +msgstr "" + +msgctxt "A label for the \"cruzeiro sign\" symbol." +msgid "Cruzeiro sign" +msgstr "" + +msgctxt "A label for the \"french franc sign\" symbol." +msgid "French franc sign" +msgstr "" + +msgctxt "A label for the \"lira sign\" symbol." +msgid "Lira sign" +msgstr "" + +msgctxt "A label for the \"currency sign\" symbol." +msgid "Currency sign" +msgstr "" + +msgctxt "A label for the \"bitcoin sign\" symbol." +msgid "Bitcoin sign" +msgstr "" + +msgctxt "A label for the \"mill sign\" symbol." +msgid "Mill sign" +msgstr "" + +msgctxt "A label for the \"naira sign\" symbol." +msgid "Naira sign" +msgstr "" + +msgctxt "A label for the \"peseta sign\" symbol." +msgid "Peseta sign" +msgstr "" + +msgctxt "A label for the \"rupee sign\" symbol." +msgid "Rupee sign" +msgstr "" + +msgctxt "A label for the \"won sign\" symbol." +msgid "Won sign" +msgstr "" + +msgctxt "A label for the \"new sheqel sign\" symbol." +msgid "New sheqel sign" +msgstr "" + +msgctxt "A label for the \"dong sign\" symbol." +msgid "Dong sign" +msgstr "" + +msgctxt "A label for the \"kip sign\" symbol." +msgid "Kip sign" +msgstr "" + +msgctxt "A label for the \"tugrik sign\" symbol." +msgid "Tugrik sign" +msgstr "" + +msgctxt "A label for the \"drachma sign\" symbol." +msgid "Drachma sign" +msgstr "" + +msgctxt "A label for the \"german penny sign\" symbol." +msgid "German penny sign" +msgstr "" + +msgctxt "A label for the \"peso sign\" symbol." +msgid "Peso sign" +msgstr "" + +msgctxt "A label for the \"guarani sign\" symbol." +msgid "Guarani sign" +msgstr "" + +msgctxt "A label for the \"austral sign\" symbol." +msgid "Austral sign" +msgstr "" + +msgctxt "A label for the \"hryvnia sign\" symbol." +msgid "Hryvnia sign" +msgstr "" + +msgctxt "A label for the \"cedi sign\" symbol." +msgid "Cedi sign" +msgstr "" + +msgctxt "A label for the \"livre tournois sign\" symbol." +msgid "Livre tournois sign" +msgstr "" + +msgctxt "A label for the \"spesmilo sign\" symbol." +msgid "Spesmilo sign" +msgstr "" + +msgctxt "A label for the \"tenge sign\" symbol." +msgid "Tenge sign" +msgstr "" + +msgctxt "A label for the \"indian rupee sign\" symbol." +msgid "Indian rupee sign" +msgstr "" + +msgctxt "A label for the \"turkish lira sign\" symbol." +msgid "Turkish lira sign" +msgstr "" + +msgctxt "A label for the \"nordic mark sign\" symbol." +msgid "Nordic mark sign" +msgstr "" + +msgctxt "A label for the \"manat sign\" symbol." +msgid "Manat sign" +msgstr "" + +msgctxt "A label for the \"ruble sign\" symbol." +msgid "Ruble sign" +msgstr "" + +msgctxt "A label for the \"latin capital letter a with macron\" symbol." +msgid "Latin capital letter a with macron" +msgstr "" + +msgctxt "A label for the \"latin small letter a with macron\" symbol." +msgid "Latin small letter a with macron" +msgstr "" + +msgctxt "A label for the \"latin capital letter a with breve\" symbol." +msgid "Latin capital letter a with breve" +msgstr "" + +msgctxt "A label for the \"latin small letter a with breve\" symbol." +msgid "Latin small letter a with breve" +msgstr "" + +msgctxt "A label for the \"latin capital letter a with ogonek\" symbol." +msgid "Latin capital letter a with ogonek" +msgstr "" + +msgctxt "A label for the \"latin small letter a with ogonek\" symbol." +msgid "Latin small letter a with ogonek" +msgstr "" + +msgctxt "A label for the \"latin capital letter c with acute\" symbol." +msgid "Latin capital letter c with acute" +msgstr "" + +msgctxt "A label for the \"latin small letter c with acute\" symbol." +msgid "Latin small letter c with acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter c with circumflex\" symbol." +msgid "Latin capital letter c with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter c with circumflex\" symbol." +msgid "Latin small letter c with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter c with dot above\" symbol." +msgid "Latin capital letter c with dot above" +msgstr "" + +msgctxt "A label for the \"latin small letter c with dot above\" symbol." +msgid "Latin small letter c with dot above" +msgstr "" + +msgctxt "A label for the \"latin capital letter c with caron\" symbol." +msgid "Latin capital letter c with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter c with caron\" symbol." +msgid "Latin small letter c with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter d with caron\" symbol." +msgid "Latin capital letter d with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter d with caron\" symbol." +msgid "Latin small letter d with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter d with stroke\" symbol." +msgid "Latin capital letter d with stroke" +msgstr "" + +msgctxt "A label for the \"latin small letter d with stroke\" symbol." +msgid "Latin small letter d with stroke" +msgstr "" + +msgctxt "A label for the \"latin capital letter e with macron\" symbol." +msgid "Latin capital letter e with macron" +msgstr "" + +msgctxt "A label for the \"latin small letter e with macron\" symbol." +msgid "Latin small letter e with macron" +msgstr "" + +msgctxt "A label for the \"latin capital letter e with breve\" symbol." +msgid "Latin capital letter e with breve" +msgstr "" + +msgctxt "A label for the \"latin small letter e with breve\" symbol." +msgid "Latin small letter e with breve" +msgstr "" + +msgctxt "A label for the \"latin capital letter e with dot above\" symbol." +msgid "Latin capital letter e with dot above" +msgstr "" + +msgctxt "A label for the \"latin small letter e with dot above\" symbol." +msgid "Latin small letter e with dot above" +msgstr "" + +msgctxt "A label for the \"latin capital letter e with ogonek\" symbol." +msgid "Latin capital letter e with ogonek" +msgstr "" + +msgctxt "A label for the \"latin small letter e with ogonek\" symbol." +msgid "Latin small letter e with ogonek" +msgstr "" + +msgctxt "A label for the \"latin capital letter e with caron\" symbol." +msgid "Latin capital letter e with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter e with caron\" symbol." +msgid "Latin small letter e with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter g with circumflex\" symbol." +msgid "Latin capital letter g with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter g with circumflex\" symbol." +msgid "Latin small letter g with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter g with breve\" symbol." +msgid "Latin capital letter g with breve" +msgstr "" + +msgctxt "A label for the \"latin small letter g with breve\" symbol." +msgid "Latin small letter g with breve" +msgstr "" + +msgctxt "A label for the \"latin capital letter g with dot above\" symbol." +msgid "Latin capital letter g with dot above" +msgstr "" + +msgctxt "A label for the \"latin small letter g with dot above\" symbol." +msgid "Latin small letter g with dot above" +msgstr "" + +msgctxt "A label for the \"latin capital letter g with cedilla\" symbol." +msgid "Latin capital letter g with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter g with cedilla\" symbol." +msgid "Latin small letter g with cedilla" +msgstr "" + +msgctxt "A label for the \"latin capital letter h with circumflex\" symbol." +msgid "Latin capital letter h with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter h with circumflex\" symbol." +msgid "Latin small letter h with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter h with stroke\" symbol." +msgid "Latin capital letter h with stroke" +msgstr "" + +msgctxt "A label for the \"latin small letter h with stroke\" symbol." +msgid "Latin small letter h with stroke" +msgstr "" + +msgctxt "A label for the \"latin capital letter i with tilde\" symbol." +msgid "Latin capital letter i with tilde" +msgstr "" + +msgctxt "A label for the \"latin small letter i with tilde\" symbol." +msgid "Latin small letter i with tilde" +msgstr "" + +msgctxt "A label for the \"latin capital letter i with macron\" symbol." +msgid "Latin capital letter i with macron" +msgstr "" + +msgctxt "A label for the \"latin small letter i with macron\" symbol." +msgid "Latin small letter i with macron" +msgstr "" + +msgctxt "A label for the \"latin capital letter i with breve\" symbol." +msgid "Latin capital letter i with breve" +msgstr "" + +msgctxt "A label for the \"latin small letter i with breve\" symbol." +msgid "Latin small letter i with breve" +msgstr "" + +msgctxt "A label for the \"latin capital letter i with ogonek\" symbol." +msgid "Latin capital letter i with ogonek" +msgstr "" + +msgctxt "A label for the \"latin small letter i with ogonek\" symbol." +msgid "Latin small letter i with ogonek" +msgstr "" + +msgctxt "A label for the \"latin capital letter i with dot above\" symbol." +msgid "Latin capital letter i with dot above" +msgstr "" + +msgctxt "A label for the \"latin small letter dotless i\" symbol." +msgid "Latin small letter dotless i" +msgstr "" + +msgctxt "A label for the \"latin capital ligature ij\" symbol." +msgid "Latin capital ligature ij" +msgstr "" + +msgctxt "A label for the \"latin small ligature ij\" symbol." +msgid "Latin small ligature ij" +msgstr "" + +msgctxt "A label for the \"latin capital letter j with circumflex\" symbol." +msgid "Latin capital letter j with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter j with circumflex\" symbol." +msgid "Latin small letter j with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter k with cedilla\" symbol." +msgid "Latin capital letter k with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter k with cedilla\" symbol." +msgid "Latin small letter k with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter kra\" symbol." +msgid "Latin small letter kra" +msgstr "" + +msgctxt "A label for the \"latin capital letter l with acute\" symbol." +msgid "Latin capital letter l with acute" +msgstr "" + +msgctxt "A label for the \"latin small letter l with acute\" symbol." +msgid "Latin small letter l with acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter l with cedilla\" symbol." +msgid "Latin capital letter l with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter l with cedilla\" symbol." +msgid "Latin small letter l with cedilla" +msgstr "" + +msgctxt "A label for the \"latin capital letter l with caron\" symbol." +msgid "Latin capital letter l with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter l with caron\" symbol." +msgid "Latin small letter l with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter l with middle dot\" symbol." +msgid "Latin capital letter l with middle dot" +msgstr "" + +msgctxt "A label for the \"latin small letter l with middle dot\" symbol." +msgid "Latin small letter l with middle dot" +msgstr "" + +msgctxt "A label for the \"latin capital letter l with stroke\" symbol." +msgid "Latin capital letter l with stroke" +msgstr "" + +msgctxt "A label for the \"latin small letter l with stroke\" symbol." +msgid "Latin small letter l with stroke" +msgstr "" + +msgctxt "A label for the \"latin capital letter n with acute\" symbol." +msgid "Latin capital letter n with acute" +msgstr "" + +msgctxt "A label for the \"latin small letter n with acute\" symbol." +msgid "Latin small letter n with acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter n with cedilla\" symbol." +msgid "Latin capital letter n with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter n with cedilla\" symbol." +msgid "Latin small letter n with cedilla" +msgstr "" + +msgctxt "A label for the \"latin capital letter n with caron\" symbol." +msgid "Latin capital letter n with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter n with caron\" symbol." +msgid "Latin small letter n with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter n preceded by apostrophe\" symbol." +msgid "Latin small letter n preceded by apostrophe" +msgstr "" + +msgctxt "A label for the \"latin capital letter eng\" symbol." +msgid "Latin capital letter eng" +msgstr "" + +msgctxt "A label for the \"latin small letter eng\" symbol." +msgid "Latin small letter eng" +msgstr "" + +msgctxt "A label for the \"latin capital letter o with macron\" symbol." +msgid "Latin capital letter o with macron" +msgstr "" + +msgctxt "A label for the \"latin small letter o with macron\" symbol." +msgid "Latin small letter o with macron" +msgstr "" + +msgctxt "A label for the \"latin capital letter o with breve\" symbol." +msgid "Latin capital letter o with breve" +msgstr "" + +msgctxt "A label for the \"latin small letter o with breve\" symbol." +msgid "Latin small letter o with breve" +msgstr "" + +msgctxt "A label for the \"latin capital letter o with double acute\" symbol." +msgid "Latin capital letter o with double acute" +msgstr "" + +msgctxt "A label for the \"latin small letter o with double acute\" symbol." +msgid "Latin small letter o with double acute" +msgstr "" + +msgctxt "A label for the \"latin capital ligature oe\" symbol." +msgid "Latin capital ligature oe" +msgstr "" + +msgctxt "A label for the \"latin small ligature oe\" symbol." +msgid "Latin small ligature oe" +msgstr "" + +msgctxt "A label for the \"latin capital letter r with acute\" symbol." +msgid "Latin capital letter r with acute" +msgstr "" + +msgctxt "A label for the \"latin small letter r with acute\" symbol." +msgid "Latin small letter r with acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter r with cedilla\" symbol." +msgid "Latin capital letter r with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter r with cedilla\" symbol." +msgid "Latin small letter r with cedilla" +msgstr "" + +msgctxt "A label for the \"latin capital letter r with caron\" symbol." +msgid "Latin capital letter r with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter r with caron\" symbol." +msgid "Latin small letter r with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter s with acute\" symbol." +msgid "Latin capital letter s with acute" +msgstr "" + +msgctxt "A label for the \"latin small letter s with acute\" symbol." +msgid "Latin small letter s with acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter s with circumflex\" symbol." +msgid "Latin capital letter s with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter s with circumflex\" symbol." +msgid "Latin small letter s with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter s with cedilla\" symbol." +msgid "Latin capital letter s with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter s with cedilla\" symbol." +msgid "Latin small letter s with cedilla" +msgstr "" + +msgctxt "A label for the \"latin capital letter s with caron\" symbol." +msgid "Latin capital letter s with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter s with caron\" symbol." +msgid "Latin small letter s with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter t with cedilla\" symbol." +msgid "Latin capital letter t with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter t with cedilla\" symbol." +msgid "Latin small letter t with cedilla" +msgstr "" + +msgctxt "A label for the \"latin capital letter t with caron\" symbol." +msgid "Latin capital letter t with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter t with caron\" symbol." +msgid "Latin small letter t with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter t with stroke\" symbol." +msgid "Latin capital letter t with stroke" +msgstr "" + +msgctxt "A label for the \"latin small letter t with stroke\" symbol." +msgid "Latin small letter t with stroke" +msgstr "" + +msgctxt "A label for the \"latin capital letter u with tilde\" symbol." +msgid "Latin capital letter u with tilde" +msgstr "" + +msgctxt "A label for the \"latin small letter u with tilde\" symbol." +msgid "Latin small letter u with tilde" +msgstr "" + +msgctxt "A label for the \"latin capital letter u with macron\" symbol." +msgid "Latin capital letter u with macron" +msgstr "" + +msgctxt "A label for the \"latin small letter u with macron\" symbol." +msgid "Latin small letter u with macron" +msgstr "" + +msgctxt "A label for the \"latin capital letter u with breve\" symbol." +msgid "Latin capital letter u with breve" +msgstr "" + +msgctxt "A label for the \"latin small letter u with breve\" symbol." +msgid "Latin small letter u with breve" +msgstr "" + +msgctxt "A label for the \"latin capital letter u with ring above\" symbol." +msgid "Latin capital letter u with ring above" +msgstr "" + +msgctxt "A label for the \"latin small letter u with ring above\" symbol." +msgid "Latin small letter u with ring above" +msgstr "" + +msgctxt "A label for the \"latin capital letter u with double acute\" symbol." +msgid "Latin capital letter u with double acute" +msgstr "" + +msgctxt "A label for the \"latin small letter u with double acute\" symbol." +msgid "Latin small letter u with double acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter u with ogonek\" symbol." +msgid "Latin capital letter u with ogonek" +msgstr "" + +msgctxt "A label for the \"latin small letter u with ogonek\" symbol." +msgid "Latin small letter u with ogonek" +msgstr "" + +msgctxt "A label for the \"latin capital letter w with circumflex\" symbol." +msgid "Latin capital letter w with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter w with circumflex\" symbol." +msgid "Latin small letter w with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter y with circumflex\" symbol." +msgid "Latin capital letter y with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter y with circumflex\" symbol." +msgid "Latin small letter y with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter y with diaeresis\" symbol." +msgid "Latin capital letter y with diaeresis" +msgstr "" + +msgctxt "A label for the \"latin capital letter z with acute\" symbol." +msgid "Latin capital letter z with acute" +msgstr "" + +msgctxt "A label for the \"latin small letter z with acute\" symbol." +msgid "Latin small letter z with acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter z with dot above\" symbol." +msgid "Latin capital letter z with dot above" +msgstr "" + +msgctxt "A label for the \"latin small letter z with dot above\" symbol." +msgid "Latin small letter z with dot above" +msgstr "" + +msgctxt "A label for the \"latin capital letter z with caron\" symbol." +msgid "Latin capital letter z with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter z with caron\" symbol." +msgid "Latin small letter z with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter long s\" symbol." +msgid "Latin small letter long s" +msgstr "" + +msgctxt "A label for the \"less-than sign\" symbol." +msgid "Less-than sign" +msgstr "" + +msgctxt "A label for the \"greater-than sign\" symbol." +msgid "Greater-than sign" +msgstr "" + +msgctxt "A label for the \"less-than or equal to\" symbol." +msgid "Less-than or equal to" +msgstr "" + +msgctxt "A label for the \"greater-than or equal to\" symbol." +msgid "Greater-than or equal to" +msgstr "" + +msgctxt "A label for the \"en dash\" symbol." +msgid "En dash" +msgstr "" + +msgctxt "A label for the \"em dash\" symbol." +msgid "Em dash" +msgstr "" + +msgctxt "A label for the \"macron\" symbol." +msgid "Macron" +msgstr "" + +msgctxt "A label for the \"overline\" symbol." +msgid "Overline" +msgstr "" + +msgctxt "A label for the \"degree sign\" symbol." +msgid "Degree sign" +msgstr "" + +msgctxt "A label for the \"minus sign\" symbol." +msgid "Minus sign" +msgstr "" + +msgctxt "A label for the \"plus-minus sign\" symbol." +msgid "Plus-minus sign" +msgstr "" + +msgctxt "A label for the \"division sign\" symbol." +msgid "Division sign" +msgstr "" + +msgctxt "A label for the \"fraction slash\" symbol." +msgid "Fraction slash" +msgstr "" + +msgctxt "A label for the \"multiplication sign\" symbol." +msgid "Multiplication sign" +msgstr "" + +msgctxt "A label for the \"latin small letter f with hook\" symbol." +msgid "Latin small letter f with hook" +msgstr "" + +msgctxt "A label for the \"integral\" symbol." +msgid "Integral" +msgstr "" + +msgctxt "A label for the \"n-ary summation\" symbol." +msgid "N-ary summation" +msgstr "" + +msgctxt "A label for the \"infinity\" symbol." +msgid "Infinity" +msgstr "" + +msgctxt "A label for the \"square root\" symbol." +msgid "Square root" +msgstr "" + +msgctxt "A label for the \"tilde operator\" symbol." +msgid "Tilde operator" +msgstr "" + +msgctxt "A label for the \"approximately equal to\" symbol." +msgid "Approximately equal to" +msgstr "" + +msgctxt "A label for the \"almost equal to\" symbol." +msgid "Almost equal to" +msgstr "" + +msgctxt "A label for the \"not equal to\" symbol." +msgid "Not equal to" +msgstr "" + +msgctxt "A label for the \"identical to\" symbol." +msgid "Identical to" +msgstr "" + +msgctxt "A label for the \"element of\" symbol." +msgid "Element of" +msgstr "" + +msgctxt "A label for the \"not an element of\" symbol." +msgid "Not an element of" +msgstr "" + +msgctxt "A label for the \"contains as member\" symbol." +msgid "Contains as member" +msgstr "" + +msgctxt "A label for the \"n-ary product\" symbol." +msgid "N-ary product" +msgstr "" + +msgctxt "A label for the \"logical and\" symbol." +msgid "Logical and" +msgstr "" + +msgctxt "A label for the \"logical or\" symbol." +msgid "Logical or" +msgstr "" + +msgctxt "A label for the \"not sign\" symbol." +msgid "Not sign" +msgstr "" + +msgctxt "A label for the \"intersection\" symbol." +msgid "Intersection" +msgstr "" + +msgctxt "A label for the \"union\" symbol." +msgid "Union" +msgstr "" + +msgctxt "A label for the \"partial differential\" symbol." +msgid "Partial differential" +msgstr "" + +msgctxt "A label for the \"for all\" symbol." +msgid "For all" +msgstr "" + +msgctxt "A label for the \"there exists\" symbol." +msgid "There exists" +msgstr "" + +msgctxt "A label for the \"empty set\" symbol." +msgid "Empty set" +msgstr "" + +msgctxt "A label for the \"nabla\" symbol." +msgid "Nabla" +msgstr "" + +msgctxt "A label for the \"asterisk operator\" symbol." +msgid "Asterisk operator" +msgstr "" + +msgctxt "A label for the \"proportional to\" symbol." +msgid "Proportional to" +msgstr "" + +msgctxt "A label for the \"angle\" symbol." +msgid "Angle" +msgstr "" + +msgctxt "A label for the \"vulgar fraction one quarter\" symbol." +msgid "Vulgar fraction one quarter" +msgstr "" + +msgctxt "A label for the \"vulgar fraction one half\" symbol." +msgid "Vulgar fraction one half" +msgstr "" + +msgctxt "A label for the \"vulgar fraction three quarters\" symbol." +msgid "Vulgar fraction three quarters" +msgstr "" + +msgctxt "A label for the \"single left-pointing angle quotation mark\" symbol." +msgid "Single left-pointing angle quotation mark" +msgstr "" + +msgctxt "A label for the \"single right-pointing angle quotation mark\" symbol." +msgid "Single right-pointing angle quotation mark" +msgstr "" + +msgctxt "A label for the \"left-pointing double angle quotation mark\" symbol." +msgid "Left-pointing double angle quotation mark" +msgstr "" + +msgctxt "A label for the \"right-pointing double angle quotation mark\" symbol." +msgid "Right-pointing double angle quotation mark" +msgstr "" + +msgctxt "A label for the \"left single quotation mark\" symbol." +msgid "Left single quotation mark" +msgstr "" + +msgctxt "A label for the \"right single quotation mark\" symbol." +msgid "Right single quotation mark" +msgstr "" + +msgctxt "A label for the \"left double quotation mark\" symbol." +msgid "Left double quotation mark" +msgstr "" + +msgctxt "A label for the \"right double quotation mark\" symbol." +msgid "Right double quotation mark" +msgstr "" + +msgctxt "A label for the \"single low-9 quotation mark\" symbol." +msgid "Single low-9 quotation mark" +msgstr "" + +msgctxt "A label for the \"double low-9 quotation mark\" symbol." +msgid "Double low-9 quotation mark" +msgstr "" + +msgctxt "A label for the \"inverted exclamation mark\" symbol." +msgid "Inverted exclamation mark" +msgstr "" + +msgctxt "A label for the \"inverted question mark\" symbol." +msgid "Inverted question mark" +msgstr "" + +msgctxt "A label for the \"two dot leader\" symbol." +msgid "Two dot leader" +msgstr "" + +msgctxt "A label for the \"horizontal ellipsis\" symbol." +msgid "Horizontal ellipsis" +msgstr "" + +msgctxt "A label for the \"double dagger\" symbol." +msgid "Double dagger" +msgstr "" + +msgctxt "A label for the \"per mille sign\" symbol." +msgid "Per mille sign" +msgstr "" + +msgctxt "A label for the \"per ten thousand sign\" symbol." +msgid "Per ten thousand sign" +msgstr "" + +msgctxt "A label for the \"double exclamation mark\" symbol." +msgid "Double exclamation mark" +msgstr "" + +msgctxt "A label for the \"question exclamation mark\" symbol." +msgid "Question exclamation mark" +msgstr "" + +msgctxt "A label for the \"exclamation question mark\" symbol." +msgid "Exclamation question mark" +msgstr "" + +msgctxt "A label for the \"double question mark\" symbol." +msgid "Double question mark" +msgstr "" + +msgctxt "A label for the \"copyright sign\" symbol." +msgid "Copyright sign" +msgstr "" + +msgctxt "A label for the \"registered sign\" symbol." +msgid "Registered sign" +msgstr "" + +msgctxt "A label for the \"trade mark sign\" symbol." +msgid "Trade mark sign" +msgstr "" + +msgctxt "A label for the \"section sign\" symbol." +msgid "Section sign" +msgstr "" + +msgctxt "A label for the \"paragraph sign\" symbol." +msgid "Paragraph sign" +msgstr "" + +msgctxt "A label for the \"reversed paragraph sign\" symbol." +msgid "Reversed paragraph sign" +msgstr "" + +msgctxt "A label for a tooltip showing when the user hovers over the plugin icon." +msgid "Character categories" +msgstr "" diff --git a/packages/ckeditor5-special-characters/lang/translations/zh.po b/packages/ckeditor5-special-characters/lang/translations/zh.po new file mode 100644 index 00000000000..47a9165c955 --- /dev/null +++ b/packages/ckeditor5-special-characters/lang/translations/zh.po @@ -0,0 +1,1037 @@ +# Copyright (c) 2003-2020, 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: Chinese (Taiwan) (https://www.transifex.com/ckeditor/teams/11143/zh_TW/)\n" +"Language: zh_TW\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "Name of the special characters plugins, visible in a dropdown and as a button tooltip." +msgid "Special characters" +msgstr "特殊字元" + +msgctxt "A label for the \"leftwards double arrow\" symbol." +msgid "leftwards double arrow" +msgstr "向左雙箭頭" + +msgctxt "A label for the \"rightwards double arrow\" symbol." +msgid "rightwards double arrow" +msgstr "向右雙箭頭" + +msgctxt "A label for the \"upwards double arrow\" symbol." +msgid "upwards double arrow" +msgstr "向上雙箭頭" + +msgctxt "A label for the \"downwards double arrow\" symbol." +msgid "downwards double arrow" +msgstr "向下雙箭頭" + +msgctxt "A label for the \"leftwards dashed arrow\" symbol." +msgid "leftwards dashed arrow" +msgstr "向左虛線箭頭" + +msgctxt "A label for the \"rightwards dashed arrow\" symbol." +msgid "rightwards dashed arrow" +msgstr "向右虛線箭頭" + +msgctxt "A label for the \"upwards dashed arrow\" symbol." +msgid "upwards dashed arrow" +msgstr "向上虛線箭頭" + +msgctxt "A label for the \"downwards dashed arrow\" symbol." +msgid "downwards dashed arrow" +msgstr "向下虛線箭頭" + +msgctxt "A label for the \"leftwards arrow to bar\" symbol." +msgid "leftwards arrow to bar" +msgstr "向左停止箭頭" + +msgctxt "A label for the \"rightwards arrow to bar\" symbol." +msgid "rightwards arrow to bar" +msgstr "向右停止箭頭" + +msgctxt "A label for the \"upwards arrow to bar\" symbol." +msgid "upwards arrow to bar" +msgstr "向上停止箭頭" + +msgctxt "A label for the \"downwards arrow to bar\" symbol." +msgid "downwards arrow to bar" +msgstr "向下停止箭頭" + +msgctxt "A label for the \"up down arrow with base\" symbol." +msgid "up down arrow with base" +msgstr "" + +msgctxt "A label for the \"back with leftwards arrow above\" symbol." +msgid "back with leftwards arrow above" +msgstr "" + +msgctxt "A label for the \"end with leftwards arrow above\" symbol." +msgid "end with leftwards arrow above" +msgstr "" + +msgctxt "A label for the \"on with exclamation mark with left right arrow above\" symbol." +msgid "on with exclamation mark with left right arrow above" +msgstr "" + +msgctxt "A label for the \"soon with rightwards arrow above\" symbol." +msgid "soon with rightwards arrow above" +msgstr "" + +msgctxt "A label for the \"top with upwards arrow above\" symbol." +msgid "top with upwards arrow above" +msgstr "" + +msgctxt "A label for the \"dollar sign\" symbol." +msgid "Dollar sign" +msgstr "" + +msgctxt "A label for the \"euro sign\" symbol." +msgid "Euro sign" +msgstr "" + +msgctxt "A label for the \"yen sign\" symbol." +msgid "Yen sign" +msgstr "" + +msgctxt "A label for the \"pound sign\" symbol." +msgid "Pound sign" +msgstr "" + +msgctxt "A label for the \"cent sign\" symbol." +msgid "Cent sign" +msgstr "" + +msgctxt "A label for the \"euro-currency sign\" symbol." +msgid "Euro-currency sign" +msgstr "" + +msgctxt "A label for the \"colon sign\" symbol." +msgid "Colon sign" +msgstr "" + +msgctxt "A label for the \"cruzeiro sign\" symbol." +msgid "Cruzeiro sign" +msgstr "" + +msgctxt "A label for the \"french franc sign\" symbol." +msgid "French franc sign" +msgstr "" + +msgctxt "A label for the \"lira sign\" symbol." +msgid "Lira sign" +msgstr "" + +msgctxt "A label for the \"currency sign\" symbol." +msgid "Currency sign" +msgstr "" + +msgctxt "A label for the \"bitcoin sign\" symbol." +msgid "Bitcoin sign" +msgstr "" + +msgctxt "A label for the \"mill sign\" symbol." +msgid "Mill sign" +msgstr "" + +msgctxt "A label for the \"naira sign\" symbol." +msgid "Naira sign" +msgstr "" + +msgctxt "A label for the \"peseta sign\" symbol." +msgid "Peseta sign" +msgstr "" + +msgctxt "A label for the \"rupee sign\" symbol." +msgid "Rupee sign" +msgstr "" + +msgctxt "A label for the \"won sign\" symbol." +msgid "Won sign" +msgstr "" + +msgctxt "A label for the \"new sheqel sign\" symbol." +msgid "New sheqel sign" +msgstr "" + +msgctxt "A label for the \"dong sign\" symbol." +msgid "Dong sign" +msgstr "" + +msgctxt "A label for the \"kip sign\" symbol." +msgid "Kip sign" +msgstr "" + +msgctxt "A label for the \"tugrik sign\" symbol." +msgid "Tugrik sign" +msgstr "" + +msgctxt "A label for the \"drachma sign\" symbol." +msgid "Drachma sign" +msgstr "" + +msgctxt "A label for the \"german penny sign\" symbol." +msgid "German penny sign" +msgstr "" + +msgctxt "A label for the \"peso sign\" symbol." +msgid "Peso sign" +msgstr "" + +msgctxt "A label for the \"guarani sign\" symbol." +msgid "Guarani sign" +msgstr "" + +msgctxt "A label for the \"austral sign\" symbol." +msgid "Austral sign" +msgstr "" + +msgctxt "A label for the \"hryvnia sign\" symbol." +msgid "Hryvnia sign" +msgstr "" + +msgctxt "A label for the \"cedi sign\" symbol." +msgid "Cedi sign" +msgstr "" + +msgctxt "A label for the \"livre tournois sign\" symbol." +msgid "Livre tournois sign" +msgstr "" + +msgctxt "A label for the \"spesmilo sign\" symbol." +msgid "Spesmilo sign" +msgstr "" + +msgctxt "A label for the \"tenge sign\" symbol." +msgid "Tenge sign" +msgstr "" + +msgctxt "A label for the \"indian rupee sign\" symbol." +msgid "Indian rupee sign" +msgstr "" + +msgctxt "A label for the \"turkish lira sign\" symbol." +msgid "Turkish lira sign" +msgstr "" + +msgctxt "A label for the \"nordic mark sign\" symbol." +msgid "Nordic mark sign" +msgstr "" + +msgctxt "A label for the \"manat sign\" symbol." +msgid "Manat sign" +msgstr "" + +msgctxt "A label for the \"ruble sign\" symbol." +msgid "Ruble sign" +msgstr "" + +msgctxt "A label for the \"latin capital letter a with macron\" symbol." +msgid "Latin capital letter a with macron" +msgstr "" + +msgctxt "A label for the \"latin small letter a with macron\" symbol." +msgid "Latin small letter a with macron" +msgstr "" + +msgctxt "A label for the \"latin capital letter a with breve\" symbol." +msgid "Latin capital letter a with breve" +msgstr "" + +msgctxt "A label for the \"latin small letter a with breve\" symbol." +msgid "Latin small letter a with breve" +msgstr "" + +msgctxt "A label for the \"latin capital letter a with ogonek\" symbol." +msgid "Latin capital letter a with ogonek" +msgstr "" + +msgctxt "A label for the \"latin small letter a with ogonek\" symbol." +msgid "Latin small letter a with ogonek" +msgstr "" + +msgctxt "A label for the \"latin capital letter c with acute\" symbol." +msgid "Latin capital letter c with acute" +msgstr "" + +msgctxt "A label for the \"latin small letter c with acute\" symbol." +msgid "Latin small letter c with acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter c with circumflex\" symbol." +msgid "Latin capital letter c with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter c with circumflex\" symbol." +msgid "Latin small letter c with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter c with dot above\" symbol." +msgid "Latin capital letter c with dot above" +msgstr "" + +msgctxt "A label for the \"latin small letter c with dot above\" symbol." +msgid "Latin small letter c with dot above" +msgstr "" + +msgctxt "A label for the \"latin capital letter c with caron\" symbol." +msgid "Latin capital letter c with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter c with caron\" symbol." +msgid "Latin small letter c with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter d with caron\" symbol." +msgid "Latin capital letter d with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter d with caron\" symbol." +msgid "Latin small letter d with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter d with stroke\" symbol." +msgid "Latin capital letter d with stroke" +msgstr "" + +msgctxt "A label for the \"latin small letter d with stroke\" symbol." +msgid "Latin small letter d with stroke" +msgstr "" + +msgctxt "A label for the \"latin capital letter e with macron\" symbol." +msgid "Latin capital letter e with macron" +msgstr "" + +msgctxt "A label for the \"latin small letter e with macron\" symbol." +msgid "Latin small letter e with macron" +msgstr "" + +msgctxt "A label for the \"latin capital letter e with breve\" symbol." +msgid "Latin capital letter e with breve" +msgstr "" + +msgctxt "A label for the \"latin small letter e with breve\" symbol." +msgid "Latin small letter e with breve" +msgstr "" + +msgctxt "A label for the \"latin capital letter e with dot above\" symbol." +msgid "Latin capital letter e with dot above" +msgstr "" + +msgctxt "A label for the \"latin small letter e with dot above\" symbol." +msgid "Latin small letter e with dot above" +msgstr "" + +msgctxt "A label for the \"latin capital letter e with ogonek\" symbol." +msgid "Latin capital letter e with ogonek" +msgstr "" + +msgctxt "A label for the \"latin small letter e with ogonek\" symbol." +msgid "Latin small letter e with ogonek" +msgstr "" + +msgctxt "A label for the \"latin capital letter e with caron\" symbol." +msgid "Latin capital letter e with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter e with caron\" symbol." +msgid "Latin small letter e with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter g with circumflex\" symbol." +msgid "Latin capital letter g with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter g with circumflex\" symbol." +msgid "Latin small letter g with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter g with breve\" symbol." +msgid "Latin capital letter g with breve" +msgstr "" + +msgctxt "A label for the \"latin small letter g with breve\" symbol." +msgid "Latin small letter g with breve" +msgstr "" + +msgctxt "A label for the \"latin capital letter g with dot above\" symbol." +msgid "Latin capital letter g with dot above" +msgstr "" + +msgctxt "A label for the \"latin small letter g with dot above\" symbol." +msgid "Latin small letter g with dot above" +msgstr "" + +msgctxt "A label for the \"latin capital letter g with cedilla\" symbol." +msgid "Latin capital letter g with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter g with cedilla\" symbol." +msgid "Latin small letter g with cedilla" +msgstr "" + +msgctxt "A label for the \"latin capital letter h with circumflex\" symbol." +msgid "Latin capital letter h with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter h with circumflex\" symbol." +msgid "Latin small letter h with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter h with stroke\" symbol." +msgid "Latin capital letter h with stroke" +msgstr "" + +msgctxt "A label for the \"latin small letter h with stroke\" symbol." +msgid "Latin small letter h with stroke" +msgstr "" + +msgctxt "A label for the \"latin capital letter i with tilde\" symbol." +msgid "Latin capital letter i with tilde" +msgstr "" + +msgctxt "A label for the \"latin small letter i with tilde\" symbol." +msgid "Latin small letter i with tilde" +msgstr "" + +msgctxt "A label for the \"latin capital letter i with macron\" symbol." +msgid "Latin capital letter i with macron" +msgstr "" + +msgctxt "A label for the \"latin small letter i with macron\" symbol." +msgid "Latin small letter i with macron" +msgstr "" + +msgctxt "A label for the \"latin capital letter i with breve\" symbol." +msgid "Latin capital letter i with breve" +msgstr "" + +msgctxt "A label for the \"latin small letter i with breve\" symbol." +msgid "Latin small letter i with breve" +msgstr "" + +msgctxt "A label for the \"latin capital letter i with ogonek\" symbol." +msgid "Latin capital letter i with ogonek" +msgstr "" + +msgctxt "A label for the \"latin small letter i with ogonek\" symbol." +msgid "Latin small letter i with ogonek" +msgstr "" + +msgctxt "A label for the \"latin capital letter i with dot above\" symbol." +msgid "Latin capital letter i with dot above" +msgstr "" + +msgctxt "A label for the \"latin small letter dotless i\" symbol." +msgid "Latin small letter dotless i" +msgstr "" + +msgctxt "A label for the \"latin capital ligature ij\" symbol." +msgid "Latin capital ligature ij" +msgstr "" + +msgctxt "A label for the \"latin small ligature ij\" symbol." +msgid "Latin small ligature ij" +msgstr "" + +msgctxt "A label for the \"latin capital letter j with circumflex\" symbol." +msgid "Latin capital letter j with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter j with circumflex\" symbol." +msgid "Latin small letter j with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter k with cedilla\" symbol." +msgid "Latin capital letter k with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter k with cedilla\" symbol." +msgid "Latin small letter k with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter kra\" symbol." +msgid "Latin small letter kra" +msgstr "" + +msgctxt "A label for the \"latin capital letter l with acute\" symbol." +msgid "Latin capital letter l with acute" +msgstr "" + +msgctxt "A label for the \"latin small letter l with acute\" symbol." +msgid "Latin small letter l with acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter l with cedilla\" symbol." +msgid "Latin capital letter l with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter l with cedilla\" symbol." +msgid "Latin small letter l with cedilla" +msgstr "" + +msgctxt "A label for the \"latin capital letter l with caron\" symbol." +msgid "Latin capital letter l with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter l with caron\" symbol." +msgid "Latin small letter l with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter l with middle dot\" symbol." +msgid "Latin capital letter l with middle dot" +msgstr "" + +msgctxt "A label for the \"latin small letter l with middle dot\" symbol." +msgid "Latin small letter l with middle dot" +msgstr "" + +msgctxt "A label for the \"latin capital letter l with stroke\" symbol." +msgid "Latin capital letter l with stroke" +msgstr "" + +msgctxt "A label for the \"latin small letter l with stroke\" symbol." +msgid "Latin small letter l with stroke" +msgstr "" + +msgctxt "A label for the \"latin capital letter n with acute\" symbol." +msgid "Latin capital letter n with acute" +msgstr "" + +msgctxt "A label for the \"latin small letter n with acute\" symbol." +msgid "Latin small letter n with acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter n with cedilla\" symbol." +msgid "Latin capital letter n with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter n with cedilla\" symbol." +msgid "Latin small letter n with cedilla" +msgstr "" + +msgctxt "A label for the \"latin capital letter n with caron\" symbol." +msgid "Latin capital letter n with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter n with caron\" symbol." +msgid "Latin small letter n with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter n preceded by apostrophe\" symbol." +msgid "Latin small letter n preceded by apostrophe" +msgstr "" + +msgctxt "A label for the \"latin capital letter eng\" symbol." +msgid "Latin capital letter eng" +msgstr "" + +msgctxt "A label for the \"latin small letter eng\" symbol." +msgid "Latin small letter eng" +msgstr "" + +msgctxt "A label for the \"latin capital letter o with macron\" symbol." +msgid "Latin capital letter o with macron" +msgstr "" + +msgctxt "A label for the \"latin small letter o with macron\" symbol." +msgid "Latin small letter o with macron" +msgstr "" + +msgctxt "A label for the \"latin capital letter o with breve\" symbol." +msgid "Latin capital letter o with breve" +msgstr "" + +msgctxt "A label for the \"latin small letter o with breve\" symbol." +msgid "Latin small letter o with breve" +msgstr "" + +msgctxt "A label for the \"latin capital letter o with double acute\" symbol." +msgid "Latin capital letter o with double acute" +msgstr "" + +msgctxt "A label for the \"latin small letter o with double acute\" symbol." +msgid "Latin small letter o with double acute" +msgstr "" + +msgctxt "A label for the \"latin capital ligature oe\" symbol." +msgid "Latin capital ligature oe" +msgstr "" + +msgctxt "A label for the \"latin small ligature oe\" symbol." +msgid "Latin small ligature oe" +msgstr "" + +msgctxt "A label for the \"latin capital letter r with acute\" symbol." +msgid "Latin capital letter r with acute" +msgstr "" + +msgctxt "A label for the \"latin small letter r with acute\" symbol." +msgid "Latin small letter r with acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter r with cedilla\" symbol." +msgid "Latin capital letter r with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter r with cedilla\" symbol." +msgid "Latin small letter r with cedilla" +msgstr "" + +msgctxt "A label for the \"latin capital letter r with caron\" symbol." +msgid "Latin capital letter r with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter r with caron\" symbol." +msgid "Latin small letter r with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter s with acute\" symbol." +msgid "Latin capital letter s with acute" +msgstr "" + +msgctxt "A label for the \"latin small letter s with acute\" symbol." +msgid "Latin small letter s with acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter s with circumflex\" symbol." +msgid "Latin capital letter s with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter s with circumflex\" symbol." +msgid "Latin small letter s with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter s with cedilla\" symbol." +msgid "Latin capital letter s with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter s with cedilla\" symbol." +msgid "Latin small letter s with cedilla" +msgstr "" + +msgctxt "A label for the \"latin capital letter s with caron\" symbol." +msgid "Latin capital letter s with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter s with caron\" symbol." +msgid "Latin small letter s with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter t with cedilla\" symbol." +msgid "Latin capital letter t with cedilla" +msgstr "" + +msgctxt "A label for the \"latin small letter t with cedilla\" symbol." +msgid "Latin small letter t with cedilla" +msgstr "" + +msgctxt "A label for the \"latin capital letter t with caron\" symbol." +msgid "Latin capital letter t with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter t with caron\" symbol." +msgid "Latin small letter t with caron" +msgstr "" + +msgctxt "A label for the \"latin capital letter t with stroke\" symbol." +msgid "Latin capital letter t with stroke" +msgstr "" + +msgctxt "A label for the \"latin small letter t with stroke\" symbol." +msgid "Latin small letter t with stroke" +msgstr "" + +msgctxt "A label for the \"latin capital letter u with tilde\" symbol." +msgid "Latin capital letter u with tilde" +msgstr "" + +msgctxt "A label for the \"latin small letter u with tilde\" symbol." +msgid "Latin small letter u with tilde" +msgstr "" + +msgctxt "A label for the \"latin capital letter u with macron\" symbol." +msgid "Latin capital letter u with macron" +msgstr "" + +msgctxt "A label for the \"latin small letter u with macron\" symbol." +msgid "Latin small letter u with macron" +msgstr "" + +msgctxt "A label for the \"latin capital letter u with breve\" symbol." +msgid "Latin capital letter u with breve" +msgstr "" + +msgctxt "A label for the \"latin small letter u with breve\" symbol." +msgid "Latin small letter u with breve" +msgstr "" + +msgctxt "A label for the \"latin capital letter u with ring above\" symbol." +msgid "Latin capital letter u with ring above" +msgstr "" + +msgctxt "A label for the \"latin small letter u with ring above\" symbol." +msgid "Latin small letter u with ring above" +msgstr "" + +msgctxt "A label for the \"latin capital letter u with double acute\" symbol." +msgid "Latin capital letter u with double acute" +msgstr "" + +msgctxt "A label for the \"latin small letter u with double acute\" symbol." +msgid "Latin small letter u with double acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter u with ogonek\" symbol." +msgid "Latin capital letter u with ogonek" +msgstr "" + +msgctxt "A label for the \"latin small letter u with ogonek\" symbol." +msgid "Latin small letter u with ogonek" +msgstr "" + +msgctxt "A label for the \"latin capital letter w with circumflex\" symbol." +msgid "Latin capital letter w with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter w with circumflex\" symbol." +msgid "Latin small letter w with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter y with circumflex\" symbol." +msgid "Latin capital letter y with circumflex" +msgstr "" + +msgctxt "A label for the \"latin small letter y with circumflex\" symbol." +msgid "Latin small letter y with circumflex" +msgstr "" + +msgctxt "A label for the \"latin capital letter y with diaeresis\" symbol." +msgid "Latin capital letter y with diaeresis" +msgstr "" + +msgctxt "A label for the \"latin capital letter z with acute\" symbol." +msgid "Latin capital letter z with acute" +msgstr "" + +msgctxt "A label for the \"latin small letter z with acute\" symbol." +msgid "Latin small letter z with acute" +msgstr "" + +msgctxt "A label for the \"latin capital letter z with dot above\" symbol." +msgid "Latin capital letter z with dot above" +msgstr "" + +msgctxt "A label for the \"latin small letter z with dot above\" symbol." +msgid "Latin small letter z with dot above" +msgstr "" + +msgctxt "A label for the \"latin capital letter z with caron\" symbol." +msgid "Latin capital letter z with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter z with caron\" symbol." +msgid "Latin small letter z with caron" +msgstr "" + +msgctxt "A label for the \"latin small letter long s\" symbol." +msgid "Latin small letter long s" +msgstr "" + +msgctxt "A label for the \"less-than sign\" symbol." +msgid "Less-than sign" +msgstr "" + +msgctxt "A label for the \"greater-than sign\" symbol." +msgid "Greater-than sign" +msgstr "" + +msgctxt "A label for the \"less-than or equal to\" symbol." +msgid "Less-than or equal to" +msgstr "" + +msgctxt "A label for the \"greater-than or equal to\" symbol." +msgid "Greater-than or equal to" +msgstr "" + +msgctxt "A label for the \"en dash\" symbol." +msgid "En dash" +msgstr "" + +msgctxt "A label for the \"em dash\" symbol." +msgid "Em dash" +msgstr "" + +msgctxt "A label for the \"macron\" symbol." +msgid "Macron" +msgstr "" + +msgctxt "A label for the \"overline\" symbol." +msgid "Overline" +msgstr "" + +msgctxt "A label for the \"degree sign\" symbol." +msgid "Degree sign" +msgstr "" + +msgctxt "A label for the \"minus sign\" symbol." +msgid "Minus sign" +msgstr "" + +msgctxt "A label for the \"plus-minus sign\" symbol." +msgid "Plus-minus sign" +msgstr "" + +msgctxt "A label for the \"division sign\" symbol." +msgid "Division sign" +msgstr "" + +msgctxt "A label for the \"fraction slash\" symbol." +msgid "Fraction slash" +msgstr "" + +msgctxt "A label for the \"multiplication sign\" symbol." +msgid "Multiplication sign" +msgstr "" + +msgctxt "A label for the \"latin small letter f with hook\" symbol." +msgid "Latin small letter f with hook" +msgstr "" + +msgctxt "A label for the \"integral\" symbol." +msgid "Integral" +msgstr "" + +msgctxt "A label for the \"n-ary summation\" symbol." +msgid "N-ary summation" +msgstr "" + +msgctxt "A label for the \"infinity\" symbol." +msgid "Infinity" +msgstr "" + +msgctxt "A label for the \"square root\" symbol." +msgid "Square root" +msgstr "" + +msgctxt "A label for the \"tilde operator\" symbol." +msgid "Tilde operator" +msgstr "" + +msgctxt "A label for the \"approximately equal to\" symbol." +msgid "Approximately equal to" +msgstr "" + +msgctxt "A label for the \"almost equal to\" symbol." +msgid "Almost equal to" +msgstr "" + +msgctxt "A label for the \"not equal to\" symbol." +msgid "Not equal to" +msgstr "" + +msgctxt "A label for the \"identical to\" symbol." +msgid "Identical to" +msgstr "" + +msgctxt "A label for the \"element of\" symbol." +msgid "Element of" +msgstr "" + +msgctxt "A label for the \"not an element of\" symbol." +msgid "Not an element of" +msgstr "" + +msgctxt "A label for the \"contains as member\" symbol." +msgid "Contains as member" +msgstr "" + +msgctxt "A label for the \"n-ary product\" symbol." +msgid "N-ary product" +msgstr "" + +msgctxt "A label for the \"logical and\" symbol." +msgid "Logical and" +msgstr "" + +msgctxt "A label for the \"logical or\" symbol." +msgid "Logical or" +msgstr "" + +msgctxt "A label for the \"not sign\" symbol." +msgid "Not sign" +msgstr "" + +msgctxt "A label for the \"intersection\" symbol." +msgid "Intersection" +msgstr "" + +msgctxt "A label for the \"union\" symbol." +msgid "Union" +msgstr "" + +msgctxt "A label for the \"partial differential\" symbol." +msgid "Partial differential" +msgstr "" + +msgctxt "A label for the \"for all\" symbol." +msgid "For all" +msgstr "" + +msgctxt "A label for the \"there exists\" symbol." +msgid "There exists" +msgstr "" + +msgctxt "A label for the \"empty set\" symbol." +msgid "Empty set" +msgstr "" + +msgctxt "A label for the \"nabla\" symbol." +msgid "Nabla" +msgstr "" + +msgctxt "A label for the \"asterisk operator\" symbol." +msgid "Asterisk operator" +msgstr "" + +msgctxt "A label for the \"proportional to\" symbol." +msgid "Proportional to" +msgstr "" + +msgctxt "A label for the \"angle\" symbol." +msgid "Angle" +msgstr "" + +msgctxt "A label for the \"vulgar fraction one quarter\" symbol." +msgid "Vulgar fraction one quarter" +msgstr "" + +msgctxt "A label for the \"vulgar fraction one half\" symbol." +msgid "Vulgar fraction one half" +msgstr "" + +msgctxt "A label for the \"vulgar fraction three quarters\" symbol." +msgid "Vulgar fraction three quarters" +msgstr "" + +msgctxt "A label for the \"single left-pointing angle quotation mark\" symbol." +msgid "Single left-pointing angle quotation mark" +msgstr "" + +msgctxt "A label for the \"single right-pointing angle quotation mark\" symbol." +msgid "Single right-pointing angle quotation mark" +msgstr "" + +msgctxt "A label for the \"left-pointing double angle quotation mark\" symbol." +msgid "Left-pointing double angle quotation mark" +msgstr "" + +msgctxt "A label for the \"right-pointing double angle quotation mark\" symbol." +msgid "Right-pointing double angle quotation mark" +msgstr "" + +msgctxt "A label for the \"left single quotation mark\" symbol." +msgid "Left single quotation mark" +msgstr "" + +msgctxt "A label for the \"right single quotation mark\" symbol." +msgid "Right single quotation mark" +msgstr "" + +msgctxt "A label for the \"left double quotation mark\" symbol." +msgid "Left double quotation mark" +msgstr "" + +msgctxt "A label for the \"right double quotation mark\" symbol." +msgid "Right double quotation mark" +msgstr "" + +msgctxt "A label for the \"single low-9 quotation mark\" symbol." +msgid "Single low-9 quotation mark" +msgstr "" + +msgctxt "A label for the \"double low-9 quotation mark\" symbol." +msgid "Double low-9 quotation mark" +msgstr "" + +msgctxt "A label for the \"inverted exclamation mark\" symbol." +msgid "Inverted exclamation mark" +msgstr "" + +msgctxt "A label for the \"inverted question mark\" symbol." +msgid "Inverted question mark" +msgstr "" + +msgctxt "A label for the \"two dot leader\" symbol." +msgid "Two dot leader" +msgstr "" + +msgctxt "A label for the \"horizontal ellipsis\" symbol." +msgid "Horizontal ellipsis" +msgstr "" + +msgctxt "A label for the \"double dagger\" symbol." +msgid "Double dagger" +msgstr "" + +msgctxt "A label for the \"per mille sign\" symbol." +msgid "Per mille sign" +msgstr "" + +msgctxt "A label for the \"per ten thousand sign\" symbol." +msgid "Per ten thousand sign" +msgstr "" + +msgctxt "A label for the \"double exclamation mark\" symbol." +msgid "Double exclamation mark" +msgstr "" + +msgctxt "A label for the \"question exclamation mark\" symbol." +msgid "Question exclamation mark" +msgstr "" + +msgctxt "A label for the \"exclamation question mark\" symbol." +msgid "Exclamation question mark" +msgstr "" + +msgctxt "A label for the \"double question mark\" symbol." +msgid "Double question mark" +msgstr "" + +msgctxt "A label for the \"copyright sign\" symbol." +msgid "Copyright sign" +msgstr "" + +msgctxt "A label for the \"registered sign\" symbol." +msgid "Registered sign" +msgstr "" + +msgctxt "A label for the \"trade mark sign\" symbol." +msgid "Trade mark sign" +msgstr "" + +msgctxt "A label for the \"section sign\" symbol." +msgid "Section sign" +msgstr "" + +msgctxt "A label for the \"paragraph sign\" symbol." +msgid "Paragraph sign" +msgstr "" + +msgctxt "A label for the \"reversed paragraph sign\" symbol." +msgid "Reversed paragraph sign" +msgstr "" + +msgctxt "A label for a tooltip showing when the user hovers over the plugin icon." +msgid "Character categories" +msgstr "" diff --git a/packages/ckeditor5-table/lang/translations/zh.po b/packages/ckeditor5-table/lang/translations/zh.po index 766f193913a..040c3f88d72 100644 --- a/packages/ckeditor5-table/lang/translations/zh.po +++ b/packages/ckeditor5-table/lang/translations/zh.po @@ -38,7 +38,7 @@ msgstr "刪除欄" msgctxt "Label for the select the entire table column button." msgid "Select column" -msgstr "" +msgstr "選擇欄" msgctxt "Label for the table column dropdown button." msgid "Column" @@ -62,7 +62,7 @@ msgstr "刪除列" msgctxt "Label for the select the entire table row button." msgid "Select row" -msgstr "" +msgstr "選擇列" msgctxt "Label for the table row dropdown button." msgid "Row" @@ -98,152 +98,152 @@ msgstr "合併儲存格" msgctxt "The label used by assistive technologies describing a table toolbar attached to a table widget." msgid "Table toolbar" -msgstr "" +msgstr "表格工具" msgctxt "The label describing the form allowing to specify the properties of a selected table." msgid "Table properties" -msgstr "" +msgstr "表格屬性" msgctxt "The label describing the form allowing to specify the properties of a selected table cell." msgid "Cell properties" -msgstr "" +msgstr "儲存格屬性" msgctxt "The label describing a group of border–related form fields (border style, color, etc.)." msgid "Border" -msgstr "" +msgstr "邊框" msgctxt "The label for the dropdown that allows configuring the border style of a table or a table cell." msgid "Style" -msgstr "" +msgstr "樣式" msgctxt "The label for the input that allows configuring the width of a table or a table cell or the width of a border." msgid "Width" -msgstr "" +msgstr "寬度" msgctxt "The label for the input that allows configuring the height of a table or a table cell." msgid "Height" -msgstr "" +msgstr "高度" msgctxt "The label for the input that allows configuring the border color of a table or a table cell." msgid "Color" -msgstr "" +msgstr "文字顏色" msgctxt "The label for the input that allows configuring the background color of a table or a table cell." msgid "Background" -msgstr "" +msgstr "背景顏色" msgctxt "The label for the input that allows configuring the padding of a table cell." msgid "Padding" -msgstr "" +msgstr "儲存格留白" msgctxt "The label describing a group of form fields that allows setting dimensions of a table or a table cell." msgid "Dimensions" -msgstr "" +msgstr "尺寸" msgctxt "The label for the group of toolbars that allows configuring the text alignment in a table cell." msgid "Table cell text alignment" -msgstr "" +msgstr "儲存格文字對齊" msgctxt "The label for the toolbar that allows configuring the alignment of a table." msgid "Alignment" -msgstr "" +msgstr "對齊" msgctxt "The label used by assistive technologies describing a toolbar that allows configuring the horizontal text alignment in a table cell." msgid "Horizontal text alignment toolbar" -msgstr "" +msgstr "水平對齊" msgctxt "The label used by assistive technologies describing a toolbar that allows configuring the vertical text alignment in a table cell." msgid "Vertical text alignment toolbar" -msgstr "" +msgstr "垂直對齊" msgctxt "The label used by assistive technologies describing a toolbar that allows configuring the alignment of a table." msgid "Table alignment toolbar" -msgstr "" +msgstr "表格對齊" msgctxt "The label for the border style dropdown when no style is applied to a table or a table cell." msgid "None" -msgstr "" +msgstr "無" msgctxt "The label for the border style dropdown when the solid border is applied to a table or a table cell." msgid "Solid" -msgstr "" +msgstr "實線" msgctxt "The label for the border style dropdown when the dotted border is applied to a table or a table cell." msgid "Dotted" -msgstr "" +msgstr "點線" msgctxt "The label for the border style dropdown when the dashed border is applied to a table or a table cell." msgid "Dashed" -msgstr "" +msgstr "虛線" msgctxt "The label for the border style dropdown when the double border is applied to a table or a table cell." msgid "Double" -msgstr "" +msgstr "雙線" msgctxt "The label for the border style dropdown when the groove border is applied to a table or a table cell." msgid "Groove" -msgstr "" +msgstr "內凹線" msgctxt "The label for the border style dropdown when the ridge border is applied to a table or a table cell." msgid "Ridge" -msgstr "" +msgstr "凸起線" msgctxt "The label for the border style dropdown when the inset border is applied to a table or a table cell." msgid "Inset" -msgstr "" +msgstr "內邊線" msgctxt "The label for the border style dropdown when the outset border is applied to a table or a table cell." msgid "Outset" -msgstr "" +msgstr "外框線" msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the left." msgid "Align cell text to the left" -msgstr "" +msgstr "靠左對齊" msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the center." msgid "Align cell text to the center" -msgstr "" +msgstr "置中對齊" msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the right." msgid "Align cell text to the right" -msgstr "" +msgstr "靠右對齊" msgctxt "The label used by assistive technologies describing a button that justifies the table cell text." msgid "Justify cell text" -msgstr "" +msgstr "分散對齊" msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the top." msgid "Align cell text to the top" -msgstr "" +msgstr "向上對齊" msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the middle." msgid "Align cell text to the middle" -msgstr "" +msgstr "置中對齊" msgctxt "The label used by assistive technologies describing a button that aligns the table cell text to the bottom." msgid "Align cell text to the bottom" -msgstr "" +msgstr "向下對齊" msgctxt "The label used by assistive technologies describing a button that aligns the table to the left." msgid "Align table to the left" -msgstr "" +msgstr "靠左對齊" msgctxt "The label used by assistive technologies describing a button that centers the table." msgid "Center table" -msgstr "" +msgstr "置中對齊" msgctxt "The label used by assistive technologies describing a button that aligns the table to the right." msgid "Align table to the right" -msgstr "" +msgstr "靠右對齊" msgctxt "The localized error string that can be displayed next to color (background, border) fields that have an invalid value" msgid "The color is invalid. Try \"#FF0000\" or \"rgb(255,0,0)\" or \"red\"." -msgstr "" +msgstr "顏色代碼錯誤。試試看 \"#FF0000\" 或 \"rgb(255, 0, 0)\" 或 \"red\"。" msgctxt "The localized error string that can be displayed next to length (padding, border width) fields that have an invalid value." msgid "The value is invalid. Try \"10px\" or \"2em\" or simply \"2\"." -msgstr "" +msgstr "尺寸代碼錯誤。試試看 \"10px\" 或 \"2em\" 或簡單寫 \"2\"。" msgctxt "The label used by assistive technologies describing a button that opens a color picker, where user can choose a configured color for a certain properties (eg.: background color, color, border-color etc.)." msgid "Color picker" -msgstr "" +msgstr "顏色選擇" diff --git a/packages/ckeditor5-table/tests/converters/upcasttable.js b/packages/ckeditor5-table/tests/converters/upcasttable.js index 7256c6cc41f..e47c5c80f15 100644 --- a/packages/ckeditor5-table/tests/converters/upcasttable.js +++ b/packages/ckeditor5-table/tests/converters/upcasttable.js @@ -500,6 +500,48 @@ describe( 'upcastTable()', () => { } ); } ); + describe( 'inline contents', () => { + it( 'should upcast inline element inside a table cell', () => { + model.schema.register( 'inline', { allowWhere: '$text', isInline: true } ); + model.schema.extend( '$text', { allowIn: 'inline' } ); + editor.conversion.elementToElement( { model: 'inline', view: 'span' } ); + + editor.setData( + '
    ' + + '' + + '' + + '' + + '
    ' + + 'foo' + + '
    ' + ); + + expectModel( modelTable( [ + [ 'foo' ] + ] ) ); + } ); + + it( 'should upcast inline object inside a table cell', () => { + model.schema.register( 'inline', { allowWhere: '$text', isInline: true, isObject: true } ); + model.schema.extend( '$text', { allowIn: 'inline' } ); + editor.conversion.elementToElement( { model: 'inline', view: 'span' } ); + + editor.setData( + '' + + '' + + '' + + '' + + '
    ' + + 'foo' + + '
    ' + ); + + expectModel( modelTable( [ + [ 'foo' ] + ] ) ); + } ); + } ); + describe( 'handling redundant whitespacing between table elements', () => { it( 'table without thead/tbody/tfoot', () => { editor.setData( diff --git a/packages/ckeditor5-table/tests/tablekeyboard.js b/packages/ckeditor5-table/tests/tablekeyboard.js index 4c8212512df..1f5baea69e4 100644 --- a/packages/ckeditor5-table/tests/tablekeyboard.js +++ b/packages/ckeditor5-table/tests/tablekeyboard.js @@ -14,12 +14,11 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtest import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph'; import ImageEditing from '@ckeditor/ckeditor5-image/src/image/imageediting'; import MediaEmbedEditing from '@ckeditor/ckeditor5-media-embed/src/mediaembedediting'; -import ImageCaptionEditing from '@ckeditor/ckeditor5-image/src/imagecaption/imagecaptionediting'; -import HorizontalLineEditing from '@ckeditor/ckeditor5-horizontal-line/src/horizontallineediting'; import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor'; import Image from '@ckeditor/ckeditor5-image/src/image'; import ImageCaption from '@ckeditor/ckeditor5-image/src/imagecaption'; import HorizontalLine from '@ckeditor/ckeditor5-horizontal-line/src/horizontalline'; +import MediaEmbed from '@ckeditor/ckeditor5-media-embed/src/mediaembed'; import { getCode } from '@ckeditor/ckeditor5-utils/src/keyboard'; import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model'; @@ -28,30 +27,29 @@ import global from '@ckeditor/ckeditor5-utils/src/dom/global'; import env from '@ckeditor/ckeditor5-utils/src/env'; describe( 'TableKeyboard', () => { - let editor, model, modelRoot, tableSelection, tableKeyboard, selection; + let editor, model, modelRoot, tableSelection, tableKeyboard, selection, editorElement; const imageUrl = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAUCAQAAADRyVAeAAAAKklEQVR42u3PAQ0AAAwCI' + 'O0f+u/hoAHNZUJFRERERERERERERERERLYiD9N4FAFj2iK6AAAAAElFTkSuQmCC'; - beforeEach( () => { - return VirtualTestEditor - .create( { - plugins: [ TableEditing, TableKeyboard, TableSelection, Paragraph, ImageEditing, ImageCaptionEditing, MediaEmbedEditing, - HorizontalLineEditing ] - } ) - .then( newEditor => { - editor = newEditor; - - model = editor.model; - selection = model.document.selection; - modelRoot = model.document.getRoot(); - tableSelection = editor.plugins.get( TableSelection ); - tableKeyboard = editor.plugins.get( TableKeyboard ); - } ); + beforeEach( async () => { + editorElement = global.document.createElement( 'div' ); + global.document.body.appendChild( editorElement ); + + editor = await ClassicTestEditor.create( editorElement, { + plugins: [ Table, Paragraph, Image, ImageCaption, HorizontalLine, MediaEmbed ] + } ); + + model = editor.model; + selection = model.document.selection; + modelRoot = model.document.getRoot(); + tableSelection = editor.plugins.get( TableSelection ); + tableKeyboard = editor.plugins.get( TableKeyboard ); } ); - afterEach( () => { - editor.destroy(); + afterEach( async () => { + editorElement.remove(); + await editor.destroy(); } ); it( 'should have pluginName', () => { @@ -2053,10 +2051,12 @@ describe( 'TableKeyboard', () => { } ); it( 'should navigate to the cell on the left', () => { + // Twice because of fake caret next to widget. + editor.editing.view.document.fire( 'keydown', leftArrowDomEvtDataStub ); editor.editing.view.document.fire( 'keydown', leftArrowDomEvtDataStub ); - sinon.assert.calledOnce( leftArrowDomEvtDataStub.preventDefault ); - sinon.assert.calledOnce( leftArrowDomEvtDataStub.stopPropagation ); + sinon.assert.called( leftArrowDomEvtDataStub.preventDefault ); + sinon.assert.called( leftArrowDomEvtDataStub.stopPropagation ); assertEqualMarkup( getModelData( model ), modelTable( [ [ '00', '01', '02' ], @@ -2066,10 +2066,12 @@ describe( 'TableKeyboard', () => { } ); it( 'should navigate to the cell on the right', () => { + // Twice because of fake caret next to widget. + editor.editing.view.document.fire( 'keydown', rightArrowDomEvtDataStub ); editor.editing.view.document.fire( 'keydown', rightArrowDomEvtDataStub ); - sinon.assert.calledOnce( rightArrowDomEvtDataStub.preventDefault ); - sinon.assert.calledOnce( rightArrowDomEvtDataStub.stopPropagation ); + sinon.assert.called( rightArrowDomEvtDataStub.preventDefault ); + sinon.assert.called( rightArrowDomEvtDataStub.stopPropagation ); assertEqualMarkup( getModelData( model ), modelTable( [ [ '00', '01', '02' ], @@ -2079,10 +2081,12 @@ describe( 'TableKeyboard', () => { } ); it( 'should navigate to the cell above', () => { + // Twice because of fake caret next to widget. + editor.editing.view.document.fire( 'keydown', upArrowDomEvtDataStub ); editor.editing.view.document.fire( 'keydown', upArrowDomEvtDataStub ); - sinon.assert.calledOnce( upArrowDomEvtDataStub.preventDefault ); - sinon.assert.calledOnce( upArrowDomEvtDataStub.stopPropagation ); + sinon.assert.called( upArrowDomEvtDataStub.preventDefault ); + sinon.assert.called( upArrowDomEvtDataStub.stopPropagation ); assertEqualMarkup( getModelData( model ), modelTable( [ [ '00', '01[]', '02' ], @@ -2092,10 +2096,12 @@ describe( 'TableKeyboard', () => { } ); it( 'should navigate to the cell below', () => { + // Twice because of fake caret next to widget. + editor.editing.view.document.fire( 'keydown', downArrowDomEvtDataStub ); editor.editing.view.document.fire( 'keydown', downArrowDomEvtDataStub ); - sinon.assert.calledOnce( downArrowDomEvtDataStub.preventDefault ); - sinon.assert.calledOnce( downArrowDomEvtDataStub.stopPropagation ); + sinon.assert.called( downArrowDomEvtDataStub.preventDefault ); + sinon.assert.called( downArrowDomEvtDataStub.stopPropagation ); assertEqualMarkup( getModelData( model ), modelTable( [ [ '00', '01', '02' ], @@ -2113,10 +2119,12 @@ describe( 'TableKeyboard', () => { [ '20', '21', '22' ] ] ) ); + // Twice because of fake caret next to widget. + editor.editing.view.document.fire( 'keydown', leftArrowDomEvtDataStub ); editor.editing.view.document.fire( 'keydown', leftArrowDomEvtDataStub ); - sinon.assert.calledOnce( leftArrowDomEvtDataStub.preventDefault ); - sinon.assert.calledOnce( leftArrowDomEvtDataStub.stopPropagation ); + sinon.assert.called( leftArrowDomEvtDataStub.preventDefault ); + sinon.assert.called( leftArrowDomEvtDataStub.stopPropagation ); assertEqualMarkup( getModelData( model ), modelTable( [ [ '00', '01', '02' ], @@ -2132,10 +2140,12 @@ describe( 'TableKeyboard', () => { [ '20', '21', '22' ] ] ) ); + // Twice because of fake caret next to widget. + editor.editing.view.document.fire( 'keydown', rightArrowDomEvtDataStub ); editor.editing.view.document.fire( 'keydown', rightArrowDomEvtDataStub ); - sinon.assert.calledOnce( rightArrowDomEvtDataStub.preventDefault ); - sinon.assert.calledOnce( rightArrowDomEvtDataStub.stopPropagation ); + sinon.assert.called( rightArrowDomEvtDataStub.preventDefault ); + sinon.assert.called( rightArrowDomEvtDataStub.stopPropagation ); assertEqualMarkup( getModelData( model ), modelTable( [ [ '00', '01', '02' ], @@ -2151,10 +2161,12 @@ describe( 'TableKeyboard', () => { [ '20', '21', '22' ] ] ) ); + // Twice because of fake caret next to widget. + editor.editing.view.document.fire( 'keydown', upArrowDomEvtDataStub ); editor.editing.view.document.fire( 'keydown', upArrowDomEvtDataStub ); - sinon.assert.calledOnce( upArrowDomEvtDataStub.preventDefault ); - sinon.assert.calledOnce( upArrowDomEvtDataStub.stopPropagation ); + sinon.assert.called( upArrowDomEvtDataStub.preventDefault ); + sinon.assert.called( upArrowDomEvtDataStub.stopPropagation ); assertEqualMarkup( getModelData( model ), modelTable( [ [ '00', '01[]', '02' ], @@ -2170,10 +2182,12 @@ describe( 'TableKeyboard', () => { [ '20', '21', '22' ] ] ) ); + // Twice because of fake caret next to widget. + editor.editing.view.document.fire( 'keydown', downArrowDomEvtDataStub ); editor.editing.view.document.fire( 'keydown', downArrowDomEvtDataStub ); - sinon.assert.calledOnce( downArrowDomEvtDataStub.preventDefault ); - sinon.assert.calledOnce( downArrowDomEvtDataStub.stopPropagation ); + sinon.assert.called( downArrowDomEvtDataStub.preventDefault ); + sinon.assert.called( downArrowDomEvtDataStub.stopPropagation ); assertEqualMarkup( getModelData( model ), modelTable( [ [ '00', '01', '02' ], @@ -2185,18 +2199,9 @@ describe( 'TableKeyboard', () => { } ); describe( 'with selection not at the boundary of a cell', () => { - let editorElement, editor, model, styleElement; + let styleElement; beforeEach( async () => { - editorElement = global.document.createElement( 'div' ); - global.document.body.appendChild( editorElement ); - - editor = await ClassicTestEditor.create( editorElement, { - plugins: [ Table, Paragraph, Image, ImageCaption, HorizontalLine ] - } ); - - model = editor.model; - styleElement = global.document.createElement( 'style' ); styleElement.type = 'text/css'; styleElement.appendChild( global.document.createTextNode( @@ -2220,9 +2225,7 @@ describe( 'TableKeyboard', () => { } ); afterEach( async () => { - editorElement.remove(); styleElement.remove(); - await editor.destroy(); } ); describe( 'simple cell text content', () => { @@ -3065,6 +3068,8 @@ describe( 'TableKeyboard', () => { } ); describe( 'for right-to-left content language', () => { + let editor, model, modelRoot, tableSelection; + beforeEach( () => { return VirtualTestEditor .create( { @@ -3080,6 +3085,10 @@ describe( 'TableKeyboard', () => { } ); } ); + afterEach( () => { + return editor.destroy(); + } ); + describe( 'with the table cell selected from outside', () => { beforeEach( () => { setModelData( model, modelTable( [ diff --git a/packages/ckeditor5-typing/docs/features/text-transformation.md b/packages/ckeditor5-typing/docs/features/text-transformation.md index 3123c637c5b..72b8f9fe6fa 100644 --- a/packages/ckeditor5-typing/docs/features/text-transformation.md +++ b/packages/ckeditor5-typing/docs/features/text-transformation.md @@ -54,8 +54,9 @@ Type snippets such as `(c)`, `3/4`, `!=`, `---`, `"foo"` into the rich-text edit In addition to enabling automatic text transformations, you may want to check the following productivity features: -* {@link features/autoformat Autoformatting} – It allows to quickly apply formatting to the content you are writing. -* {@link features/mentions Mentions} – It brings support for smart autocompletion. +* {@link features/autoformat Autoformatting} – Allows to quickly apply formatting to the content you are writing. +* {@link features/link#autolink-feature Autolink} – Turns the links and email addresses typed or pasted into the editor into active URLs. +* {@link features/mentions Mentions} – Brings support for smart autocompletion. ## Configuring transformations diff --git a/packages/ckeditor5-typing/tests/utils/inlinehighlight.js b/packages/ckeditor5-typing/tests/utils/inlinehighlight.js index cba76ff571a..c7ca13537a3 100644 --- a/packages/ckeditor5-typing/tests/utils/inlinehighlight.js +++ b/packages/ckeditor5-typing/tests/utils/inlinehighlight.js @@ -30,7 +30,7 @@ describe( 'inlineHighlight', () => { model.schema.extend( '$text', { allowAttributes: 'linkHref' } ); editor.conversion.for( 'editingDowncast' ) - .attributeToElement( { model: 'linkHref', view: ( href, writer ) => { + .attributeToElement( { model: 'linkHref', view: ( href, { writer } ) => { return writer.createAttributeElement( 'a', { href } ); } } ); diff --git a/packages/ckeditor5-ui/lang/translations/ko.po b/packages/ckeditor5-ui/lang/translations/ko.po index 37629daf4ae..35e00d77bed 100644 --- a/packages/ckeditor5-ui/lang/translations/ko.po +++ b/packages/ckeditor5-ui/lang/translations/ko.po @@ -18,11 +18,11 @@ msgstr "" msgctxt "Title of the CKEditor5 editor." msgid "Rich Text Editor, %0" -msgstr "" +msgstr "리치 텍스트 편집기, %0" msgctxt "Title of the CKEditor5 editor." msgid "Rich Text Editor" -msgstr "" +msgstr "리치 텍스트 편집기" msgctxt "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)" msgid "Edit block" @@ -38,7 +38,7 @@ msgstr "이전" msgctxt "Label for a 'page X of Y' status of a typical next/previous page navigation." msgid "%0 of %1" -msgstr "" +msgstr "0% / %1" msgctxt "Label used by assistive technologies describing a generic editor toolbar." msgid "Editor toolbar" @@ -54,7 +54,7 @@ msgstr "더보기" msgctxt "Label of a button that applies a black color in color pickers." msgid "Black" -msgstr "검정" +msgstr "검은색" msgctxt "Label of a button that applies a dim grey color in color pickers." msgid "Dim grey" @@ -74,23 +74,23 @@ msgstr "흰색" msgctxt "Label of a button that applies a red color in color pickers." msgid "Red" -msgstr "빨강" +msgstr "빨간색" msgctxt "Label of a button that applies a orange color in color pickers." msgid "Orange" -msgstr "주황" +msgstr "주황색" msgctxt "Label of a button that applies a yellow color in color pickers." msgid "Yellow" -msgstr "노랑" +msgstr "노랑색" msgctxt "Label of a button that applies a light green color in color pickers." msgid "Light green" -msgstr "밝은 초록" +msgstr "밝은 초록색" msgctxt "Label of a button that applies a green color in color pickers." msgid "Green" -msgstr "초록" +msgstr "초록색" msgctxt "Label of a button that applies a aquamarine color in color pickers." msgid "Aquamarine" @@ -102,12 +102,12 @@ msgstr "청록색" msgctxt "Label of a button that applies a light blue color in color pickers." msgid "Light blue" -msgstr "연한 파랑" +msgstr "연한 파랑색" msgctxt "Label of a button that applies a blue color in color pickers." msgid "Blue" -msgstr "파랑" +msgstr "파랑색" msgctxt "Label of a button that applies a purple color in color pickers." msgid "Purple" -msgstr "보라" +msgstr "보라색" diff --git a/packages/ckeditor5-ui/lang/translations/zh.po b/packages/ckeditor5-ui/lang/translations/zh.po index a7ef88f8daa..3de693ee00e 100644 --- a/packages/ckeditor5-ui/lang/translations/zh.po +++ b/packages/ckeditor5-ui/lang/translations/zh.po @@ -42,15 +42,15 @@ msgstr "%0/%1" msgctxt "Label used by assistive technologies describing a generic editor toolbar." msgid "Editor toolbar" -msgstr "" +msgstr "編輯器工具" msgctxt "Label used by assistive technologies describing a toolbar displayed inside a dropdown." msgid "Dropdown toolbar" -msgstr "" +msgstr "下拉選單" msgctxt "Label of a toolbar button which reveals more toolbar items." msgid "Show more items" -msgstr "" +msgstr "顯示更多" msgctxt "Label of a button that applies a black color in color pickers." msgid "Black" diff --git a/packages/ckeditor5-ui/src/toolbar/balloon/balloontoolbar.js b/packages/ckeditor5-ui/src/toolbar/balloon/balloontoolbar.js index 131c486791c..2aee62de736 100644 --- a/packages/ckeditor5-ui/src/toolbar/balloon/balloontoolbar.js +++ b/packages/ckeditor5-ui/src/toolbar/balloon/balloontoolbar.js @@ -165,6 +165,15 @@ export default class BalloonToolbar extends Plugin { } ); } ); } + + // Listen to the toolbar view and whenever it changes its geometry due to some items being + // grouped or ungrouped, update the position of the balloon because a shorter/longer toolbar + // means the balloon could be pointing at the wrong place. Once updated, the balloon will point + // at the right selection in the content again. + // https://github.com/ckeditor/ckeditor5/issues/6444 + this.listenTo( this.toolbarView, 'groupedItemsUpdate', () => { + this._updatePosition(); + } ); } /** @@ -236,7 +245,7 @@ export default class BalloonToolbar extends Plugin { // Update the toolbar position when the editor ui should be refreshed. this.listenTo( this.editor.ui, 'update', () => { - this._balloon.updatePosition( this._getBalloonPositionData() ); + this._updatePosition(); } ); // Add the toolbar to the common editor contextual balloon. @@ -300,6 +309,18 @@ export default class BalloonToolbar extends Plugin { }; } + /** + * Updates the position of the {@link #_balloon} to make up for changes: + * + * * in the geometry of the selection it is attached to (e.g. the selection moved in the viewport or expanded or shrunk), + * * or the geometry of the balloon toolbar itself (e.g. the toolbar has grouped or ungrouped some items and it is shorter or longer). + * + * @private + */ + _updatePosition() { + this._balloon.updatePosition( this._getBalloonPositionData() ); + } + /** * @inheritDoc */ diff --git a/packages/ckeditor5-ui/src/toolbar/toolbarview.js b/packages/ckeditor5-ui/src/toolbar/toolbarview.js index a289cfd97ee..e690f354f03 100644 --- a/packages/ckeditor5-ui/src/toolbar/toolbarview.js +++ b/packages/ckeditor5-ui/src/toolbar/toolbarview.js @@ -304,6 +304,19 @@ export default class ToolbarView extends View { } } ).filter( item => item !== undefined ) ); } + + /** + * Fired when some toolbar {@link #items} were grouped or ungrouped as a result of some change + * in the toolbar geometry. + * + * **Note**: This event is always fired **once** regardless of the number of items that were be + * grouped or ungrouped at a time. + * + * **Note**: This event is fired only if the items grouping functionality was enabled in + * the first place (see {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull}). + * + * @event groupedItemsUpdate + */ } /** @@ -418,6 +431,14 @@ class DynamicGrouping { * is added to. */ constructor( view ) { + /** + * A toolbar view this behavior belongs to. + * + * @readonly + * @member {module:ui/toolbar~ToolbarView} + */ + this.view = view; + /** * A collection of toolbar children. * @@ -644,6 +665,9 @@ class DynamicGrouping { return; } + // Remember how many items were initially grouped so at the it is possible to figure out if the number + // of grouped items has changed. If the number has changed, geometry of the toolbar has also changed. + const initialGroupedItemsCount = this.groupedItems.length; let wereItemsGrouped; // Group #items as long as some wrap to the next row. This will happen, for instance, @@ -672,6 +696,10 @@ class DynamicGrouping { this._groupLastItem(); } } + + if ( this.groupedItems.length !== initialGroupedItemsCount ) { + this.view.fire( 'groupedItemsUpdate' ); + } } /** diff --git a/packages/ckeditor5-ui/tests/panel/balloon/contextualballoon.js b/packages/ckeditor5-ui/tests/panel/balloon/contextualballoon.js index 6ee4452b219..6059a6238cc 100644 --- a/packages/ckeditor5-ui/tests/panel/balloon/contextualballoon.js +++ b/packages/ckeditor5-ui/tests/panel/balloon/contextualballoon.js @@ -127,12 +127,12 @@ describe( 'ContextualBalloon', () => { editor.conversion.for( 'downcast' ).elementToElement( { model: 'widget', - view: ( modelElement, viewWriter ) => viewWriter.createContainerElement( 'figure', { contenteditable: 'false' } ) + view: ( modelElement, { writer } ) => writer.createContainerElement( 'figure', { contenteditable: 'false' } ) } ); editor.conversion.for( 'downcast' ).elementToElement( { model: 'nestedEditable', - view: ( modelElement, viewWriter ) => viewWriter.createContainerElement( 'figcaption', { contenteditable: 'true' } ) + view: ( modelElement, { writer } ) => writer.createContainerElement( 'figcaption', { contenteditable: 'true' } ) } ); setModelData( model, '[]foo' ); diff --git a/packages/ckeditor5-ui/tests/toolbar/balloon/balloontoolbar.js b/packages/ckeditor5-ui/tests/toolbar/balloon/balloontoolbar.js index 7fc472fee74..d8109e3ae44 100644 --- a/packages/ckeditor5-ui/tests/toolbar/balloon/balloontoolbar.js +++ b/packages/ckeditor5-ui/tests/toolbar/balloon/balloontoolbar.js @@ -361,6 +361,18 @@ describe( 'BalloonToolbar', () => { sinon.assert.calledOnce( spy ); } ); + it( 'should update the balloon position whenever #toolbarView fires the #groupedItemsUpdate (it changed its geometry)', () => { + setData( model, 'b[a]r' ); + + const spy = sinon.spy( balloon, 'updatePosition' ); + + balloonToolbar.show(); + sinon.assert.notCalled( spy ); + + balloonToolbar.toolbarView.fire( 'groupedItemsUpdate' ); + sinon.assert.calledOnce( spy ); + } ); + it( 'should not add #toolbarView to the #_balloon more than once', () => { setData( model, 'b[a]r' ); diff --git a/packages/ckeditor5-ui/tests/toolbar/toolbarview.js b/packages/ckeditor5-ui/tests/toolbar/toolbarview.js index 963d5532c9f..032900920c8 100644 --- a/packages/ckeditor5-ui/tests/toolbar/toolbarview.js +++ b/packages/ckeditor5-ui/tests/toolbar/toolbarview.js @@ -828,6 +828,47 @@ describe( 'ToolbarView', () => { expect( ungroupedItems ).to.have.length( 5 ); expect( groupedItems ).to.have.length( 0 ); } ); + + it( 'should fire the "groupedItemsUpdate" event on the toolbar when some item is grouped or ungrouped', () => { + const updateSpy = sinon.spy(); + + view.on( 'groupedItemsUpdate', updateSpy ); + + view.element.style.width = '200px'; + + view.items.add( focusable() ); + view.items.add( focusable() ); + view.items.add( focusable() ); + view.items.add( focusable() ); + view.items.add( focusable() ); + + resizeCallback( [ { + target: view.element, + contentRect: new Rect( view.element ) + } ] ); + + sinon.assert.calledOnce( updateSpy ); + + // This 10px is not enough to ungroup an item. + view.element.style.width = '210px'; + + resizeCallback( [ { + target: view.element, + contentRect: new Rect( view.element ) + } ] ); + + sinon.assert.calledOnce( updateSpy ); + + // But this is not enough to ungroup some items. + view.element.style.width = '300px'; + + resizeCallback( [ { + target: view.element, + contentRect: new Rect( view.element ) + } ] ); + + sinon.assert.calledTwice( updateSpy ); + } ); } ); describe( 'destroy()', () => { diff --git a/packages/ckeditor5-utils/src/dom/emittermixin.js b/packages/ckeditor5-utils/src/dom/emittermixin.js index 8242e98a586..ae5be1c488f 100644 --- a/packages/ckeditor5-utils/src/dom/emittermixin.js +++ b/packages/ckeditor5-utils/src/dom/emittermixin.js @@ -49,6 +49,8 @@ const DomEmitterMixin = extend( {}, EmitterMixin, { * order they were added. * @param {Boolean} [options.useCapture=false] Indicates that events of this type will be dispatched to the registered * listener before being dispatched to any EventTarget beneath it in the DOM tree. + * @param {Boolean} [options.usePassive=false] Indicates that the function specified by listener will never call preventDefault() + * and prevents blocking browser's main thread by this event handler. */ listenTo( emitter, ...rest ) { // Check if emitter is an instance of DOM Node. If so, replace the argument with @@ -179,6 +181,8 @@ extend( ProxyEmitter.prototype, EmitterMixin, { * @param {Object} [options={}] Additional options. * @param {Boolean} [options.useCapture=false] Indicates that events of this type will be dispatched to the registered * listener before being dispatched to any EventTarget beneath it in the DOM tree. + * @param {Boolean} [options.usePassive=false] Indicates that the function specified by listener will never call preventDefault() + * and prevents blocking browser's main thread by this event handler. */ attach( event, callback, options = {} ) { // If the DOM Listener for given event already exist it is pointless @@ -187,10 +191,15 @@ extend( ProxyEmitter.prototype, EmitterMixin, { return; } - const domListener = this._createDomListener( event, !!options.useCapture ); + const listenerOptions = { + capture: !!options.useCapture, + passive: !!options.usePassive + }; + + const domListener = this._createDomListener( event, listenerOptions ); // Attach the native DOM listener to DOM Node. - this._domNode.addEventListener( event, domListener, !!options.useCapture ); + this._domNode.addEventListener( event, domListener, listenerOptions ); if ( !this._domListeners ) { this._domListeners = {}; @@ -227,10 +236,13 @@ extend( ProxyEmitter.prototype, EmitterMixin, { * @private * @method module:utils/dom/emittermixin~ProxyEmitter#_createDomListener * @param {String} event The name of the event. - * @param {Boolean} useCapture Indicates whether the listener was created for capturing event. + * @param {Object} [options] Additional options. + * @param {Boolean} [options.capture=false] Indicates whether the listener was created for capturing event. + * @param {Boolean} [options.passive=false] Indicates that the function specified by listener will never call preventDefault() + * and prevents blocking browser's main thread by this event handler. * @returns {Function} The DOM listener callback. */ - _createDomListener( event, useCapture ) { + _createDomListener( event, options ) { const domListener = domEvt => { this.fire( event, domEvt ); }; @@ -239,7 +251,7 @@ extend( ProxyEmitter.prototype, EmitterMixin, { // detach it from the DOM Node, when it is no longer necessary. // See: {@link detach}. domListener.removeListener = () => { - this._domNode.removeEventListener( event, domListener, useCapture ); + this._domNode.removeEventListener( event, domListener, options ); delete this._domListeners[ event ]; }; diff --git a/packages/ckeditor5-utils/src/dom/resizeobserver.js b/packages/ckeditor5-utils/src/dom/resizeobserver.js index d3f0af2207d..31491ab6cfb 100644 --- a/packages/ckeditor5-utils/src/dom/resizeobserver.js +++ b/packages/ckeditor5-utils/src/dom/resizeobserver.js @@ -168,12 +168,6 @@ export default class ResizeObserver { ResizeObserver._observerInstance = new ObserverConstructor( entries => { for ( const entry of entries ) { - // Do not execute callbacks for elements that are invisible. - // https://github.com/ckeditor/ckeditor5/issues/6570 - if ( !entry.target.offsetParent ) { - continue; - } - const callbacks = ResizeObserver._getElementCallbacks( entry.target ); if ( callbacks ) { diff --git a/packages/ckeditor5-utils/tests/dom/emittermixin.js b/packages/ckeditor5-utils/tests/dom/emittermixin.js index 916e7d5ddda..025e3b55cec 100644 --- a/packages/ckeditor5-utils/tests/dom/emittermixin.js +++ b/packages/ckeditor5-utils/tests/dom/emittermixin.js @@ -113,6 +113,32 @@ describe( 'DomEmitterMixin', () => { sinon.assert.calledOnce( spy ); } ); } ); + + describe( 'event passive handling', () => { + it( 'should not use passive mode by default', () => { + const spy = sinon.spy( node, 'addEventListener' ); + + domEmitter.listenTo( node, 'test', () => {} ); + + expect( spy.calledWith( 'test', sinon.match.func, sinon.match( { capture: false, passive: false } ) ) ).to.be.true; + } ); + + it( 'should optionally use passive mode', () => { + const spy = sinon.spy( node, 'addEventListener' ); + + domEmitter.listenTo( node, 'test', () => {}, { usePassive: true } ); + + expect( spy.calledWith( 'test', sinon.match.func, sinon.match( { capture: false, passive: true } ) ) ).to.be.true; + } ); + + it( 'should not get activated for event capturing (if not desired)', () => { + const spy = sinon.spy( node, 'addEventListener' ); + + domEmitter.listenTo( node, 'test', () => {}, { useCapture: true } ); + + expect( spy.calledWith( 'test', sinon.match.func, sinon.match( { capture: true, passive: false } ) ) ).to.be.true; + } ); + } ); } ); describe( 'stopListening', () => { diff --git a/packages/ckeditor5-utils/tests/dom/resizeobserver.js b/packages/ckeditor5-utils/tests/dom/resizeobserver.js index 6f65c854341..a9cabe9c69f 100644 --- a/packages/ckeditor5-utils/tests/dom/resizeobserver.js +++ b/packages/ckeditor5-utils/tests/dom/resizeobserver.js @@ -114,61 +114,6 @@ describe( 'ResizeObserver()', () => { observerA.destroy(); } ); - it( 'should not react to resizing of an element if element is invisible', () => { - const callbackA = sinon.spy(); - let resizeCallback; - - testUtils.sinon.stub( global.window, 'ResizeObserver' ).callsFake( callback => { - resizeCallback = callback; - - return { - observe() {}, - unobserve() {} - }; - } ); - - const observerA = new ResizeObserver( elementA, callbackA ); - - elementA.style.display = 'none'; - - resizeCallback( [ - { target: elementA } - ] ); - - sinon.assert.notCalled( callbackA ); - - observerA.destroy(); - } ); - - it( 'should not react to resizing of an element if element\'s parent is invisible', () => { - const callbackA = sinon.spy(); - let resizeCallback; - - testUtils.sinon.stub( global.window, 'ResizeObserver' ).callsFake( callback => { - resizeCallback = callback; - - return { - observe() {}, - unobserve() {} - }; - } ); - - const observerA = new ResizeObserver( elementA, callbackA ); - const parent = document.createElement( 'div' ); - document.body.appendChild( parent ); - parent.appendChild( elementA ); - parent.style.display = 'none'; - - resizeCallback( [ - { target: elementA } - ] ); - - sinon.assert.notCalled( callbackA ); - - parent.remove(); - observerA.destroy(); - } ); - it( 'should be able to observe the same element along with other observers', () => { const callbackA = sinon.spy(); const callbackB = sinon.spy(); diff --git a/packages/ckeditor5-widget/lang/translations/zh.po b/packages/ckeditor5-widget/lang/translations/zh.po new file mode 100644 index 00000000000..2db2794a230 --- /dev/null +++ b/packages/ckeditor5-widget/lang/translations/zh.po @@ -0,0 +1,29 @@ +# Copyright (c) 2003-2020, 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: Chinese (Taiwan) (https://www.transifex.com/ckeditor/teams/11143/zh_TW/)\n" +"Language: zh_TW\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "The label used by assistive technologies describing a toolbar attached to a widget." +msgid "Widget toolbar" +msgstr "小工具" + +msgctxt "The title displayed when a mouse is over a button that inserts a paragraph before a block." +msgid "Insert paragraph before block" +msgstr "在這個區塊前面插入一個段落" + +msgctxt "The title displayed when a mouse is over a button that inserts a paragraph after a block." +msgid "Insert paragraph after block" +msgstr "在這個區塊後面插入一個段落" diff --git a/packages/ckeditor5-widget/src/utils.js b/packages/ckeditor5-widget/src/utils.js index 1bf721030f7..0047c3cd244 100644 --- a/packages/ckeditor5-widget/src/utils.js +++ b/packages/ckeditor5-widget/src/utils.js @@ -65,7 +65,7 @@ export function isWidget( node ) { * editor.conversion.for( 'editingDowncast' ) * .elementToElement( { * model: 'widget', - * view: ( modelItem, writer ) => { + * view: ( modelItem, { writer } ) => { * const div = writer.createContainerElement( 'div', { class: 'widget' } ); * * return toWidget( div, writer, { label: 'some widget' } ); @@ -75,7 +75,7 @@ export function isWidget( node ) { * editor.conversion.for( 'dataDowncast' ) * .elementToElement( { * model: 'widget', - * view: ( modelItem, writer ) => { + * view: ( modelItem, { writer } ) => { * return writer.createContainerElement( 'div', { class: 'widget' } ); * } * } ); @@ -208,7 +208,7 @@ export function getLabel( element ) { * editor.conversion.for( 'editingDowncast' ) * .elementToElement( { * model: 'nested', - * view: ( modelItem, writer ) => { + * view: ( modelItem, { writer } ) => { * const div = writer.createEditableElement( 'div', { class: 'nested' } ); * * return toWidgetEditable( nested, writer ); @@ -218,7 +218,7 @@ export function getLabel( element ) { * editor.conversion.for( 'dataDowncast' ) * .elementToElement( { * model: 'nested', - * view: ( modelItem, writer ) => { + * view: ( modelItem, { writer } ) => { * return writer.createContainerElement( 'div', { class: 'nested' } ); * } * } ); diff --git a/packages/ckeditor5-widget/tests/manual/inline-widget.js b/packages/ckeditor5-widget/tests/manual/inline-widget.js index 50630bb09bf..3911c5b7597 100644 --- a/packages/ckeditor5-widget/tests/manual/inline-widget.js +++ b/packages/ckeditor5-widget/tests/manual/inline-widget.js @@ -36,10 +36,10 @@ class InlineWidget extends Plugin { editor.conversion.for( 'editingDowncast' ).elementToElement( { model: 'placeholder', - view: ( modelItem, viewWriter ) => { - const widgetElement = createPlaceholderView( modelItem, viewWriter ); + view: ( modelItem, conversionApi ) => { + const widgetElement = createPlaceholderView( modelItem, conversionApi ); - return toWidget( widgetElement, viewWriter ); + return toWidget( widgetElement, conversionApi.writer ); } } ); @@ -72,11 +72,11 @@ class InlineWidget extends Plugin { this._createToolbarButton(); - function createPlaceholderView( modelItem, viewWriter ) { - const widgetElement = viewWriter.createContainerElement( 'placeholder' ); - const viewText = viewWriter.createText( '{' + modelItem.getAttribute( 'type' ) + '}' ); + function createPlaceholderView( modelItem, { writer } ) { + const widgetElement = writer.createContainerElement( 'placeholder' ); + const viewText = writer.createText( '{' + modelItem.getAttribute( 'type' ) + '}' ); - viewWriter.insert( viewWriter.createPositionAt( widgetElement, 0 ), viewText ); + writer.insert( writer.createPositionAt( widgetElement, 0 ), viewText ); return widgetElement; } diff --git a/packages/ckeditor5-widget/tests/manual/keyboard.js b/packages/ckeditor5-widget/tests/manual/keyboard.js index bb510886141..b64445500b8 100644 --- a/packages/ckeditor5-widget/tests/manual/keyboard.js +++ b/packages/ckeditor5-widget/tests/manual/keyboard.js @@ -19,7 +19,7 @@ function BlockWidget( editor ) { editor.conversion.for( 'downcast' ).elementToElement( { model: 'div', - view: ( modelElement, writer ) => { + view: ( modelElement, { writer } ) => { return toWidget( writer.createContainerElement( 'div', { class: 'widget' @@ -108,10 +108,10 @@ class InlineWidget extends Plugin { editor.conversion.for( 'editingDowncast' ).elementToElement( { model: 'placeholder', - view: ( modelItem, viewWriter ) => { - const widgetElement = createPlaceholderView( modelItem, viewWriter ); + view: ( modelItem, conversionApi ) => { + const widgetElement = createPlaceholderView( modelItem, conversionApi ); - return toWidget( widgetElement, viewWriter ); + return toWidget( widgetElement, conversionApi.writer ); } } ); @@ -130,11 +130,11 @@ class InlineWidget extends Plugin { viewToModelPositionOutsideModelElement( editor.model, viewElement => viewElement.name == 'placeholder' ) ); - function createPlaceholderView( modelItem, viewWriter ) { - const widgetElement = viewWriter.createContainerElement( 'placeholder' ); - const viewText = viewWriter.createText( '{placeholder}' ); + function createPlaceholderView( modelItem, { writer } ) { + const widgetElement = writer.createContainerElement( 'placeholder' ); + const viewText = writer.createText( '{placeholder}' ); - viewWriter.insert( viewWriter.createPositionAt( widgetElement, 0 ), viewText ); + writer.insert( writer.createPositionAt( widgetElement, 0 ), viewText ); return widgetElement; } diff --git a/packages/ckeditor5-widget/tests/manual/nested-widgets.js b/packages/ckeditor5-widget/tests/manual/nested-widgets.js index 1080134e62d..a982ff9518e 100644 --- a/packages/ckeditor5-widget/tests/manual/nested-widgets.js +++ b/packages/ckeditor5-widget/tests/manual/nested-widgets.js @@ -24,7 +24,7 @@ function MyPlugin( editor ) { editor.conversion.for( 'downcast' ).elementToElement( { model: 'div', - view: ( modelElement, writer ) => { + view: ( modelElement, { writer } ) => { return toWidget( writer.createContainerElement( 'div', { class: 'widget' } ), writer ); } } ); diff --git a/packages/ckeditor5-widget/tests/manual/selection-handle.js b/packages/ckeditor5-widget/tests/manual/selection-handle.js index d163c0261e0..b79120651dd 100644 --- a/packages/ckeditor5-widget/tests/manual/selection-handle.js +++ b/packages/ckeditor5-widget/tests/manual/selection-handle.js @@ -18,7 +18,7 @@ function MyPlugin( editor ) { editor.conversion.for( 'downcast' ).elementToElement( { model: 'div', - view: ( modelElement, writer ) => { + view: ( modelElement, { writer } ) => { return toWidget( writer.createContainerElement( 'div', { class: 'widget' } ), diff --git a/packages/ckeditor5-widget/tests/manual/type-around.js b/packages/ckeditor5-widget/tests/manual/type-around.js index 6de1fc375c8..51a20196293 100644 --- a/packages/ckeditor5-widget/tests/manual/type-around.js +++ b/packages/ckeditor5-widget/tests/manual/type-around.js @@ -29,10 +29,10 @@ class InlineWidget extends Plugin { editor.conversion.for( 'editingDowncast' ).elementToElement( { model: 'placeholder', - view: ( modelItem, viewWriter ) => { - const widgetElement = createPlaceholderView( modelItem, viewWriter ); + view: ( modelItem, conversionApi ) => { + const widgetElement = createPlaceholderView( modelItem, conversionApi ); - return toWidget( widgetElement, viewWriter ); + return toWidget( widgetElement, conversionApi.writer ); } } ); @@ -53,11 +53,11 @@ class InlineWidget extends Plugin { this._createToolbarButton(); - function createPlaceholderView( modelItem, viewWriter ) { - const widgetElement = viewWriter.createContainerElement( 'placeholder' ); - const viewText = viewWriter.createText( '{inline-widget}' ); + function createPlaceholderView( modelItem, { writer } ) { + const widgetElement = writer.createContainerElement( 'placeholder' ); + const viewText = writer.createText( '{inline-widget}' ); - viewWriter.insert( viewWriter.createPositionAt( widgetElement, 0 ), viewText ); + writer.insert( writer.createPositionAt( widgetElement, 0 ), viewText ); return widgetElement; } diff --git a/packages/ckeditor5-widget/tests/manual/widget-with-nestededitable.js b/packages/ckeditor5-widget/tests/manual/widget-with-nestededitable.js index f6807c0845a..61eb49eb9d2 100644 --- a/packages/ckeditor5-widget/tests/manual/widget-with-nestededitable.js +++ b/packages/ckeditor5-widget/tests/manual/widget-with-nestededitable.js @@ -40,13 +40,13 @@ ClassicEditor editor.conversion.for( 'dataDowncast' ) .elementToElement( { model: 'widget', - view: ( modelItem, writer ) => { + view: ( modelItem, { writer } ) => { return writer.createContainerElement( 'div', { class: 'widget' } ); } } ) .elementToElement( { model: 'nested', - view: ( modelItem, writer ) => { + view: ( modelItem, { writer } ) => { return writer.createContainerElement( 'div', { class: 'nested' } ); } } ); @@ -54,7 +54,7 @@ ClassicEditor editor.conversion.for( 'editingDowncast' ) .elementToElement( { model: 'widget', - view: ( modelItem, writer ) => { + view: ( modelItem, { writer } ) => { const div = writer.createContainerElement( 'div', { class: 'widget' } ); return toWidget( div, writer, { label: 'widget label' } ); @@ -62,7 +62,7 @@ ClassicEditor } ) .elementToElement( { model: 'nested', - view: ( modelItem, writer ) => { + view: ( modelItem, { writer } ) => { const nested = writer.createEditableElement( 'div', { class: 'nested' } ); return toWidgetEditable( nested, writer ); diff --git a/packages/ckeditor5-widget/tests/verticalnavigation.js b/packages/ckeditor5-widget/tests/verticalnavigation.js index 103b3940a68..8c6f9a3b6be 100644 --- a/packages/ckeditor5-widget/tests/verticalnavigation.js +++ b/packages/ckeditor5-widget/tests/verticalnavigation.js @@ -1258,13 +1258,13 @@ describe( 'Widget - vertical keyboard navigation near widgets', () => { editor.conversion.for( 'dataDowncast' ) .elementToElement( { model: 'widget', - view: ( modelItem, writer ) => { + view: ( modelItem, { writer } ) => { return writer.createContainerElement( 'figure' ); } } ) .elementToElement( { model: 'nested', - view: ( modelItem, writer ) => { + view: ( modelItem, { writer } ) => { return writer.createContainerElement( 'figcaption' ); } } ); @@ -1272,7 +1272,7 @@ describe( 'Widget - vertical keyboard navigation near widgets', () => { editor.conversion.for( 'editingDowncast' ) .elementToElement( { model: 'widget', - view: ( modelItem, writer ) => { + view: ( modelItem, { writer } ) => { const div = writer.createContainerElement( 'figure' ); return toWidget( div, writer, { label: 'widget label' } ); @@ -1280,7 +1280,7 @@ describe( 'Widget - vertical keyboard navigation near widgets', () => { } ) .elementToElement( { model: 'nested', - view: ( modelItem, writer ) => { + view: ( modelItem, { writer } ) => { const nested = writer.createEditableElement( 'figcaption' ); return toWidgetEditable( nested, writer ); diff --git a/packages/ckeditor5-widget/tests/widget-integration.js b/packages/ckeditor5-widget/tests/widget-integration.js index b065f66019d..24950593b4a 100644 --- a/packages/ckeditor5-widget/tests/widget-integration.js +++ b/packages/ckeditor5-widget/tests/widget-integration.js @@ -68,27 +68,27 @@ describe( 'Widget - integration', () => { .elementToElement( { model: 'image', view: 'img' } ) .elementToElement( { model: 'widget', - view: ( modelItem, viewWriter ) => { - const div = viewWriter.createContainerElement( 'div' ); + view: ( modelItem, { writer } ) => { + const div = writer.createContainerElement( 'div' ); - return toWidget( div, viewWriter, { label: 'element label' } ); + return toWidget( div, writer, { label: 'element label' } ); } } ) .elementToElement( { model: 'inline-widget', - view: ( modelItem, viewWriter ) => { - const span = viewWriter.createContainerElement( 'span' ); + view: ( modelItem, { writer } ) => { + const span = writer.createContainerElement( 'span' ); - return toWidget( span, viewWriter ); + return toWidget( span, writer ); } } ) .elementToElement( { model: 'nested', - view: ( modelItem, viewWriter ) => viewWriter.createEditableElement( 'figcaption', { contenteditable: true } ) + view: ( modelItem, { writer } ) => writer.createEditableElement( 'figcaption', { contenteditable: true } ) } ) .elementToElement( { model: 'editable', - view: ( modelItem, viewWriter ) => viewWriter.createEditableElement( 'figcaption', { contenteditable: true } ) + view: ( modelItem, { writer } ) => writer.createEditableElement( 'figcaption', { contenteditable: true } ) } ); } ); } ); diff --git a/packages/ckeditor5-widget/tests/widget.js b/packages/ckeditor5-widget/tests/widget.js index 8f6ee9b11e0..dc2ad1a6026 100644 --- a/packages/ckeditor5-widget/tests/widget.js +++ b/packages/ckeditor5-widget/tests/widget.js @@ -90,29 +90,29 @@ describe( 'Widget', () => { .elementToElement( { model: 'div', view: 'div' } ) .elementToElement( { model: 'widget', - view: ( modelItem, viewWriter ) => { - const b = viewWriter.createAttributeElement( 'b' ); - const div = viewWriter.createContainerElement( 'div' ); - viewWriter.insert( viewWriter.createPositionAt( div, 0 ), b ); + view: ( modelItem, { writer } ) => { + const b = writer.createAttributeElement( 'b' ); + const div = writer.createContainerElement( 'div' ); + writer.insert( writer.createPositionAt( div, 0 ), b ); - return toWidget( div, viewWriter, { label: 'element label' } ); + return toWidget( div, writer, { label: 'element label' } ); } } ) .elementToElement( { model: 'inline-widget', - view: ( modelItem, viewWriter ) => { - const span = viewWriter.createContainerElement( 'span' ); + view: ( modelItem, { writer } ) => { + const span = writer.createContainerElement( 'span' ); - return toWidget( span, viewWriter ); + return toWidget( span, writer ); } } ) .elementToElement( { model: 'nested', - view: ( modelItem, viewWriter ) => viewWriter.createEditableElement( 'figcaption', { contenteditable: true } ) + view: ( modelItem, { writer } ) => writer.createEditableElement( 'figcaption', { contenteditable: true } ) } ) .elementToElement( { model: 'editable', - view: ( modelItem, viewWriter ) => viewWriter.createEditableElement( 'figcaption', { contenteditable: true } ) + view: ( modelItem, { writer } ) => writer.createEditableElement( 'figcaption', { contenteditable: true } ) } ); } ); } ); @@ -1288,15 +1288,15 @@ describe( 'Widget', () => { .elementToElement( { model: 'paragraph', view: 'p' } ) .elementToElement( { model: 'widget', - view: ( modelItem, viewWriter ) => { - const widget = viewWriter.createContainerElement( 'div' ); + view: ( modelItem, { writer } ) => { + const widget = writer.createContainerElement( 'div' ); - return toWidget( widget, viewWriter, { hasSelectionHandle: true } ); + return toWidget( widget, writer, { hasSelectionHandle: true } ); } } ) .elementToElement( { model: 'nested', - view: ( modelItem, viewWriter ) => viewWriter.createEditableElement( 'figcaption', { contenteditable: true } ) + view: ( modelItem, { writer } ) => writer.createEditableElement( 'figcaption', { contenteditable: true } ) } ); } ); } ); diff --git a/packages/ckeditor5-widget/tests/widgetresize.js b/packages/ckeditor5-widget/tests/widgetresize.js index 899e272f6b8..f1020cd4e7f 100644 --- a/packages/ckeditor5-widget/tests/widgetresize.js +++ b/packages/ckeditor5-widget/tests/widgetresize.js @@ -598,19 +598,19 @@ describe( 'WidgetResize', () => { editor.conversion.for( 'downcast' ) .elementToElement( { model: 'widget', - view: ( modelItem, viewWriter ) => { - const parentDiv = viewWriter.createContainerElement( 'div' ); - viewWriter.setStyle( 'height', '50px', parentDiv ); - viewWriter.setStyle( 'width', '25%', parentDiv ); // It evaluates to 100px. - - const subDiv = viewWriter.createContainerElement( 'div' ); - viewWriter.insert( viewWriter.createPositionAt( subDiv, 'start' ), viewWriter.createText( 'foo' ) ); - viewWriter.addClass( 'sub-div', subDiv ); - viewWriter.setStyle( 'height', '20px', subDiv ); - viewWriter.setStyle( 'width', '50px', subDiv ); - viewWriter.insert( viewWriter.createPositionAt( parentDiv, 'start' ), subDiv ); - - return toWidget( parentDiv, viewWriter, { + view: ( modelItem, { writer } ) => { + const parentDiv = writer.createContainerElement( 'div' ); + writer.setStyle( 'height', '50px', parentDiv ); + writer.setStyle( 'width', '25%', parentDiv ); // It evaluates to 100px. + + const subDiv = writer.createContainerElement( 'div' ); + writer.insert( writer.createPositionAt( subDiv, 'start' ), writer.createText( 'foo' ) ); + writer.addClass( 'sub-div', subDiv ); + writer.setStyle( 'height', '20px', subDiv ); + writer.setStyle( 'width', '50px', subDiv ); + writer.insert( writer.createPositionAt( parentDiv, 'start' ), subDiv ); + + return toWidget( parentDiv, writer, { label: 'element label' } ); } diff --git a/packages/ckeditor5-widget/tests/widgettoolbarrepository.js b/packages/ckeditor5-widget/tests/widgettoolbarrepository.js index dc9628c7eb8..36dfcad982d 100644 --- a/packages/ckeditor5-widget/tests/widgettoolbarrepository.js +++ b/packages/ckeditor5-widget/tests/widgettoolbarrepository.js @@ -742,18 +742,18 @@ class FakeWidget extends Plugin { conversion.for( 'dataDowncast' ).elementToElement( { model: 'fake-widget', - view: ( modelElement, viewWriter ) => { - return viewWriter.createContainerElement( 'div' ); + view: ( modelElement, { writer } ) => { + return writer.createContainerElement( 'div' ); } } ); conversion.for( 'editingDowncast' ).elementToElement( { model: 'fake-widget', - view: ( modelElement, viewWriter ) => { - const fakeWidget = viewWriter.createContainerElement( 'div' ); - viewWriter.setCustomProperty( 'fakeWidget', true, fakeWidget ); + view: ( modelElement, { writer } ) => { + const fakeWidget = writer.createContainerElement( 'div' ); + writer.setCustomProperty( 'fakeWidget', true, fakeWidget ); - return toWidget( fakeWidget, viewWriter, { label: 'fake-widget' } ); + return toWidget( fakeWidget, writer, { label: 'fake-widget' } ); } } ); @@ -794,18 +794,18 @@ class FakeChildWidget extends Plugin { conversion.for( 'dataDowncast' ).elementToElement( { model: 'fake-child-widget', - view: ( modelElement, viewWriter ) => { - return viewWriter.createContainerElement( 'div' ); + view: ( modelElement, { writer } ) => { + return writer.createContainerElement( 'div' ); } } ); conversion.for( 'editingDowncast' ).elementToElement( { model: 'fake-child-widget', - view: ( modelElement, viewWriter ) => { - const fakeWidget = viewWriter.createContainerElement( 'div' ); - viewWriter.setCustomProperty( 'fakeChildWidget', true, fakeWidget ); + view: ( modelElement, { writer } ) => { + const fakeWidget = writer.createContainerElement( 'div' ); + writer.setCustomProperty( 'fakeChildWidget', true, fakeWidget ); - return toWidget( fakeWidget, viewWriter, { label: 'fake-child-widget' } ); + return toWidget( fakeWidget, writer, { label: 'fake-child-widget' } ); } } ); diff --git a/packages/ckeditor5-widget/tests/widgettypearound/widgettypearound.js b/packages/ckeditor5-widget/tests/widgettypearound/widgettypearound.js index b5863be6fe7..41aa6ad03ad 100644 --- a/packages/ckeditor5-widget/tests/widgettypearound/widgettypearound.js +++ b/packages/ckeditor5-widget/tests/widgettypearound/widgettypearound.js @@ -1600,20 +1600,20 @@ describe( 'WidgetTypeAround', () => { editor.conversion.for( 'downcast' ) .elementToElement( { model: 'blockWidget', - view: ( modelItem, viewWriter ) => { - const container = viewWriter.createContainerElement( 'div' ); - const viewText = viewWriter.createText( 'block-widget' ); + view: ( modelItem, { writer } ) => { + const container = writer.createContainerElement( 'div' ); + const viewText = writer.createText( 'block-widget' ); - viewWriter.insert( viewWriter.createPositionAt( container, 0 ), viewText ); + writer.insert( writer.createPositionAt( container, 0 ), viewText ); - return toWidget( container, viewWriter, { + return toWidget( container, writer, { label: 'block widget' } ); } } ) .elementToElement( { model: 'nested', - view: ( modelItem, viewWriter ) => viewWriter.createEditableElement( 'nested', { contenteditable: true } ) + view: ( modelItem, { writer } ) => writer.createEditableElement( 'nested', { contenteditable: true } ) } ); } @@ -1627,13 +1627,13 @@ describe( 'WidgetTypeAround', () => { editor.conversion.for( 'downcast' ) .elementToElement( { model: 'inlineWidget', - view: ( modelItem, viewWriter ) => { - const container = viewWriter.createContainerElement( 'inlineWidget' ); - const viewText = viewWriter.createText( 'inline-widget' ); + view: ( modelItem, { writer } ) => { + const container = writer.createContainerElement( 'inlineWidget' ); + const viewText = writer.createText( 'inline-widget' ); - viewWriter.insert( viewWriter.createPositionAt( container, 0 ), viewText ); + writer.insert( writer.createPositionAt( container, 0 ), viewText ); - return toWidget( container, viewWriter, { + return toWidget( container, writer, { label: 'inline widget' } ); } diff --git a/packages/ckeditor5-word-count/lang/translations/ko.po b/packages/ckeditor5-word-count/lang/translations/ko.po new file mode 100644 index 00000000000..dfbb117626c --- /dev/null +++ b/packages/ckeditor5-word-count/lang/translations/ko.po @@ -0,0 +1,25 @@ +# Copyright (c) 2003-2020, 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: Korean (https://www.transifex.com/ckeditor/teams/11143/ko/)\n" +"Language: ko\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgctxt "Label showing the number of words in the editor content." +msgid "Words: %0" +msgstr "단어 수: %0" + +msgctxt "Label showing the number of characters in the editor content." +msgid "Characters: %0" +msgstr "문자 수: %0" diff --git a/scripts/docs/snippetadapter.js b/scripts/docs/snippetadapter.js index 6266084eb75..6a1669a4ecb 100644 --- a/scripts/docs/snippetadapter.js +++ b/scripts/docs/snippetadapter.js @@ -197,7 +197,7 @@ module.exports = function snippetAdapter( snippets, options, umbertoHelpers ) { } const cssImportsHTML = getHTMLImports( cssFiles, importPath => { - return ` `; + return ` `; } ); const jsImportsHTML = getHTMLImports( jsFiles, importPath => {