@ckeditor/ckeditor5-paragraph 40.0.0 → 40.2.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 +25 -25
- package/LICENSE.md +2 -2
- package/package.json +4 -4
- package/src/augmentation.d.ts +14 -14
- package/src/augmentation.js +5 -5
- package/src/index.d.ts +12 -12
- package/src/index.js +10 -10
- package/src/insertparagraphcommand.d.ts +45 -45
- package/src/insertparagraphcommand.js +90 -90
- package/src/paragraph.d.ts +61 -61
- package/src/paragraph.js +106 -106
- package/src/paragraphbuttonui.d.ts +36 -36
- package/src/paragraphbuttonui.js +57 -57
- package/src/paragraphcommand.d.ts +38 -38
- package/src/paragraphcommand.js +64 -64
package/CHANGELOG.md
CHANGED
|
@@ -5,32 +5,32 @@ 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-paragraph/compare/v18.0.0...v19.0.0) (2020
|
|
8
|
+
## [19.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v18.0.0...v19.0.0) (April 29, 2020)
|
|
9
9
|
|
|
10
10
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
## [18.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v17.0.0...v18.0.0) (2020
|
|
13
|
+
## [18.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v17.0.0...v18.0.0) (March 19, 2020)
|
|
14
14
|
|
|
15
15
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
## [17.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v16.0.0...v17.0.0) (2020
|
|
18
|
+
## [17.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v16.0.0...v17.0.0) (February 19, 2020)
|
|
19
19
|
|
|
20
20
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
## [16.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v15.0.0...v16.0.0) (2019
|
|
23
|
+
## [16.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v15.0.0...v16.0.0) (December 4, 2019)
|
|
24
24
|
|
|
25
25
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
## [15.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.5...v15.0.0) (2019
|
|
28
|
+
## [15.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.5...v15.0.0) (October 23, 2019)
|
|
29
29
|
|
|
30
30
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
## [11.0.5](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.4...v11.0.5) (2019
|
|
33
|
+
## [11.0.5](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.4...v11.0.5) (August 26, 2019)
|
|
34
34
|
|
|
35
35
|
### Bug fixes
|
|
36
36
|
|
|
@@ -41,58 +41,58 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
41
41
|
* 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). ([b1b9e23](https://github.com/ckeditor/ckeditor5-paragraph/commit/b1b9e23))
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
## [11.0.4](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.3...v11.0.4) (2019
|
|
44
|
+
## [11.0.4](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.3...v11.0.4) (July 10, 2019)
|
|
45
45
|
|
|
46
46
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
## [11.0.3](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.2...v11.0.3) (2019
|
|
49
|
+
## [11.0.3](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.2...v11.0.3) (July 4, 2019)
|
|
50
50
|
|
|
51
51
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
## [11.0.2](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.1...v11.0.2) (2019
|
|
54
|
+
## [11.0.2](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.1...v11.0.2) (June 6, 2019)
|
|
55
55
|
|
|
56
56
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
## [11.0.1](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.0...v11.0.1) (2019
|
|
59
|
+
## [11.0.1](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.0...v11.0.1) (April 4, 2019)
|
|
60
60
|
|
|
61
61
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
## [11.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v10.0.4...v11.0.0) (2019
|
|
64
|
+
## [11.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v10.0.4...v11.0.0) (February 28, 2019)
|
|
65
65
|
|
|
66
66
|
### BREAKING CHANGES
|
|
67
67
|
|
|
68
68
|
* 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))
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
## [10.0.4](https://github.com/ckeditor/ckeditor5-paragraph/compare/v10.0.3...v10.0.4) (2018
|
|
71
|
+
## [10.0.4](https://github.com/ckeditor/ckeditor5-paragraph/compare/v10.0.3...v10.0.4) (December 5, 2018)
|
|
72
72
|
|
|
73
73
|
### Other changes
|
|
74
74
|
|
|
75
75
|
* Improved SVG icons size. See [ckeditor/ckeditor5-theme-lark#206](https://github.com/ckeditor/ckeditor5-theme-lark/issues/206). ([a9f440f](https://github.com/ckeditor/ckeditor5-paragraph/commit/a9f440f))
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
## [10.0.3](https://github.com/ckeditor/ckeditor5-paragraph/compare/v10.0.2...v10.0.3) (2018
|
|
78
|
+
## [10.0.3](https://github.com/ckeditor/ckeditor5-paragraph/compare/v10.0.2...v10.0.3) (October 8, 2018)
|
|
79
79
|
|
|
80
80
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
## [10.0.2](https://github.com/ckeditor/ckeditor5-paragraph/compare/v10.0.1...v10.0.2) (2018
|
|
83
|
+
## [10.0.2](https://github.com/ckeditor/ckeditor5-paragraph/compare/v10.0.1...v10.0.2) (July 18, 2018)
|
|
84
84
|
|
|
85
85
|
### Other changes
|
|
86
86
|
|
|
87
87
|
* Refreshed the paragraph icon (see [ckeditor/ckeditor5-ui#394](https://github.com/ckeditor/ckeditor5-ui/issues/394)). ([d6e054a](https://github.com/ckeditor/ckeditor5-paragraph/commit/d6e054a))
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-
## [10.0.1](https://github.com/ckeditor/ckeditor5-paragraph/compare/v10.0.0...v10.0.1) (2018
|
|
90
|
+
## [10.0.1](https://github.com/ckeditor/ckeditor5-paragraph/compare/v10.0.0...v10.0.1) (June 21, 2018)
|
|
91
91
|
|
|
92
92
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
93
93
|
|
|
94
94
|
|
|
95
|
-
## [10.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v1.0.0-beta.4...v10.0.0) (2018
|
|
95
|
+
## [10.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v1.0.0-beta.4...v10.0.0) (April 25, 2018)
|
|
96
96
|
|
|
97
97
|
### Other changes
|
|
98
98
|
|
|
@@ -103,35 +103,35 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
103
103
|
* 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.
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-paragraph/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018
|
|
106
|
+
## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-paragraph/compare/v1.0.0-beta.2...v1.0.0-beta.4) (April 19, 2018)
|
|
107
107
|
|
|
108
108
|
### Features
|
|
109
109
|
|
|
110
110
|
* Introduced `ParagraphButtonUI` plugin. Closes [#33](https://github.com/ckeditor/ckeditor5-paragraph/issues/33). ([12dadba](https://github.com/ckeditor/ckeditor5-paragraph/commit/12dadba))
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-paragraph/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018
|
|
113
|
+
## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-paragraph/compare/v1.0.0-beta.1...v1.0.0-beta.2) (April 10, 2018)
|
|
114
114
|
|
|
115
115
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
116
116
|
|
|
117
117
|
|
|
118
|
-
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-paragraph/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018
|
|
118
|
+
## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-paragraph/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (March 15, 2018)
|
|
119
119
|
|
|
120
120
|
### Other changes
|
|
121
121
|
|
|
122
122
|
* Aligned feature class naming to the new scheme. ([69e98d3](https://github.com/ckeditor/ckeditor5-paragraph/commit/69e98d3))
|
|
123
123
|
|
|
124
124
|
|
|
125
|
-
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-paragraph/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2017
|
|
125
|
+
## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-paragraph/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (November 14, 2017)
|
|
126
126
|
|
|
127
127
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
128
128
|
|
|
129
|
-
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-paragraph/compare/v0.9.0...v1.0.0-alpha.1) (2017
|
|
129
|
+
## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-paragraph/compare/v0.9.0...v1.0.0-alpha.1) (October 3, 2017)
|
|
130
130
|
|
|
131
131
|
Internal changes only (updated dependencies, documentation, etc.).
|
|
132
132
|
|
|
133
133
|
|
|
134
|
-
## [0.9.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v0.8.0...v0.9.0) (2017
|
|
134
|
+
## [0.9.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v0.8.0...v0.9.0) (September 3, 2017)
|
|
135
135
|
|
|
136
136
|
### Bug fixes
|
|
137
137
|
|
|
@@ -147,7 +147,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
147
147
|
* The command API has been changed.
|
|
148
148
|
|
|
149
149
|
|
|
150
|
-
## [0.8.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v0.7.0...v0.8.0) (2017
|
|
150
|
+
## [0.8.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v0.7.0...v0.8.0) (May 7, 2017)
|
|
151
151
|
|
|
152
152
|
### Bug fixes
|
|
153
153
|
|
|
@@ -158,7 +158,7 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
158
158
|
* Paragraph will be automatically created if loaded empty data or if programmatically emptied the root element. Closes [#19](https://github.com/ckeditor/ckeditor5-paragraph/issues/19). ([c42d33e](https://github.com/ckeditor/ckeditor5-paragraph/commit/c42d33e))
|
|
159
159
|
|
|
160
160
|
|
|
161
|
-
## [0.7.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v0.6.1...v0.7.0) (2017
|
|
161
|
+
## [0.7.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v0.6.1...v0.7.0) (April 5, 2017)
|
|
162
162
|
|
|
163
163
|
### Bug fixes
|
|
164
164
|
|
|
@@ -170,6 +170,6 @@ Internal changes only (updated dependencies, documentation, etc.).
|
|
|
170
170
|
* Named existing plugin(s). ([46dc9b8](https://github.com/ckeditor/ckeditor5-paragraph/commit/46dc9b8))
|
|
171
171
|
|
|
172
172
|
|
|
173
|
-
## [0.6.1](https://github.com/ckeditor/ckeditor5-paragraph/compare/v0.6.0...v0.6.1) (2017
|
|
173
|
+
## [0.6.1](https://github.com/ckeditor/ckeditor5-paragraph/compare/v0.6.0...v0.6.1) (March 6, 2017)
|
|
174
174
|
|
|
175
175
|
Internal changes only (updated dependencies, documentation, etc.).
|
package/LICENSE.md
CHANGED
|
@@ -2,7 +2,7 @@ Software License Agreement
|
|
|
2
2
|
==========================
|
|
3
3
|
|
|
4
4
|
**CKEditor 5 paragraph feature** – https://github.com/ckeditor/ckeditor5-paragraph <br>
|
|
5
|
-
Copyright (c) 2003
|
|
5
|
+
Copyright (c) 2003–2023, [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
|
|
|
@@ -14,4 +14,4 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
|
|
|
14
14
|
Trademarks
|
|
15
15
|
----------
|
|
16
16
|
|
|
17
|
-
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
|
|
17
|
+
**CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-paragraph",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.2.0",
|
|
4
4
|
"description": "Paragraph feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
],
|
|
13
13
|
"main": "src/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@ckeditor/ckeditor5-core": "40.
|
|
16
|
-
"@ckeditor/ckeditor5-ui": "40.
|
|
17
|
-
"@ckeditor/ckeditor5-utils": "40.
|
|
15
|
+
"@ckeditor/ckeditor5-core": "40.2.0",
|
|
16
|
+
"@ckeditor/ckeditor5-ui": "40.2.0",
|
|
17
|
+
"@ckeditor/ckeditor5-utils": "40.2.0"
|
|
18
18
|
},
|
|
19
19
|
"author": "CKSource (http://cksource.com/)",
|
|
20
20
|
"license": "GPL-2.0-or-later",
|
package/src/augmentation.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
import type { Paragraph, ParagraphCommand, InsertParagraphCommand } from './index';
|
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
-
interface CommandsMap {
|
|
8
|
-
insertParagraph: InsertParagraphCommand;
|
|
9
|
-
paragraph: ParagraphCommand;
|
|
10
|
-
}
|
|
11
|
-
interface PluginsMap {
|
|
12
|
-
[Paragraph.pluginName]: Paragraph;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
import type { Paragraph, ParagraphCommand, InsertParagraphCommand } from './index';
|
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
|
7
|
+
interface CommandsMap {
|
|
8
|
+
insertParagraph: InsertParagraphCommand;
|
|
9
|
+
paragraph: ParagraphCommand;
|
|
10
|
+
}
|
|
11
|
+
interface PluginsMap {
|
|
12
|
+
[Paragraph.pluginName]: Paragraph;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/src/augmentation.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
export {};
|
package/src/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module paragraph
|
|
7
|
-
*/
|
|
8
|
-
export { default as Paragraph } from './paragraph';
|
|
9
|
-
export { default as ParagraphButtonUI } from './paragraphbuttonui';
|
|
10
|
-
export type { default as ParagraphCommand } from './paragraphcommand';
|
|
11
|
-
export type { default as InsertParagraphCommand } from './insertparagraphcommand';
|
|
12
|
-
import './augmentation';
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paragraph
|
|
7
|
+
*/
|
|
8
|
+
export { default as Paragraph } from './paragraph';
|
|
9
|
+
export { default as ParagraphButtonUI } from './paragraphbuttonui';
|
|
10
|
+
export type { default as ParagraphCommand } from './paragraphcommand';
|
|
11
|
+
export type { default as InsertParagraphCommand } from './insertparagraphcommand';
|
|
12
|
+
import './augmentation';
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module paragraph
|
|
7
|
-
*/
|
|
8
|
-
export { default as Paragraph } from './paragraph';
|
|
9
|
-
export { default as ParagraphButtonUI } from './paragraphbuttonui';
|
|
10
|
-
import './augmentation';
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paragraph
|
|
7
|
+
*/
|
|
8
|
+
export { default as Paragraph } from './paragraph';
|
|
9
|
+
export { default as ParagraphButtonUI } from './paragraphbuttonui';
|
|
10
|
+
import './augmentation';
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module paragraph/insertparagraphcommand
|
|
7
|
-
*/
|
|
8
|
-
import { Command, type Editor } from '@ckeditor/ckeditor5-core';
|
|
9
|
-
import type { Position } from '@ckeditor/ckeditor5-engine';
|
|
10
|
-
/**
|
|
11
|
-
* The insert paragraph command. It inserts a new paragraph at a specific
|
|
12
|
-
* {@link module:engine/model/position~Position document position}.
|
|
13
|
-
*
|
|
14
|
-
* ```ts
|
|
15
|
-
* // Insert a new paragraph before an element in the document.
|
|
16
|
-
* editor.execute( 'insertParagraph', {
|
|
17
|
-
* position: editor.model.createPositionBefore( element )
|
|
18
|
-
* } );
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* If a paragraph is disallowed in the context of the specific position, the command
|
|
22
|
-
* will attempt to split position ancestors to find a place where it is possible
|
|
23
|
-
* to insert a paragraph.
|
|
24
|
-
*
|
|
25
|
-
* **Note**: This command moves the selection to the inserted paragraph.
|
|
26
|
-
*/
|
|
27
|
-
export default class InsertParagraphCommand extends Command {
|
|
28
|
-
constructor(editor: Editor);
|
|
29
|
-
/**
|
|
30
|
-
* Executes the command.
|
|
31
|
-
*
|
|
32
|
-
* @param options Options for the executed command.
|
|
33
|
-
* @param options.position The model position at which the new paragraph will be inserted.
|
|
34
|
-
* @param options.attributes Attributes keys and values to set on a inserted paragraph.
|
|
35
|
-
* @fires execute
|
|
36
|
-
*/
|
|
37
|
-
execute(options: {
|
|
38
|
-
position: Position;
|
|
39
|
-
attributes
|
|
40
|
-
}): void;
|
|
41
|
-
/**
|
|
42
|
-
* Returns the best position to insert a new paragraph.
|
|
43
|
-
*/
|
|
44
|
-
private _findPositionToInsertParagraph;
|
|
45
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paragraph/insertparagraphcommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command, type Editor } from '@ckeditor/ckeditor5-core';
|
|
9
|
+
import type { Position } from '@ckeditor/ckeditor5-engine';
|
|
10
|
+
/**
|
|
11
|
+
* The insert paragraph command. It inserts a new paragraph at a specific
|
|
12
|
+
* {@link module:engine/model/position~Position document position}.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* // Insert a new paragraph before an element in the document.
|
|
16
|
+
* editor.execute( 'insertParagraph', {
|
|
17
|
+
* position: editor.model.createPositionBefore( element )
|
|
18
|
+
* } );
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* If a paragraph is disallowed in the context of the specific position, the command
|
|
22
|
+
* will attempt to split position ancestors to find a place where it is possible
|
|
23
|
+
* to insert a paragraph.
|
|
24
|
+
*
|
|
25
|
+
* **Note**: This command moves the selection to the inserted paragraph.
|
|
26
|
+
*/
|
|
27
|
+
export default class InsertParagraphCommand extends Command {
|
|
28
|
+
constructor(editor: Editor);
|
|
29
|
+
/**
|
|
30
|
+
* Executes the command.
|
|
31
|
+
*
|
|
32
|
+
* @param options Options for the executed command.
|
|
33
|
+
* @param options.position The model position at which the new paragraph will be inserted.
|
|
34
|
+
* @param options.attributes Attributes keys and values to set on a inserted paragraph.
|
|
35
|
+
* @fires execute
|
|
36
|
+
*/
|
|
37
|
+
execute(options: {
|
|
38
|
+
position: Position;
|
|
39
|
+
attributes?: Record<string, unknown>;
|
|
40
|
+
}): void;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the best position to insert a new paragraph.
|
|
43
|
+
*/
|
|
44
|
+
private _findPositionToInsertParagraph;
|
|
45
|
+
}
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module paragraph/insertparagraphcommand
|
|
7
|
-
*/
|
|
8
|
-
import { Command } from '@ckeditor/ckeditor5-core';
|
|
9
|
-
/**
|
|
10
|
-
* The insert paragraph command. It inserts a new paragraph at a specific
|
|
11
|
-
* {@link module:engine/model/position~Position document position}.
|
|
12
|
-
*
|
|
13
|
-
* ```ts
|
|
14
|
-
* // Insert a new paragraph before an element in the document.
|
|
15
|
-
* editor.execute( 'insertParagraph', {
|
|
16
|
-
* position: editor.model.createPositionBefore( element )
|
|
17
|
-
* } );
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* If a paragraph is disallowed in the context of the specific position, the command
|
|
21
|
-
* will attempt to split position ancestors to find a place where it is possible
|
|
22
|
-
* to insert a paragraph.
|
|
23
|
-
*
|
|
24
|
-
* **Note**: This command moves the selection to the inserted paragraph.
|
|
25
|
-
*/
|
|
26
|
-
export default class InsertParagraphCommand extends Command {
|
|
27
|
-
constructor(editor) {
|
|
28
|
-
super(editor);
|
|
29
|
-
// Since this command passes position in execution block instead of selection, it should be checked directly.
|
|
30
|
-
this._isEnabledBasedOnSelection = false;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Executes the command.
|
|
34
|
-
*
|
|
35
|
-
* @param options Options for the executed command.
|
|
36
|
-
* @param options.position The model position at which the new paragraph will be inserted.
|
|
37
|
-
* @param options.attributes Attributes keys and values to set on a inserted paragraph.
|
|
38
|
-
* @fires execute
|
|
39
|
-
*/
|
|
40
|
-
execute(options) {
|
|
41
|
-
const model = this.editor.model;
|
|
42
|
-
const attributes = options.attributes;
|
|
43
|
-
let position = options.position;
|
|
44
|
-
// Don't execute command if position is in non-editable place.
|
|
45
|
-
if (!model.canEditAt(position)) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
model.change(writer => {
|
|
49
|
-
position = this._findPositionToInsertParagraph(position, writer);
|
|
50
|
-
if (!position) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const paragraph = writer.createElement('paragraph');
|
|
54
|
-
if (attributes) {
|
|
55
|
-
model.schema.setAllowedAttributes(paragraph, attributes, writer);
|
|
56
|
-
}
|
|
57
|
-
model.insertContent(paragraph, position);
|
|
58
|
-
writer.setSelection(paragraph, 'in');
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Returns the best position to insert a new paragraph.
|
|
63
|
-
*/
|
|
64
|
-
_findPositionToInsertParagraph(position, writer) {
|
|
65
|
-
const model = this.editor.model;
|
|
66
|
-
if (model.schema.checkChild(position, 'paragraph')) {
|
|
67
|
-
return position;
|
|
68
|
-
}
|
|
69
|
-
const allowedParent = model.schema.findAllowedParent(position, 'paragraph');
|
|
70
|
-
// It could be there's no ancestor limit that would allow paragraph.
|
|
71
|
-
// In theory, "paragraph" could be disallowed even in the "$root".
|
|
72
|
-
if (!allowedParent) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
const positionParent = position.parent;
|
|
76
|
-
const isTextAllowed = model.schema.checkChild(positionParent, '$text');
|
|
77
|
-
// At empty $block or at the end of $block.
|
|
78
|
-
// <paragraph>[]</paragraph> ---> <paragraph></paragraph><paragraph>[]</paragraph>
|
|
79
|
-
// <paragraph>foo[]</paragraph> ---> <paragraph>foo</paragraph><paragraph>[]</paragraph>
|
|
80
|
-
if (positionParent.isEmpty || isTextAllowed && position.isAtEnd) {
|
|
81
|
-
return model.createPositionAfter(positionParent);
|
|
82
|
-
}
|
|
83
|
-
// At the start of $block with text.
|
|
84
|
-
// <paragraph>[]foo</paragraph> ---> <paragraph>[]</paragraph><paragraph>foo</paragraph>
|
|
85
|
-
if (!positionParent.isEmpty && isTextAllowed && position.isAtStart) {
|
|
86
|
-
return model.createPositionBefore(positionParent);
|
|
87
|
-
}
|
|
88
|
-
return writer.split(position, allowedParent).position;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module paragraph/insertparagraphcommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from '@ckeditor/ckeditor5-core';
|
|
9
|
+
/**
|
|
10
|
+
* The insert paragraph command. It inserts a new paragraph at a specific
|
|
11
|
+
* {@link module:engine/model/position~Position document position}.
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* // Insert a new paragraph before an element in the document.
|
|
15
|
+
* editor.execute( 'insertParagraph', {
|
|
16
|
+
* position: editor.model.createPositionBefore( element )
|
|
17
|
+
* } );
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* If a paragraph is disallowed in the context of the specific position, the command
|
|
21
|
+
* will attempt to split position ancestors to find a place where it is possible
|
|
22
|
+
* to insert a paragraph.
|
|
23
|
+
*
|
|
24
|
+
* **Note**: This command moves the selection to the inserted paragraph.
|
|
25
|
+
*/
|
|
26
|
+
export default class InsertParagraphCommand extends Command {
|
|
27
|
+
constructor(editor) {
|
|
28
|
+
super(editor);
|
|
29
|
+
// Since this command passes position in execution block instead of selection, it should be checked directly.
|
|
30
|
+
this._isEnabledBasedOnSelection = false;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Executes the command.
|
|
34
|
+
*
|
|
35
|
+
* @param options Options for the executed command.
|
|
36
|
+
* @param options.position The model position at which the new paragraph will be inserted.
|
|
37
|
+
* @param options.attributes Attributes keys and values to set on a inserted paragraph.
|
|
38
|
+
* @fires execute
|
|
39
|
+
*/
|
|
40
|
+
execute(options) {
|
|
41
|
+
const model = this.editor.model;
|
|
42
|
+
const attributes = options.attributes;
|
|
43
|
+
let position = options.position;
|
|
44
|
+
// Don't execute command if position is in non-editable place.
|
|
45
|
+
if (!model.canEditAt(position)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
model.change(writer => {
|
|
49
|
+
position = this._findPositionToInsertParagraph(position, writer);
|
|
50
|
+
if (!position) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const paragraph = writer.createElement('paragraph');
|
|
54
|
+
if (attributes) {
|
|
55
|
+
model.schema.setAllowedAttributes(paragraph, attributes, writer);
|
|
56
|
+
}
|
|
57
|
+
model.insertContent(paragraph, position);
|
|
58
|
+
writer.setSelection(paragraph, 'in');
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Returns the best position to insert a new paragraph.
|
|
63
|
+
*/
|
|
64
|
+
_findPositionToInsertParagraph(position, writer) {
|
|
65
|
+
const model = this.editor.model;
|
|
66
|
+
if (model.schema.checkChild(position, 'paragraph')) {
|
|
67
|
+
return position;
|
|
68
|
+
}
|
|
69
|
+
const allowedParent = model.schema.findAllowedParent(position, 'paragraph');
|
|
70
|
+
// It could be there's no ancestor limit that would allow paragraph.
|
|
71
|
+
// In theory, "paragraph" could be disallowed even in the "$root".
|
|
72
|
+
if (!allowedParent) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const positionParent = position.parent;
|
|
76
|
+
const isTextAllowed = model.schema.checkChild(positionParent, '$text');
|
|
77
|
+
// At empty $block or at the end of $block.
|
|
78
|
+
// <paragraph>[]</paragraph> ---> <paragraph></paragraph><paragraph>[]</paragraph>
|
|
79
|
+
// <paragraph>foo[]</paragraph> ---> <paragraph>foo</paragraph><paragraph>[]</paragraph>
|
|
80
|
+
if (positionParent.isEmpty || isTextAllowed && position.isAtEnd) {
|
|
81
|
+
return model.createPositionAfter(positionParent);
|
|
82
|
+
}
|
|
83
|
+
// At the start of $block with text.
|
|
84
|
+
// <paragraph>[]foo</paragraph> ---> <paragraph>[]</paragraph><paragraph>foo</paragraph>
|
|
85
|
+
if (!positionParent.isEmpty && isTextAllowed && position.isAtStart) {
|
|
86
|
+
return model.createPositionBefore(positionParent);
|
|
87
|
+
}
|
|
88
|
+
return writer.split(position, allowedParent).position;
|
|
89
|
+
}
|
|
90
|
+
}
|