@ckeditor/ckeditor5-autoformat 40.1.0 → 41.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -33
- package/LICENSE.md +1 -1
- package/build/autoformat.js +1 -1
- package/package.json +3 -2
- package/src/augmentation.d.ts +2 -2
- package/src/augmentation.js +1 -1
- package/src/autoformat.d.ts +3 -3
- package/src/autoformat.js +5 -5
- package/src/blockautoformatediting.d.ts +3 -3
- package/src/blockautoformatediting.js +3 -3
- package/src/index.d.ts +3 -3
- package/src/index.js +3 -3
- package/src/inlineautoformatediting.d.ts +4 -4
- package/src/inlineautoformatediting.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,24 +5,24 @@ All changes in the package are documented in the main repository. See: https://g
|
|
|
5
5
|
|
|
6
6
|
Changes for the past releases are available below.
|
|
7
7
|
|
|
8
|
-
## [19.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v18.0.0...v19.0.0) (2020
|
|
8
|
+
## [19.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v18.0.0...v19.0.0) (April 29, 2020)
|
|
9
9
|
|
|
10
10
|
### Features
|
|
11
11
|
|
|
12
|
-
* Added
|
|
12
|
+
* Added autoformat integration with the strikethrough using `~~` string. Closes [ckeditor/ckeditor5#6412](https://github.com/ckeditor/ckeditor5/issues/6412). ([9c3fd3e](https://github.com/ckeditor/ckeditor5-autoformat/commit/9c3fd3e))
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
## [18.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v17.0.0...v18.0.0) (2020
|
|
15
|
+
## [18.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v17.0.0...v18.0.0) (March 19, 2020)
|
|
16
16
|
|
|
17
17
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
## [17.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v16.0.0...v17.0.0) (2020
|
|
20
|
+
## [17.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v16.0.0...v17.0.0) (February 18, 2020)
|
|
21
21
|
|
|
22
22
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
## [16.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v15.0.0...v16.0.0) (2019
|
|
25
|
+
## [16.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v15.0.0...v16.0.0) (December 4, 2019)
|
|
26
26
|
|
|
27
27
|
### Features
|
|
28
28
|
|
|
@@ -30,10 +30,10 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
30
30
|
|
|
31
31
|
### Bug fixes
|
|
32
32
|
|
|
33
|
-
* `BlockAutoformat` should not react to text typed after inline element. Closes [ckeditor/ckeditor5#5671](https://github.com/ckeditor/ckeditor5/issues/5671). ([241c294](https://github.com/ckeditor/ckeditor5-autoformat/commit/241c294))
|
|
33
|
+
* `BlockAutoformat` should not react to text typed after an inline element. Closes [ckeditor/ckeditor5#5671](https://github.com/ckeditor/ckeditor5/issues/5671). ([241c294](https://github.com/ckeditor/ckeditor5-autoformat/commit/241c294))
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
## [15.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.5...v15.0.0) (2019
|
|
36
|
+
## [15.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.5...v15.0.0) (October 23, 2019)
|
|
37
37
|
|
|
38
38
|
### Bug fixes
|
|
39
39
|
|
|
@@ -44,36 +44,36 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
44
44
|
* Add `pluginName` property to editing plugins. ([44fcbc7](https://github.com/ckeditor/ckeditor5-autoformat/commit/44fcbc7))
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
## [11.0.5](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.4...v11.0.5) (2019
|
|
47
|
+
## [11.0.5](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.4...v11.0.5) (August 26, 2019)
|
|
48
48
|
|
|
49
49
|
### Other changes
|
|
50
50
|
|
|
51
51
|
* The issue tracker for this package was moved to https://github.com/ckeditor/ckeditor5/issues. See [ckeditor/ckeditor5#1988](https://github.com/ckeditor/ckeditor5/issues/1988). ([65f5d11](https://github.com/ckeditor/ckeditor5-autoformat/commit/65f5d11))
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
## [11.0.4](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.3...v11.0.4) (2019
|
|
54
|
+
## [11.0.4](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.3...v11.0.4) (July 10, 2019)
|
|
55
55
|
|
|
56
56
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
## [11.0.3](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.2...v11.0.3) (2019
|
|
59
|
+
## [11.0.3](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.2...v11.0.3) (July 4, 2019)
|
|
60
60
|
|
|
61
61
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
## [11.0.2](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.1...v11.0.2) (2019
|
|
64
|
+
## [11.0.2](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.1...v11.0.2) (June 6, 2019)
|
|
65
65
|
|
|
66
66
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
## [11.0.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.0...v11.0.1) (2019
|
|
69
|
+
## [11.0.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v11.0.0...v11.0.1) (April 4, 2019)
|
|
70
70
|
|
|
71
71
|
### Other changes
|
|
72
72
|
|
|
73
|
-
* Any digit followed by a dot
|
|
73
|
+
* Any digit followed by a dot will not trigger the numbered list. Now, only `1` is supported by the `Autoformat` plugin. Closes [#60](https://github.com/ckeditor/ckeditor5-autoformat/issues/60). ([c7c4662](https://github.com/ckeditor/ckeditor5-autoformat/commit/c7c4662))
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
## [11.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v10.0.4...v11.0.0) (2019
|
|
76
|
+
## [11.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v10.0.4...v11.0.0) (February 28, 2019)
|
|
77
77
|
|
|
78
78
|
### Features
|
|
79
79
|
|
|
@@ -85,27 +85,27 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
85
85
|
* Upgraded minimal versions of Node to `8.0.0` and npm to `5.7.1`. See: [ckeditor/ckeditor5#1507](https://github.com/ckeditor/ckeditor5/issues/1507). ([612ea3c](https://github.com/ckeditor/ckeditor5-cloud-services/commit/612ea3c))
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
## [10.0.4](https://github.com/ckeditor/ckeditor5-autoformat/compare/v10.0.3...v10.0.4) (2018
|
|
88
|
+
## [10.0.4](https://github.com/ckeditor/ckeditor5-autoformat/compare/v10.0.3...v10.0.4) (December 5, 2018)
|
|
89
89
|
|
|
90
90
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
91
91
|
|
|
92
92
|
|
|
93
|
-
## [10.0.3](https://github.com/ckeditor/ckeditor5-autoformat/compare/v10.0.2...v10.0.3) (2018
|
|
93
|
+
## [10.0.3](https://github.com/ckeditor/ckeditor5-autoformat/compare/v10.0.2...v10.0.3) (October 8, 2018)
|
|
94
94
|
|
|
95
95
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
96
96
|
|
|
97
97
|
|
|
98
|
-
## [10.0.2](https://github.com/ckeditor/ckeditor5-autoformat/compare/v10.0.1...v10.0.2) (2018
|
|
98
|
+
## [10.0.2](https://github.com/ckeditor/ckeditor5-autoformat/compare/v10.0.1...v10.0.2) (July 18, 2018)
|
|
99
99
|
|
|
100
100
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
## [10.0.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v10.0.0...v10.0.1) (2018
|
|
103
|
+
## [10.0.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v10.0.0...v10.0.1) (June 21, 2018)
|
|
104
104
|
|
|
105
105
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
106
106
|
|
|
107
107
|
|
|
108
|
-
## [10.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v1.0.0-beta.4...v10.0.0) (2018
|
|
108
|
+
## [10.0.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v1.0.0-beta.4...v10.0.0) (April 25, 2018)
|
|
109
109
|
|
|
110
110
|
### Other changes
|
|
111
111
|
|
|
@@ -116,24 +116,24 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
116
116
|
* The license under which CKEditor 5 is released has been changed from a triple GPL, LGPL and MPL license to a GPL2+ only. See [ckeditor/ckeditor5#991](https://github.com/ckeditor/ckeditor5/issues/991) for more information.
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-autoformat/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018
|
|
119
|
+
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-autoformat/compare/v1.0.0-beta.2...v1.0.0-beta.4) (April 19, 2018)
|
|
120
120
|
|
|
121
121
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
122
122
|
|
|
123
123
|
|
|
124
|
-
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-autoformat/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018
|
|
124
|
+
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-autoformat/compare/v1.0.0-beta.1...v1.0.0-beta.2) (April 10, 2018)
|
|
125
125
|
|
|
126
126
|
### Bug fixes
|
|
127
127
|
|
|
128
128
|
* Autoformat should ignore transparent batches. Closes [#56](https://github.com/ckeditor/ckeditor5-autoformat/issues/56). ([e42f987](https://github.com/ckeditor/ckeditor5-autoformat/commit/e42f987))
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018
|
|
131
|
+
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (March 15, 2018)
|
|
132
132
|
|
|
133
133
|
### Bug fixes
|
|
134
134
|
|
|
135
135
|
* Fixed integration with undo. Closes [#53](https://github.com/ckeditor/ckeditor5-autoformat/issues/53). ([f5d68f4](https://github.com/ckeditor/ckeditor5-autoformat/commit/f5d68f4))
|
|
136
|
-
*
|
|
136
|
+
* An ordered list will now be triggered by a number and `.` or `)`. Closes [#42](https://github.com/ckeditor/ckeditor5-autoformat/issues/42). ([bcc4e3b](https://github.com/ckeditor/ckeditor5-autoformat/commit/bcc4e3b))
|
|
137
137
|
|
|
138
138
|
Thanks to [@vladikoff](https://github.com/vladikoff)!
|
|
139
139
|
|
|
@@ -142,31 +142,31 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
142
142
|
* Aligned feature class naming to the new scheme. ([5f5b4a9](https://github.com/ckeditor/ckeditor5-autoformat/commit/5f5b4a9))
|
|
143
143
|
|
|
144
144
|
|
|
145
|
-
## 0.0.1 (2017
|
|
145
|
+
## 0.0.1 (October 27, 2017)
|
|
146
146
|
|
|
147
147
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
148
148
|
|
|
149
149
|
|
|
150
|
-
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-autoformat/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2017
|
|
150
|
+
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-autoformat/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (November 14, 2017)
|
|
151
151
|
|
|
152
152
|
### Bug fixes
|
|
153
153
|
|
|
154
154
|
* `LiveRanges` used by `InlineAutoFormatEngine` are now properly detached. Closes [#39](https://github.com/ckeditor/ckeditor5-autoformat/issues/39). ([5f24ae8](https://github.com/ckeditor/ckeditor5-autoformat/commit/5f24ae8))
|
|
155
155
|
|
|
156
156
|
|
|
157
|
-
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v0.6.0...v1.0.0-alpha.1) (2017
|
|
157
|
+
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v0.6.0...v1.0.0-alpha.1) (October 3, 2017)
|
|
158
158
|
|
|
159
159
|
### Features
|
|
160
160
|
|
|
161
161
|
* Added support for backticks which apply `<code>` to the wrapped fragment of text. Closes [#35](https://github.com/ckeditor/ckeditor5-autoformat/issues/35). ([3e93bf6](https://github.com/ckeditor/ckeditor5-autoformat/commit/3e93bf6))
|
|
162
162
|
|
|
163
163
|
|
|
164
|
-
## [0.6.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v0.5.1...v0.6.0) (2017
|
|
164
|
+
## [0.6.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v0.5.1...v0.6.0) (September 3, 2017)
|
|
165
165
|
|
|
166
166
|
### Bug fixes
|
|
167
167
|
|
|
168
168
|
* The `Autoformat` plugin should not require other features. Closes [#5](https://github.com/ckeditor/ckeditor5-autoformat/issues/5) and [#17](https://github.com/ckeditor/ckeditor5-autoformat/issues/17). ([d22c5b6](https://github.com/ckeditor/ckeditor5-autoformat/commit/d22c5b6))
|
|
169
|
-
* Autoformatting will not be triggered if the batch with changes is `transparent` (
|
|
169
|
+
* Autoformatting will not be triggered if the batch with changes is `transparent` (for example, it represents other user's changes). ([f1131bc](https://github.com/ckeditor/ckeditor5-autoformat/commit/f1131bc))
|
|
170
170
|
|
|
171
171
|
### Features
|
|
172
172
|
|
|
@@ -181,16 +181,16 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
181
181
|
|
|
182
182
|
* The command API has been changed.
|
|
183
183
|
|
|
184
|
-
###
|
|
184
|
+
### Note
|
|
185
185
|
|
|
186
|
-
* The Autoformat feature
|
|
186
|
+
* The Autoformat feature does not require Bold, Italic, Heading, etc. any longer. To make the most of the plugin, make sure that relevant features are loaded in your editor.
|
|
187
187
|
|
|
188
188
|
|
|
189
|
-
## [0.5.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v0.5.0...v0.5.1) (2017
|
|
189
|
+
## [0.5.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v0.5.0...v0.5.1) (May 7, 2017)
|
|
190
190
|
|
|
191
191
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
192
192
|
|
|
193
|
-
## [0.5.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v0.4.1...v0.5.0) (2017
|
|
193
|
+
## [0.5.0](https://github.com/ckeditor/ckeditor5-autoformat/compare/v0.4.1...v0.5.0) (April 5, 2017)
|
|
194
194
|
|
|
195
195
|
### Features
|
|
196
196
|
|
|
@@ -201,7 +201,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
201
201
|
* Updated command names to match the latest API of the Heading feature. Closes [#22](https://github.com/ckeditor/ckeditor5-autoformat/issues/22). ([10b5561](https://github.com/ckeditor/ckeditor5-autoformat/commit/10b5561))
|
|
202
202
|
|
|
203
203
|
|
|
204
|
-
## [0.4.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v0.4.0...v0.4.1) (2017
|
|
204
|
+
## [0.4.1](https://github.com/ckeditor/ckeditor5-autoformat/compare/v0.4.0...v0.4.1) (March 6, 2017)
|
|
205
205
|
|
|
206
206
|
### Other changes
|
|
207
207
|
|
package/LICENSE.md
CHANGED
|
@@ -2,7 +2,7 @@ Software License Agreement
|
|
|
2
2
|
==========================
|
|
3
3
|
|
|
4
4
|
**CKEditor 5 autoformat feature** – https://github.com/ckeditor/ckeditor5-autoformat <br>
|
|
5
|
-
Copyright (c) 2003–
|
|
5
|
+
Copyright (c) 2003–2024, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
|
|
6
6
|
|
|
7
7
|
Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
|
|
8
8
|
|
package/build/autoformat.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/(()=>{var t={704:(t,e,o)=>{t.exports=o(79)("./src/core.js")},492:(t,e,o)=>{t.exports=o(79)("./src/engine.js")},181:(t,e,o)=>{t.exports=o(79)("./src/typing.js")},209:(t,e,o)=>{t.exports=o(79)("./src/utils.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function o(i){var s=e[i];if(void 0!==s)return s.exports;var n=e[i]={exports:{}};return t[i](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};(()=>{"use strict";o.r(i),o.d(i,{Autoformat:()=>c});var t=o(704),e=o(181),s=o(492),n=o(209);function r(t,e,o,i){let r,d=null;"function"==typeof i?r=i:(d=t.commands.get(i),r=()=>{t.execute(i)}),t.model.document.on("change:data",((a,c)=>{if(d&&!d.isEnabled||!e.isEnabled)return;const l=(0,n.first)(t.model.document.selection.getRanges());if(!l.isCollapsed)return;if(c.isUndo||!c.isLocal)return;const u=Array.from(t.model.document.differ.getChanges()),h=u[0];if(1!=u.length||"insert"!==h.type||"$text"!=h.name||1!=h.length)return;const g=h.position.parent;if(g.is("element","codeBlock"))return;if(g.is("element","listItem")&&"function"!=typeof i&&!["numberedList","bulletedList","todoList"].includes(i))return;if(d&&!0===d.value)return;const m=g.getChild(0),f=t.model.createRangeOn(m);if(!f.containsRange(l)&&!l.end.isEqual(f.end))return;const p=o.exec(m.data.substr(0,l.end.offset));p&&t.model.enqueueChange((e=>{const o=e.createPositionAt(g,0),i=e.createPositionAt(g,p[0].length),n=new s.LiveRange(o,i);if(!1!==r({match:p})){e.remove(n);const o=t.model.document.selection.getFirstRange(),i=e.createRangeIn(g);!g.isEmpty||i.isEqual(o)||i.containsRange(o,!0)||e.remove(g)}n.detach(),t.model.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}))}))}function d(t,e,o,i){let s,n;o instanceof RegExp?s=o:n=o,n=n||(t=>{let e;const o=[],i=[];for(;null!==(e=s.exec(t))&&!(e&&e.length<4);){let{index:t,1:s,2:n,3:r}=e;const d=s+n+r;t+=e[0].length-d.length;const a=[t,t+s.length],c=[t+s.length+n.length,t+s.length+n.length+r.length];o.push(a),o.push(c),i.push([t+s.length,t+s.length+n.length])}return{remove:o,format:i}}),t.model.document.on("change:data",((o,s)=>{if(s.isUndo||!s.isLocal||!e.isEnabled)return;const r=t.model,d=r.document.selection;if(!d.isCollapsed)return;const c=Array.from(r.document.differ.getChanges()),l=c[0];if(1!=c.length||"insert"!==l.type||"$text"!=l.name||1!=l.length)return;const u=d.focus,h=u.parent,{text:g,range:m}=function(t,e){let o=t.start;const i=Array.from(t.getItems()).reduce(((t,i)=>!i.is("$text")&&!i.is("$textProxy")||i.getAttribute("code")?(o=e.createPositionAfter(i),""):t+i.data),"");return{text:i,range:e.createRange(o,t.end)}}(r.createRange(r.createPositionAt(h,0),u),r),f=n(g),p=a(m.start,f.format,r),x=a(m.start,f.remove,r);p.length&&x.length&&r.enqueueChange((e=>{if(!1!==i(e,p)){for(const t of x.reverse())e.remove(t);r.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}}))}))}function a(t,e,o){return e.filter((t=>void 0!==t[0]&&void 0!==t[1])).map((e=>o.createRange(t.getShiftedBy(e[0]),t.getShiftedBy(e[1]))))}class c extends t.Plugin{static get requires(){return[e.Delete]}static get pluginName(){return"Autoformat"}afterInit(){this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats()}_addListAutoformats(){const t=this.editor.commands;t.get("bulletedList")&&r(this.editor,this,/^[*-]\s$/,"bulletedList"),t.get("numberedList")&&r(this.editor,this,/^1[.|)]\s$/,"numberedList"),t.get("todoList")&&r(this.editor,this,/^\[\s?\]\s$/,"todoList"),t.get("checkTodoList")&&r(this.editor,this,/^\[\s?x\s?\]\s$/,(()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")}))}_addBasicStylesAutoformats(){const t=this.editor.commands;if(t.get("bold")){const t=l(this.editor,"bold");d(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,t),d(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,t)}if(t.get("italic")){const t=l(this.editor,"italic");d(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,t),d(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,t)}if(t.get("code")){const t=l(this.editor,"code");d(this.editor,this,/(`)([^`]+)(`)$/g,t)}if(t.get("strikethrough")){const t=l(this.editor,"strikethrough");d(this.editor,this,/(~~)([^~]+)(~~)$/g,t)}}_addHeadingAutoformats(){const t=this.editor.commands.get("heading");t&&t.modelElements.filter((t=>t.match(/^heading[1-6]$/))).forEach((e=>{const o=e[7],i=new RegExp(`^(#{${o}})\\s$`);r(this.editor,this,i,(()=>{if(!t.isEnabled||t.value===e)return!1;this.editor.execute("heading",{value:e})}))}))}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&r(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const t=this.editor,e=t.model.document.selection;t.commands.get("codeBlock")&&r(t,this,/^```$/,(()=>{if(e.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})}))}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&r(this.editor,this,/^---$/,"horizontalLine")}}function l(t,e){return(o,i)=>{if(!t.commands.get(e).isEnabled)return!1;const s=t.model.schema.getValidRanges(i,e);for(const t of s)o.setAttribute(e,!0,t);o.removeSelectionAttribute(e)}}})(),(window.CKEditor5=window.CKEditor5||{}).autoformat=i})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-autoformat",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "41.0.0",
|
|
4
4
|
"description": "Autoformatting feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
"ckeditor5-plugin",
|
|
11
11
|
"ckeditor5-dll"
|
|
12
12
|
],
|
|
13
|
+
"type": "module",
|
|
13
14
|
"main": "src/index.js",
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"ckeditor5": "
|
|
16
|
+
"ckeditor5": "41.0.0"
|
|
16
17
|
},
|
|
17
18
|
"author": "CKSource (http://cksource.com/)",
|
|
18
19
|
"license": "GPL-2.0-or-later",
|
package/src/augmentation.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
import type { Autoformat } from './index';
|
|
5
|
+
import type { Autoformat } from './index.js';
|
|
6
6
|
declare module '@ckeditor/ckeditor5-core' {
|
|
7
7
|
interface PluginsMap {
|
|
8
8
|
[Autoformat.pluginName]: Autoformat;
|
package/src/augmentation.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
export {};
|
package/src/autoformat.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
6
|
-
import { Delete } from 'ckeditor5/src/typing';
|
|
5
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
6
|
+
import { Delete } from 'ckeditor5/src/typing.js';
|
|
7
7
|
/**
|
|
8
8
|
* Enables a set of predefined autoformatting actions.
|
|
9
9
|
*
|
package/src/autoformat.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
6
|
-
import { Delete } from 'ckeditor5/src/typing';
|
|
7
|
-
import blockAutoformatEditing from './blockautoformatediting';
|
|
8
|
-
import inlineAutoformatEditing from './inlineautoformatediting';
|
|
5
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
6
|
+
import { Delete } from 'ckeditor5/src/typing.js';
|
|
7
|
+
import blockAutoformatEditing from './blockautoformatediting.js';
|
|
8
|
+
import inlineAutoformatEditing from './inlineautoformatediting.js';
|
|
9
9
|
/**
|
|
10
10
|
* Enables a set of predefined autoformatting actions.
|
|
11
11
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
import type { Editor } from 'ckeditor5/src/core';
|
|
6
|
-
import type Autoformat from './autoformat';
|
|
5
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
6
|
+
import type Autoformat from './autoformat.js';
|
|
7
7
|
/**
|
|
8
8
|
* The block autoformatting engine. It allows to format various block patterns. For example,
|
|
9
9
|
* it can be configured to turn a paragraph starting with `*` and followed by a space into a list item.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
import { LiveRange } from 'ckeditor5/src/engine';
|
|
6
|
-
import { first } from 'ckeditor5/src/utils';
|
|
5
|
+
import { LiveRange } from 'ckeditor5/src/engine.js';
|
|
6
|
+
import { first } from 'ckeditor5/src/utils.js';
|
|
7
7
|
/**
|
|
8
8
|
* The block autoformatting engine. It allows to format various block patterns. For example,
|
|
9
9
|
* it can be configured to turn a paragraph starting with `*` and followed by a space into a list item.
|
package/src/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module autoformat
|
|
7
7
|
*/
|
|
8
|
-
export { default as Autoformat } from './autoformat';
|
|
9
|
-
import './augmentation';
|
|
8
|
+
export { default as Autoformat } from './autoformat.js';
|
|
9
|
+
import './augmentation.js';
|
package/src/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @module autoformat
|
|
7
7
|
*/
|
|
8
|
-
export { default as Autoformat } from './autoformat';
|
|
9
|
-
import './augmentation';
|
|
8
|
+
export { default as Autoformat } from './autoformat.js';
|
|
9
|
+
import './augmentation.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @module autoformat/inlineautoformatediting
|
|
18
18
|
*/
|
|
19
|
-
import type { Editor } from 'ckeditor5/src/core';
|
|
20
|
-
import type { Range, Writer } from 'ckeditor5/src/engine';
|
|
21
|
-
import type Autoformat from './autoformat';
|
|
19
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
20
|
+
import type { Range, Writer } from 'ckeditor5/src/engine.js';
|
|
21
|
+
import type Autoformat from './autoformat.js';
|
|
22
22
|
export type TestCallback = (text: string) => {
|
|
23
23
|
remove: Array<Array<number>>;
|
|
24
24
|
format: Array<Array<number>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
5
|
/**
|