From fee59abe22f468edc758f45e1d6e9f850fe8afd0 Mon Sep 17 00:00:00 2001 From: godai78 Date: Tue, 9 Mar 2021 08:32:07 +0100 Subject: [PATCH 01/34] Docs: git conventions amended. --- .../git-commit-message-convention.md | 54 +++++++++++++++++-- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 703011cf46a..0043e8cf2e4 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -24,8 +24,8 @@ Type (another-package-name): If the change affects more than one package, it's p Optional description. -BREAKING CHANGE (package-name): If any breaking changes were done, they need to be listed here. -BREAKING CHANGE (package-name): Another breaking change if needed. Closes #ZZZ. +MAJOR BREAKING CHANGE (package-name): If any breaking changes were done, they need to be listed here. +MINOR BREAKING CHANGE (package-name): Another breaking change if needed. Closes #ZZZ. ``` ### Commit types @@ -43,14 +43,18 @@ BREAKING CHANGE (package-name): Another breaking change if needed. Closes #ZZZ. Each commit can contain additional notes that will be inserted into the changelog: -* `MAJOR BREAKING CHANGE` (alias: `BREAKING CHANGE`), +* `MAJOR BREAKING CHANGE`, * `MINOR BREAKING CHANGE`. If any change contains the `MAJOR BREAKING CHANGE` note, the next release will be marked as `major` automatically. For reference on how to identify minor or major breaking change see the {@link framework/guides/support/versioning-policy versioning policy guide}. -Each `BREAKING CHANGE` note must be followed by the package name. +Each `MAJOR BREAKING CHANGE` or `MINOR BREAKING CHANGE` note must be followed by the package name. + + + Remember to always specify whether the breaking change is `major` or `minor`. If you fail to do so, the system will assume all unspecified breaking changes are `major`. + ### Package name @@ -58,10 +62,50 @@ Most commits are related to one or more packages. Each affected package should b It is, however, possible to skip this part if many packages are affected. This usually indicates a generic change. In this case having all the packages listed would reduce the changelog readability. -The package name is based on the npm package name, however, it has the `@ckeditor/ckeditor(5)-` prefix stripped. +The package name is based on the npm package name, however, it has the `@ckeditor/ckeditor5-` prefix stripped. If your change is related to the main package only, use `ckeditor5` as the package name. + + If the commit introduces a breaking change across the entire project (a generic change), the package name does not have to be specified. + + +### Entries ordering + +The proper order for sections is as follows: +* Public +* Internal +* MAJOR/MINOR BREAKING CHANGES + +All entries must be separated with `\n`, otherwise the lines will not be treated separately. + +### Examples of proper and improper message formatting + +Example of a proper commit message: + +``` +Type: Message 1. + +Type: Message 2. +``` + +An example of invalid commit messages with incorrectly separated lines (the second line will just be treated as a part of the first line): + +``` +Type: Message 1. +Type: Message 2. +``` + +An example of invalid comment message a wrong section order (the "internal" message will be treated as a part of the BREAKING CHANGE message): + +``` +Public: Message 1. + +BREAKING CHANGE: A description. + +Internal: Message 2. +``` + ### Example commits A new feature without any breaking changes. From 433cffe8eb850615c52c374b2821d76ca8225be7 Mon Sep 17 00:00:00 2001 From: godai78 Date: Tue, 9 Mar 2021 14:34:33 +0100 Subject: [PATCH 02/34] Docs: minor fix. --- .../guides/contributing/git-commit-message-convention.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 0043e8cf2e4..28bc40fb501 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -89,14 +89,14 @@ Type: Message 1. Type: Message 2. ``` -An example of invalid commit messages with incorrectly separated lines (the second line will just be treated as a part of the first line): +An example of invalid commit message with incorrectly separated lines (the second line will just be treated as a part of the first line): ``` Type: Message 1. Type: Message 2. ``` -An example of invalid comment message a wrong section order (the "internal" message will be treated as a part of the BREAKING CHANGE message): +An example of invalid comment message with a wrong section order (the "internal" message will be treated as a part of the BREAKING CHANGE message): ``` Public: Message 1. From f86f2ebe9d4ef661bac78de821995e87a94ec4cb Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Wed, 10 Mar 2021 06:53:27 +0100 Subject: [PATCH 03/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 28bc40fb501..d637369d357 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -70,7 +70,7 @@ If your change is related to the main package only, use `ckeditor5` as the packa If the commit introduces a breaking change across the entire project (a generic change), the package name does not have to be specified. -### Entries ordering +### Order of entries The proper order for sections is as follows: * Public From 482acb73b9d6f0dd183cefbd18bcb155d5d4fd6e Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Wed, 10 Mar 2021 06:53:41 +0100 Subject: [PATCH 04/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index d637369d357..7255097e2be 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -72,7 +72,7 @@ If your change is related to the main package only, use `ckeditor5` as the packa ### Order of entries -The proper order for sections is as follows: +The proper order for sections of a commit message is as follows: * Public * Internal * MAJOR/MINOR BREAKING CHANGES From 8b4e1a85e746973be988698a0a1955569ee5f12b Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Wed, 10 Mar 2021 06:53:51 +0100 Subject: [PATCH 05/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 7255097e2be..b157a26a4ef 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -89,7 +89,7 @@ Type: Message 1. Type: Message 2. ``` -An example of invalid commit message with incorrectly separated lines (the second line will just be treated as a part of the first line): +An example of an invalid commit message with incorrectly separated lines (the second line will just be treated as a part of the first line): ``` Type: Message 1. From f0bcd1c6ff094676ff8dacf416a3c6ce51def346 Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Wed, 10 Mar 2021 06:54:07 +0100 Subject: [PATCH 06/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index b157a26a4ef..17b3ea544a9 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -96,7 +96,7 @@ Type: Message 1. Type: Message 2. ``` -An example of invalid comment message with a wrong section order (the "internal" message will be treated as a part of the BREAKING CHANGE message): +An example of an invalid commit message with an incorrect section order (the "internal" message will be treated as a part of the BREAKING CHANGE message): ``` Public: Message 1. From b249280c71095e2628f5408f9167281d344b255f Mon Sep 17 00:00:00 2001 From: godai78 Date: Wed, 10 Mar 2021 06:58:58 +0100 Subject: [PATCH 07/34] Docs: minor fixes. --- .../guides/contributing/git-commit-message-convention.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 17b3ea544a9..00da553a156 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -53,7 +53,7 @@ For reference on how to identify minor or major breaking change see the {@link f Each `MAJOR BREAKING CHANGE` or `MINOR BREAKING CHANGE` note must be followed by the package name. - Remember to always specify whether the breaking change is `major` or `minor`. If you fail to do so, the system will assume all unspecified breaking changes are `major`. + Remember to always specify whether the breaking change is major or minor. If you fail to do so, the system will assume all unspecified breaking changes are major. ### Package name @@ -77,7 +77,7 @@ The proper order for sections of a commit message is as follows: * Internal * MAJOR/MINOR BREAKING CHANGES -All entries must be separated with `\n`, otherwise the lines will not be treated separately. +All entries must be separated with `\n` (a blank line), otherwise the lines will not be treated separately. ### Examples of proper and improper message formatting From 6fba21fa5b6463d186eb8c17829648f91df4b5c8 Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Wed, 10 Mar 2021 09:43:14 +0100 Subject: [PATCH 08/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Kamil Piechaczek --- .../guides/contributing/git-commit-message-convention.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 00da553a156..72dcd6591c0 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -73,9 +73,9 @@ If your change is related to the main package only, use `ckeditor5` as the packa ### Order of entries The proper order for sections of a commit message is as follows: -* Public -* Internal -* MAJOR/MINOR BREAKING CHANGES +* Entries that should be added to the changelog +* Entries that will not be added to the changelog +* Breaking changes notes All entries must be separated with `\n` (a blank line), otherwise the lines will not be treated separately. From 642e75639cdcfdc54457cd84ab807ca8945825b3 Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Wed, 10 Mar 2021 09:47:47 +0100 Subject: [PATCH 09/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Kamil Piechaczek --- .../guides/contributing/git-commit-message-convention.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 72dcd6591c0..3ff3dad21c9 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -84,10 +84,11 @@ All entries must be separated with `\n` (a blank line), otherwise the lines will Example of a proper commit message: ``` -Type: Message 1. +Feature (scope-1): Message 1. -Type: Message 2. -``` +Fix (scope-2): Message 2. + +Tests: The change across the entire project. An example of an invalid commit message with incorrectly separated lines (the second line will just be treated as a part of the first line): From 541d56ac47fcae876cd828dc16bfb34ebaa56610 Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Wed, 10 Mar 2021 09:47:58 +0100 Subject: [PATCH 10/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Kamil Piechaczek --- .../guides/contributing/git-commit-message-convention.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 3ff3dad21c9..26018f93b6c 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -93,8 +93,9 @@ Tests: The change across the entire project. An example of an invalid commit message with incorrectly separated lines (the second line will just be treated as a part of the first line): ``` -Type: Message 1. -Type: Message 2. +Feature (package-name-1): Message 1. +Fix (package-name-2): Message 2. +Tests: Message 3. ``` An example of an invalid commit message with an incorrect section order (the "internal" message will be treated as a part of the BREAKING CHANGE message): From 418146a2cf34fb1a26648bcbc17cfafe822c0a1d Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Wed, 10 Mar 2021 09:48:53 +0100 Subject: [PATCH 11/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Kamil Piechaczek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 26018f93b6c..fe7a565ca38 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -101,7 +101,7 @@ Tests: Message 3. An example of an invalid commit message with an incorrect section order (the "internal" message will be treated as a part of the BREAKING CHANGE message): ``` -Public: Message 1. +Feature (package-name): Message 1. BREAKING CHANGE: A description. From 238be33ba5da2c925b2415bfc7642d901fb64d2a Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Wed, 10 Mar 2021 09:49:02 +0100 Subject: [PATCH 12/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Kamil Piechaczek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index fe7a565ca38..0870ed58023 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -103,7 +103,7 @@ An example of an invalid commit message with an incorrect section order (the "in ``` Feature (package-name): Message 1. -BREAKING CHANGE: A description. +MINOR BREAKING CHANGE (package-name): A description. Internal: Message 2. ``` From 30de6f3f019ca0c492156a1af8094572925792c4 Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Wed, 10 Mar 2021 13:52:20 +0100 Subject: [PATCH 13/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 0870ed58023..1732d1d241b 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -75,7 +75,7 @@ If your change is related to the main package only, use `ckeditor5` as the packa The proper order for sections of a commit message is as follows: * Entries that should be added to the changelog * Entries that will not be added to the changelog -* Breaking changes notes +* Breaking change notes All entries must be separated with `\n` (a blank line), otherwise the lines will not be treated separately. From 894c53ed653dd027c4c6d98bf251475ab7d69cea Mon Sep 17 00:00:00 2001 From: Kamil Piechaczek Date: Wed, 10 Mar 2021 13:59:27 +0100 Subject: [PATCH 14/34] Minor fixes. --- .../guides/contributing/git-commit-message-convention.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 1732d1d241b..bb99048931c 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -84,11 +84,12 @@ All entries must be separated with `\n` (a blank line), otherwise the lines will Example of a proper commit message: ``` -Feature (scope-1): Message 1. +Feature (package-name-1): Message 1. -Fix (scope-2): Message 2. +Fix (package-name-2): Message 2. Tests: The change across the entire project. +``` An example of an invalid commit message with incorrectly separated lines (the second line will just be treated as a part of the first line): From 197af585f7685b3abb3959e09acdf4e0303cec0d Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Thu, 11 Mar 2021 16:39:28 +0100 Subject: [PATCH 15/34] Update docs/framework/guides/contributing/git-commit-message-convention.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Piotrek KoszuliΕ„ski --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index bb99048931c..b5645293147 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -77,7 +77,7 @@ The proper order for sections of a commit message is as follows: * Entries that will not be added to the changelog * Breaking change notes -All entries must be separated with `\n` (a blank line), otherwise the lines will not be treated separately. +All entries must be separated with a blank line, otherwise the lines will not be treated separately. ### Examples of proper and improper message formatting From c60a080218c1af4bf7c41657e35ff7639801e8f7 Mon Sep 17 00:00:00 2001 From: godai78 Date: Mon, 15 Mar 2021 12:58:40 +0100 Subject: [PATCH 16/34] Docs: adding known issues section. --- .../docs/features/paste-from-word.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md index e5ba0b526f6..27d3aed0fc3 100644 --- a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md +++ b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md @@ -29,7 +29,7 @@ To test how Paste from Office works, download the [sample Word document](../../a {@snippet features/paste-from-office} ## Related features - + CKEditor 5 supports a wider range of paste features, including: * {@link features/paste-from-google-docs Paste from Google Docs} – Paste content from Google Docs, maintaining the original formatting and structure. * {@link features/paste-plain-text Paste plain text} – Paste text without formatting that will inherit the style of the content it was pasted into. @@ -64,6 +64,9 @@ ClassicEditor .then( ... ) .catch( ... ); ``` +## Known issues + +Sometimes if the document pasted contains both styled headers and images, it may happen that the images are not pasted properly. This was noted on certain macOS configurations and should not cause problems for Windows, however. Refer to [this GitHub issue](https://github.com/ckeditor/ckeditor5/issues/2493#issuecomment-749507634) for more details. ## Support for other applications From 2e2e11ab62c2604fe82275cc81576dafc21f25cf Mon Sep 17 00:00:00 2001 From: godai78 Date: Mon, 15 Mar 2021 13:01:51 +0100 Subject: [PATCH 17/34] Docs: minor change. --- .../docs/features/paste-from-word.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md index 27d3aed0fc3..8d5711f0114 100644 --- a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md +++ b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md @@ -66,7 +66,7 @@ ClassicEditor ``` ## Known issues -Sometimes if the document pasted contains both styled headers and images, it may happen that the images are not pasted properly. This was noted on certain macOS configurations and should not cause problems for Windows, however. Refer to [this GitHub issue](https://github.com/ckeditor/ckeditor5/issues/2493#issuecomment-749507634) for more details. +Sometimes if the document pasted contains both images and styled text (e.g. headers), it may happen that the images are not pasted properly. This was noted on certain macOS configurations and should not cause problems for Windows, however. Refer to [this GitHub issue](https://github.com/ckeditor/ckeditor5/issues/2493#issuecomment-749507634) for more details. ## Support for other applications From 48451f183be1ea7b3d443cb8cb39d547c1fb1f2c Mon Sep 17 00:00:00 2001 From: godai78 Date: Mon, 15 Mar 2021 13:16:49 +0100 Subject: [PATCH 18/34] Docs: expanding; minor changes. --- .../docs/features/paste-from-word.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md index 8d5711f0114..73da01b7d8d 100644 --- a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md +++ b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md @@ -64,10 +64,6 @@ ClassicEditor .then( ... ) .catch( ... ); ``` -## Known issues - -Sometimes if the document pasted contains both images and styled text (e.g. headers), it may happen that the images are not pasted properly. This was noted on certain macOS configurations and should not cause problems for Windows, however. Refer to [this GitHub issue](https://github.com/ckeditor/ckeditor5/issues/2493#issuecomment-749507634) for more details. - ## Support for other applications At the current stage, the focus of the `@ckeditor/ckeditor5-paste-from-office` package is on supporting content that comes from Microsoft Word and {@link features/paste-from-google-docs Google Docs}. However, it does not mean that pasting from other similar applications (such as Microsoft Excel) is not supported. @@ -76,10 +72,18 @@ By default, CKEditor 5 will support pasting rich-text content from these applica You can find more information regarding compatibility with other applications in [this ticket](https://github.com/ckeditor/ckeditor5/issues/1184#issuecomment-409828069). -If you think that support for any of the applications needs improvements, please add πŸ‘ and comments in the following issues: +If you think that support for any of the applications needs improvements, please add πŸ‘  and comments in the following issues: * [Support pasting from Excel](https://github.com/ckeditor/ckeditor5/issues/2513). * [Support pasting from Libre Office](https://github.com/ckeditor/ckeditor5/issues/2520). * [Support pasting from Pages](https://github.com/ckeditor/ckeditor5/issues/2527). Feel free to open a [new feature request](https://github.com/ckeditor/ckeditor5/issues/new/choose) for other similar applications, too! + +## Known issues + +Sometimes if the document pasted contains both images and styled text (e.g. headers), it may happen that the images are not pasted properly. This was noticed on certain macOS configurations and should not cause problems for Windows, however. + +If the image is included into the content with the `` syntax it will not be pasted either, as this notation is not yet supported by CKEditor 5. + +We are currently working on handling this error. Refer to [this GitHub issue](https://github.com/ckeditor/ckeditor5/issues/2493#issuecomment-749507634) for more details. From 2b804320bc3f3ad159b33b9e94e821e3ec6968b0 Mon Sep 17 00:00:00 2001 From: godai78 Date: Tue, 16 Mar 2021 07:07:51 +0100 Subject: [PATCH 19/34] Docs: information changes. --- .../docs/features/paste-from-word.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md index 73da01b7d8d..35159045e76 100644 --- a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md +++ b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md @@ -82,8 +82,8 @@ Feel free to open a [new feature request](https://github.com/ckeditor/ckeditor5/ ## Known issues -Sometimes if the document pasted contains both images and styled text (e.g. headers), it may happen that the images are not pasted properly. This was noticed on certain macOS configurations and should not cause problems for Windows, however. +Sometimes if the document pasted contains both images and styled text (e.g. headers), it may happen that the images are not pasted properly. This will not happen if the pasted content with an image does not contain styled elements. If the image is included into the content with the `` syntax it will not be pasted either, as this notation is not yet supported by CKEditor 5. -We are currently working on handling this error. Refer to [this GitHub issue](https://github.com/ckeditor/ckeditor5/issues/2493#issuecomment-749507634) for more details. +It is advised to try and paste the image separately from the body of the text if this error occurs. From fd85914cc50cb785a03889008c60bb3872fa4d91 Mon Sep 17 00:00:00 2001 From: godai78 Date: Tue, 16 Mar 2021 11:45:48 +0100 Subject: [PATCH 20/34] Docs: follow-up on GitHub link. --- .../docs/features/paste-from-word.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md index 35159045e76..34d3739d6a9 100644 --- a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md +++ b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md @@ -84,6 +84,6 @@ Feel free to open a [new feature request](https://github.com/ckeditor/ckeditor5/ Sometimes if the document pasted contains both images and styled text (e.g. headers), it may happen that the images are not pasted properly. This will not happen if the pasted content with an image does not contain styled elements. -If the image is included into the content with the `` syntax it will not be pasted either, as this notation is not yet supported by CKEditor 5. - It is advised to try and paste the image separately from the body of the text if this error occurs. + +If the image is included into the content with the VML syntax (like this one: ``) it will not be pasted either, as this notation is not yet supported by CKEditor 5. If you'd like to see this feature implemented, add a πŸ‘  reaction to [this GitHub issue](https://github.com/ckeditor/ckeditor5/issues/9245). From 114332c6e0105fdbba55661555d92ef38565b2f1 Mon Sep 17 00:00:00 2001 From: Anna Tomanek Date: Tue, 16 Mar 2021 14:42:12 +0100 Subject: [PATCH 21/34] Docs: Updated the known issues note. --- .../docs/features/paste-from-word.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md index 34d3739d6a9..b632aa9f2e2 100644 --- a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md +++ b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md @@ -82,8 +82,8 @@ Feel free to open a [new feature request](https://github.com/ckeditor/ckeditor5/ ## Known issues -Sometimes if the document pasted contains both images and styled text (e.g. headers), it may happen that the images are not pasted properly. This will not happen if the pasted content with an image does not contain styled elements. +If the pasted document contains both images and styled text (e.g. headings), it may happen that the images are not pasted properly. Unfortunately, for some operating system, browser and Word versions the image data is not available in the clipboard in this case. It is advised to try and paste the image separately from the body of the text if this error occurs. -If the image is included into the content with the VML syntax (like this one: ``) it will not be pasted either, as this notation is not yet supported by CKEditor 5. If you'd like to see this feature implemented, add a πŸ‘  reaction to [this GitHub issue](https://github.com/ckeditor/ckeditor5/issues/9245). +If the image is represented in the Word content by the VML syntax (like this one: ``) it will not be pasted either, as this notation is not supported by CKEditor 5. If you'd like to see this feature implemented, add a πŸ‘  reaction to [this GitHub issue](https://github.com/ckeditor/ckeditor5/issues/9245). From 1c9cad14a5c91348067e031ebde04b81b6688b58 Mon Sep 17 00:00:00 2001 From: Marek Lewandowski Date: Tue, 16 Mar 2021 14:58:52 +0100 Subject: [PATCH 22/34] Fixed (highlight): The remove highlight button now also gets disabled along with the main highlight command. --- .../ckeditor5-highlight/src/highlightui.js | 10 +++++-- .../ckeditor5-highlight/tests/highlightui.js | 29 +++++++++++++++++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/packages/ckeditor5-highlight/src/highlightui.js b/packages/ckeditor5-highlight/src/highlightui.js index 0c6a545f635..6ef07e6288e 100644 --- a/packages/ckeditor5-highlight/src/highlightui.js +++ b/packages/ckeditor5-highlight/src/highlightui.js @@ -94,8 +94,11 @@ export default class HighlightUI extends Plugin { */ _addRemoveHighlightButton() { const t = this.editor.t; + const command = this.editor.commands.get( 'highlight' ); - this._addButton( 'removeHighlight', t( 'Remove highlight' ), icons.eraser ); + this._addButton( 'removeHighlight', t( 'Remove highlight' ), icons.eraser, null, button => { + button.bind( 'isEnabled' ).to( command, 'isEnabled' ); + } ); } /** @@ -124,10 +127,11 @@ export default class HighlightUI extends Plugin { * @param {String} name The name of the button. * @param {String} label The label for the button. * @param {String} icon The button icon. - * @param {Function} [decorateButton=()=>{}] Additional method for extending the button. + * @param {String/null} value The `value` property passed to the executed command. + * @param {Function} decorateButton A callback getting ButtonView instance so that it can be further customized. * @private */ - _addButton( name, label, icon, value, decorateButton = () => {} ) { + _addButton( name, label, icon, value, decorateButton ) { const editor = this.editor; editor.ui.componentFactory.add( name, locale => { diff --git a/packages/ckeditor5-highlight/tests/highlightui.js b/packages/ckeditor5-highlight/tests/highlightui.js index 2f13dd2399d..00a4a73738e 100644 --- a/packages/ckeditor5-highlight/tests/highlightui.js +++ b/packages/ckeditor5-highlight/tests/highlightui.js @@ -58,6 +58,7 @@ describe( 'HighlightUI', () => { } ) .then( newEditor => { editor = newEditor; + command = editor.commands.get( 'highlight' ); } ); } ); @@ -67,11 +68,10 @@ describe( 'HighlightUI', () => { return editor.destroy(); } ); - describe( 'highlight Dropdown', () => { + describe( 'highlight dropdown', () => { let dropdown; beforeEach( () => { - command = editor.commands.get( 'highlight' ); dropdown = editor.ui.componentFactory.create( 'highlight' ); } ); @@ -246,4 +246,29 @@ describe( 'HighlightUI', () => { } } ); } ); + + describe( 'highlight remove', () => { + let removeHighlightButton; + + beforeEach( () => { + removeHighlightButton = editor.ui.componentFactory.create( 'removeHighlight' ); + } ); + + it( 'removeButton has the base properties', () => { + expect( editor.ui.componentFactory.has( 'removeHighlight' ) ).to.be.true; + expect( removeHighlightButton ).to.have.property( 'tooltip', true ); + expect( removeHighlightButton ).to.have.property( 'label', 'Remove highlight' ); + expect( removeHighlightButton ).to.have.property( 'icon', eraserIcon ); + } ); + + describe( 'model to command binding', () => { + it( 'isEnabled', () => { + command.isEnabled = false; + expect( removeHighlightButton.isEnabled ).to.be.false; + + command.isEnabled = true; + expect( removeHighlightButton.isEnabled ).to.be.true; + } ); + } ); + } ); } ); From 6555125ff095c682fd1bcf69cc0eedac9bd7f796 Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:49:22 +0100 Subject: [PATCH 23/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index b5645293147..c6ea289e5e8 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -99,7 +99,7 @@ Fix (package-name-2): Message 2. Tests: Message 3. ``` -An example of an invalid commit message with an incorrect section order (the "internal" message will be treated as a part of the BREAKING CHANGE message): +An example of an invalid commit message with an incorrect section order (the "internal" message will be treated as a part of the breaking change message): ``` Feature (package-name): Message 1. From e0f8df2ebf973bafd80d6f59f85b525074025f8a Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:49:36 +0100 Subject: [PATCH 24/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index c6ea289e5e8..a11fe4a8a5d 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -88,7 +88,7 @@ Feature (package-name-1): Message 1. Fix (package-name-2): Message 2. -Tests: The change across the entire project. +Tests: A change across the entire project. ``` An example of an invalid commit message with incorrectly separated lines (the second line will just be treated as a part of the first line): From b8c5f05eda6111ca7ba3504531907d4ff4f8ab4f Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:49:46 +0100 Subject: [PATCH 25/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index a11fe4a8a5d..08042c529da 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -79,7 +79,7 @@ The proper order for sections of a commit message is as follows: All entries must be separated with a blank line, otherwise the lines will not be treated separately. -### Examples of proper and improper message formatting +### Examples of correct and incorrect message formatting Example of a proper commit message: From babfa82c5325f4f2feae42300491fef8235911b7 Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:49:57 +0100 Subject: [PATCH 26/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 08042c529da..86e336eca99 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -77,7 +77,7 @@ The proper order for sections of a commit message is as follows: * Entries that will not be added to the changelog * Breaking change notes -All entries must be separated with a blank line, otherwise the lines will not be treated separately. +All entries must be separated with a blank line, otherwise the lines will not be treated as separate entries. ### Examples of correct and incorrect message formatting From 7c0c47611e34aae6d94ab3b742f056b769b8f204 Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:51:04 +0100 Subject: [PATCH 27/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 86e336eca99..fba603e7593 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -73,7 +73,7 @@ If your change is related to the main package only, use `ckeditor5` as the packa ### Order of entries The proper order for sections of a commit message is as follows: -* Entries that should be added to the changelog +* Entries that should be added to the changelog. * Entries that will not be added to the changelog * Breaking change notes From bfc720d3d601714506d62877352bd9484f1af119 Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:51:12 +0100 Subject: [PATCH 28/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index fba603e7593..147955990ba 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -74,7 +74,7 @@ If your change is related to the main package only, use `ckeditor5` as the packa The proper order for sections of a commit message is as follows: * Entries that should be added to the changelog. -* Entries that will not be added to the changelog +* Entries that will not be added to the changelog. * Breaking change notes All entries must be separated with a blank line, otherwise the lines will not be treated as separate entries. From ac21c25b7b1d30763416b3d6fb7d3879455bf43e Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:51:20 +0100 Subject: [PATCH 29/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 147955990ba..9a6889c9047 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -75,7 +75,7 @@ If your change is related to the main package only, use `ckeditor5` as the packa The proper order for sections of a commit message is as follows: * Entries that should be added to the changelog. * Entries that will not be added to the changelog. -* Breaking change notes +* Breaking change notes. All entries must be separated with a blank line, otherwise the lines will not be treated as separate entries. From 6b0abc57af901ea4238a86618b84215ebba595d8 Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:51:35 +0100 Subject: [PATCH 30/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index 9a6889c9047..a0c0750c891 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -72,7 +72,7 @@ If your change is related to the main package only, use `ckeditor5` as the packa ### Order of entries -The proper order for sections of a commit message is as follows: +The proper order of sections for a commit message is as follows: * Entries that should be added to the changelog. * Entries that will not be added to the changelog. * Breaking change notes. From 7a879332c811e1605250675c47b482ef6789d4c1 Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki <68123541+godai78@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:51:48 +0100 Subject: [PATCH 31/34] Update docs/framework/guides/contributing/git-commit-message-convention.md Co-authored-by: Anna Tomanek --- .../guides/contributing/git-commit-message-convention.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/framework/guides/contributing/git-commit-message-convention.md b/docs/framework/guides/contributing/git-commit-message-convention.md index a0c0750c891..9ec47f8ec44 100644 --- a/docs/framework/guides/contributing/git-commit-message-convention.md +++ b/docs/framework/guides/contributing/git-commit-message-convention.md @@ -46,7 +46,7 @@ Each commit can contain additional notes that will be inserted into the changelo * `MAJOR BREAKING CHANGE`, * `MINOR BREAKING CHANGE`. -If any change contains the `MAJOR BREAKING CHANGE` note, the next release will be marked as `major` automatically. +If any change contains the `MAJOR BREAKING CHANGE` note, the next release will automatically be marked as `major`. For reference on how to identify minor or major breaking change see the {@link framework/guides/support/versioning-policy versioning policy guide}. From 3de90dcde2a5ce88a143173c2c87a448112bc44b Mon Sep 17 00:00:00 2001 From: Szymon Cofalik Date: Tue, 16 Mar 2021 16:03:11 +0100 Subject: [PATCH 32/34] Feature: Added attributes support for widgets in default markers highlight downcast conversion. --- .../src/conversion/downcasthelpers.js | 11 ++--- .../tests/conversion/downcasthelpers.js | 16 +++---- packages/ckeditor5-widget/src/utils.js | 43 ++++++++++++++++--- packages/ckeditor5-widget/tests/utils.js | 20 ++++++++- 4 files changed, 69 insertions(+), 21 deletions(-) diff --git a/packages/ckeditor5-engine/src/conversion/downcasthelpers.js b/packages/ckeditor5-engine/src/conversion/downcasthelpers.js index 37e53525699..acfd26b880e 100644 --- a/packages/ckeditor5-engine/src/conversion/downcasthelpers.js +++ b/packages/ckeditor5-engine/src/conversion/downcasthelpers.js @@ -360,18 +360,19 @@ export default class DowncastHelpers extends ConversionHelpers { * * editor.conversion.for( 'downcast' ).markerToHighlight( { * model: 'comment', - * view: { classes: 'new-comment' }, + * view: { classes: 'comment' }, * converterPriority: 'high' * } ); * * editor.conversion.for( 'downcast' ).markerToHighlight( { * model: 'comment', - * view: ( data, converstionApi ) => { - * // Assuming that the marker name is in a form of comment:commentType. - * const commentType = data.markerName.split( ':' )[ 1 ]; + * view: ( data, conversionApi ) => { + * // Assuming that the marker name is in a form of comment:commentType:commentId. + * const [ , commentType, commentId ] = data.markerName.split( ':' ); * * return { - * classes: [ 'comment', 'comment-' + commentType ] + * classes: [ 'comment', 'comment-' + commentType ], + * attributes: { 'data-comment-id': commentId } * }; * } * } ); diff --git a/packages/ckeditor5-engine/tests/conversion/downcasthelpers.js b/packages/ckeditor5-engine/tests/conversion/downcasthelpers.js index 485fc04327b..86cbbbe6bd5 100644 --- a/packages/ckeditor5-engine/tests/conversion/downcasthelpers.js +++ b/packages/ckeditor5-engine/tests/conversion/downcasthelpers.js @@ -2673,14 +2673,12 @@ describe( 'DowncastHelpers', () => { it( 'config.view is a function', () => { downcastHelpers.markerToHighlight( { model: 'comment', - view: ( data, conversionApi ) => { - const commentType = data.markerName.split( ':' )[ 1 ]; - - // To ensure conversion API is provided. - expect( conversionApi.writer ).to.instanceof( DowncastWriter ); - + view: data => { + // Assuming that the marker name is in a form of comment:commentType:commentId. + const [ , commentType, commentId ] = data.markerName.split( ':' ); return { - classes: [ 'comment', 'comment-' + commentType ] + classes: [ 'comment', 'comment-' + commentType ], + attributes: { 'data-comment-id': commentId } }; } } ); @@ -2688,10 +2686,10 @@ describe( 'DowncastHelpers', () => { model.change( writer => { writer.insertText( 'foo', modelRoot, 0 ); const range = writer.createRange( writer.createPositionAt( modelRoot, 0 ), writer.createPositionAt( modelRoot, 3 ) ); - writer.addMarker( 'comment:abc', { range, usingOperation: false } ); + writer.addMarker( 'comment:abc:id', { range, usingOperation: false } ); } ); - expectResult( 'foo' ); + expectResult( 'foo' ); } ); describe( 'highlight', () => { diff --git a/packages/ckeditor5-widget/src/utils.js b/packages/ckeditor5-widget/src/utils.js index cfea60e989f..3bc7abb41db 100644 --- a/packages/ckeditor5-widget/src/utils.js +++ b/packages/ckeditor5-widget/src/utils.js @@ -124,16 +124,47 @@ export function toWidget( element, writer, options = {} ) { addSelectionHandle( element, writer ); } - setHighlightHandling( - element, - writer, - ( element, descriptor, writer ) => writer.addClass( toArray( descriptor.classes ), element ), - ( element, descriptor, writer ) => writer.removeClass( toArray( descriptor.classes ), element ) - ); + setHighlightHandling( element, writer, addHighlight, removeHighlight ); return element; } +// Default handler for adding a highlight on a widget. +// It adds CSS class and attributes basing on the given highlight descriptor. +// +// @param {module:engine/view/element~Element} element +// @param {module:engine/conversion/downcasthelpers~HighlightDescriptor} descriptor +// @param {module:engine/view/downcastwriter~DowncastWriter} writer +function addHighlight( element, descriptor, writer ) { + if ( descriptor.classes ) { + writer.addClass( toArray( descriptor.classes ), element ); + } + + if ( descriptor.attributes ) { + for ( const key in descriptor.attributes ) { + writer.setAttribute( key, descriptor.attributes[ key ], element ); + } + } +} + +// Default handler for removing a highlight from a widget. +// It removes CSS class and attributes basing on the given highlight descriptor. +// +// @param {module:engine/view/element~Element} element +// @param {module:engine/conversion/downcasthelpers~HighlightDescriptor} descriptor +// @param {module:engine/view/downcastwriter~DowncastWriter} writer +function removeHighlight( element, descriptor, writer ) { + if ( descriptor.classes ) { + writer.removeClass( toArray( descriptor.classes ), element ); + } + + if ( descriptor.attributes ) { + for ( const key in descriptor.attributes ) { + writer.removeAttribute( key, element ); + } + } +} + /** * Sets highlight handling methods. Uses {@link module:widget/highlightstack~HighlightStack} to * properly determine which highlight descriptor should be used at given time. diff --git a/packages/ckeditor5-widget/tests/utils.js b/packages/ckeditor5-widget/tests/utils.js index 3671549da7a..6d930c10464 100644 --- a/packages/ckeditor5-widget/tests/utils.js +++ b/packages/ckeditor5-widget/tests/utils.js @@ -74,7 +74,7 @@ describe( 'widget utils', () => { expect( getLabel( element ) ).to.equal( 'foo bar baz label' ); } ); - it( 'should set default highlight handling methods', () => { + it( 'should set default highlight handling methods - CSS class', () => { toWidget( element, writer ); const set = element.getCustomProperty( 'addHighlight' ); @@ -108,6 +108,24 @@ describe( 'widget utils', () => { expect( element.hasClass( 'foo' ) ).to.be.false; } ); + it( 'should set default highlight handling methods - attributes', () => { + toWidget( element, writer ); + + const set = element.getCustomProperty( 'addHighlight' ); + const remove = element.getCustomProperty( 'removeHighlight' ); + + expect( typeof set ).to.equal( 'function' ); + expect( typeof remove ).to.equal( 'function' ); + + set( element, { priority: 1, attributes: { foo: 'bar', abc: 'xyz' }, id: 'highlight' }, writer ); + expect( element.getAttribute( 'foo' ) ).to.equal( 'bar' ); + expect( element.getAttribute( 'abc' ) ).to.equal( 'xyz' ); + + remove( element, 'highlight', writer ); + expect( element.hasAttribute( 'foo' ) ).to.be.false; + expect( element.hasAttribute( 'abc' ) ).to.be.false; + } ); + it( 'should add element a selection handle to widget if hasSelectionHandle=true is passed', () => { toWidget( element, writer, { hasSelectionHandle: true } ); From c6f528845dc85e228deb77088d89c74d22668a0a Mon Sep 17 00:00:00 2001 From: Marek Lewandowski Date: Tue, 16 Mar 2021 21:53:01 +0100 Subject: [PATCH 33/34] Fixed parameter annotation type. --- packages/ckeditor5-highlight/src/highlightui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ckeditor5-highlight/src/highlightui.js b/packages/ckeditor5-highlight/src/highlightui.js index 6ef07e6288e..408a9f7b4ba 100644 --- a/packages/ckeditor5-highlight/src/highlightui.js +++ b/packages/ckeditor5-highlight/src/highlightui.js @@ -127,7 +127,7 @@ export default class HighlightUI extends Plugin { * @param {String} name The name of the button. * @param {String} label The label for the button. * @param {String} icon The button icon. - * @param {String/null} value The `value` property passed to the executed command. + * @param {*} value The `value` property passed to the executed command. * @param {Function} decorateButton A callback getting ButtonView instance so that it can be further customized. * @private */ From b4c2f54f6a4924f77b17c402645e90535dfc703b Mon Sep 17 00:00:00 2001 From: Anna Tomanek Date: Wed, 17 Mar 2021 07:23:11 +0100 Subject: [PATCH 34/34] Update packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md --- .../docs/features/paste-from-word.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md index b632aa9f2e2..57d13259597 100644 --- a/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md +++ b/packages/ckeditor5-paste-from-office/docs/features/paste-from-word.md @@ -86,4 +86,4 @@ If the pasted document contains both images and styled text (e.g. headings), it It is advised to try and paste the image separately from the body of the text if this error occurs. -If the image is represented in the Word content by the VML syntax (like this one: ``) it will not be pasted either, as this notation is not supported by CKEditor 5. If you'd like to see this feature implemented, add a πŸ‘  reaction to [this GitHub issue](https://github.com/ckeditor/ckeditor5/issues/9245). +If the image is represented in the Word content by the VML syntax (like this one: ``), it will not be pasted either as this notation is not supported by CKEditor 5. If you'd like to see this feature implemented, add a πŸ‘  reaction to [this GitHub issue](https://github.com/ckeditor/ckeditor5/issues/9245).