@ckeditor/ckeditor5-typing 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 CHANGED
@@ -5,12 +5,12 @@ 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-typing/compare/v18.0.0...v19.0.0) (2020-04-29)
8
+ ## [19.0.0](https://github.com/ckeditor/ckeditor5-typing/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-typing/compare/v17.0.0...v18.0.0) (2020-03-19)
13
+ ## [18.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v17.0.0...v18.0.0) (March 19, 2020)
14
14
 
15
15
  ### Other changes
16
16
 
@@ -19,26 +19,26 @@ Internal changes only (updated dependencies, documentation, etc.).
19
19
  * Run only one instance of the `TextWatcher` for all text transformations. Closes [ckeditor/ckeditor5#6020](https://github.com/ckeditor/ckeditor5/issues/6020). ([550426d](https://github.com/ckeditor/ckeditor5-typing/commit/550426d))
20
20
 
21
21
 
22
- ## [17.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v16.0.0...v17.0.0) (2020-02-19)
22
+ ## [17.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v16.0.0...v17.0.0) (February 19, 2020)
23
23
 
24
24
  ### Features
25
25
 
26
26
  * Add `TextWatcher#isEnabled` property to allow toggling text watcher on and off. ([fa79d00](https://github.com/ckeditor/ckeditor5-typing/commit/fa79d00))
27
27
 
28
28
 
29
- ## [16.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v15.0.0...v16.0.0) (2019-12-04)
29
+ ## [16.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v15.0.0...v16.0.0) (December 4, 2019)
30
30
 
31
31
  Internal changes only (updated dependencies, documentation, etc.).
32
32
 
33
33
 
34
- ## [15.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v12.2.0...v15.0.0) (2019-10-23)
34
+ ## [15.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v12.2.0...v15.0.0) (October 23, 2019)
35
35
 
36
36
  ### Bug fixes
37
37
 
38
38
  * Autoformat transformations in blocks containing inline elements. See [ckeditor/ckeditor5#1955](https://github.com/ckeditor/ckeditor5/issues/1955). ([58abd23](https://github.com/ckeditor/ckeditor5-typing/commit/58abd23))
39
39
 
40
40
 
41
- ## [12.2.0](https://github.com/ckeditor/ckeditor5-typing/compare/v12.1.1...v12.2.0) (2019-08-26)
41
+ ## [12.2.0](https://github.com/ckeditor/ckeditor5-typing/compare/v12.1.1...v12.2.0) (August 26, 2019)
42
42
 
43
43
  ### Features
44
44
 
@@ -54,14 +54,14 @@ Internal changes only (updated dependencies, documentation, etc.).
54
54
  * 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). ([6491e8d](https://github.com/ckeditor/ckeditor5-typing/commit/6491e8d))
55
55
 
56
56
 
57
- ## [12.1.1](https://github.com/ckeditor/ckeditor5-typing/compare/v12.1.0...v12.1.1) (2019-07-10)
57
+ ## [12.1.1](https://github.com/ckeditor/ckeditor5-typing/compare/v12.1.0...v12.1.1) (July 10, 2019)
58
58
 
59
59
  ### Bug fixes
60
60
 
61
61
  * Text transformations will not remove existing formatting. Closes [#203](https://github.com/ckeditor/ckeditor5-typing/issues/203). Closes [#196](https://github.com/ckeditor/ckeditor5-typing/issues/196). ([2279eee](https://github.com/ckeditor/ckeditor5-typing/commit/2279eee))
62
62
 
63
63
 
64
- ## [12.1.0](https://github.com/ckeditor/ckeditor5-typing/compare/v12.0.2...v12.1.0) (2019-07-04)
64
+ ## [12.1.0](https://github.com/ckeditor/ckeditor5-typing/compare/v12.0.2...v12.1.0) (July 4, 2019)
65
65
 
66
66
  ### Features
67
67
 
@@ -72,21 +72,21 @@ Internal changes only (updated dependencies, documentation, etc.).
72
72
  * Improved typing on Android devices by handling `beforeinput` event instead of mutations. Introduced `options.selection` in the `DeleteCommand#execute()` params. Introduced `selectionToRemove` parameter in the `view.Document#event:delete` data. Closes [#167](https://github.com/ckeditor/ckeditor5-typing/issues/167). ([92ab3ff](https://github.com/ckeditor/ckeditor5-typing/commit/92ab3ff))
73
73
 
74
74
 
75
- ## [12.0.2](https://github.com/ckeditor/ckeditor5-typing/compare/v12.0.1...v12.0.2) (2019-06-05)
75
+ ## [12.0.2](https://github.com/ckeditor/ckeditor5-typing/compare/v12.0.1...v12.0.2) (June 6, 2019)
76
76
 
77
77
  ### Other changes
78
78
 
79
79
  * Use `Model#insertContent()` instead of `model.Writer#insertText()`. Closes [#191](https://github.com/ckeditor/ckeditor5-typing/issues/191). ([0aeb384](https://github.com/ckeditor/ckeditor5-typing/commit/0aeb384))
80
80
 
81
81
 
82
- ## [12.0.1](https://github.com/ckeditor/ckeditor5-typing/compare/v12.0.0...v12.0.1) (2019-04-10)
82
+ ## [12.0.1](https://github.com/ckeditor/ckeditor5-typing/compare/v12.0.0...v12.0.1) (April 4, 2019)
83
83
 
84
84
  ### Bug fixes
85
85
 
86
86
  * The `delete` event will now stop the `keydown` event if it was set with the highest priority. Closes [#186](https://github.com/ckeditor/ckeditor5-typing/issues/186). ([07cca83](https://github.com/ckeditor/ckeditor5-typing/commit/07cca83))
87
87
 
88
88
 
89
- ## [12.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v11.0.2...v12.0.0) (2019-02-28)
89
+ ## [12.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v11.0.2...v12.0.0) (February 28, 2019)
90
90
 
91
91
  ### Bug fixes
92
92
 
@@ -101,21 +101,21 @@ Internal changes only (updated dependencies, documentation, etc.).
101
101
  * 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))
102
102
 
103
103
 
104
- ## [11.0.2](https://github.com/ckeditor/ckeditor5-typing/compare/v11.0.1...v11.0.2) (2018-12-05)
104
+ ## [11.0.2](https://github.com/ckeditor/ckeditor5-typing/compare/v11.0.1...v11.0.2) (December 5, 2018)
105
105
 
106
106
  ### Bug fixes
107
107
 
108
108
  * Non-printable keys like volume up or the win key will not remove the content anymore. Closes [#136](https://github.com/ckeditor/ckeditor5-typing/issues/136). ([0ea9fbd](https://github.com/ckeditor/ckeditor5-typing/commit/0ea9fbd))
109
109
 
110
110
 
111
- ## [11.0.1](https://github.com/ckeditor/ckeditor5-typing/compare/v11.0.0...v11.0.1) (2018-10-08)
111
+ ## [11.0.1](https://github.com/ckeditor/ckeditor5-typing/compare/v11.0.0...v11.0.1) (October 8, 2018)
112
112
 
113
113
  ### Bug fixes
114
114
 
115
115
  * ` ` is now correctly handled in mutations. Closes [#170](https://github.com/ckeditor/ckeditor5-typing/issues/170). ([9badb20](https://github.com/ckeditor/ckeditor5-typing/commit/9badb20))
116
116
 
117
117
 
118
- ## [11.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v10.0.1...v11.0.0) (2018-07-18)
118
+ ## [11.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v10.0.1...v11.0.0) (July 18, 2018)
119
119
 
120
120
  ### Bug fixes
121
121
 
@@ -127,14 +127,14 @@ Internal changes only (updated dependencies, documentation, etc.).
127
127
  * `@ckeditor/ckeditor5-typing/src/changebuffer.js` was moved to `@ckeditor/ckeditor5-typing/src/utils/changebuffer.js`.
128
128
 
129
129
 
130
- ## [10.0.1](https://github.com/ckeditor/ckeditor5-typing/compare/v10.0.0...v10.0.1) (2018-06-21)
130
+ ## [10.0.1](https://github.com/ckeditor/ckeditor5-typing/compare/v10.0.0...v10.0.1) (June 21, 2018)
131
131
 
132
132
  ### Bug fixes
133
133
 
134
134
  * Bogus `<br />` element inserted by a browser at the end of an element is now correctly handled. Closes [ckeditor/ckeditor5#1083](https://github.com/ckeditor/ckeditor5/issues/1083). ([22abdff](https://github.com/ckeditor/ckeditor5-typing/commit/22abdff))
135
135
 
136
136
 
137
- ## [10.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v1.0.0-beta.4...v10.0.0) (2018-04-25)
137
+ ## [10.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v1.0.0-beta.4...v10.0.0) (April 25, 2018)
138
138
 
139
139
  ### Other changes
140
140
 
@@ -145,17 +145,17 @@ Internal changes only (updated dependencies, documentation, etc.).
145
145
  * The license under which CKEditor&nbsp;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.
146
146
 
147
147
 
148
- ## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-typing/compare/v1.0.0-beta.2...v1.0.0-beta.4) (2018-04-19)
148
+ ## [1.0.0-beta.4](https://github.com/ckeditor/ckeditor5-typing/compare/v1.0.0-beta.2...v1.0.0-beta.4) (April 19, 2018)
149
149
 
150
150
  Internal changes only (updated dependencies, documentation, etc.).
151
151
 
152
152
 
153
- ## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-typing/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2018-04-10)
153
+ ## [1.0.0-beta.2](https://github.com/ckeditor/ckeditor5-typing/compare/v1.0.0-beta.1...v1.0.0-beta.2) (April 10, 2018)
154
154
 
155
155
  Internal changes only (updated dependencies, documentation, etc.).
156
156
 
157
157
 
158
- ## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-typing/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (2018-03-15)
158
+ ## [1.0.0-beta.1](https://github.com/ckeditor/ckeditor5-typing/compare/v1.0.0-alpha.2...v1.0.0-beta.1) (March 15, 2018)
159
159
 
160
160
  ### Bug fixes
161
161
 
@@ -168,11 +168,11 @@ Internal changes only (updated dependencies, documentation, etc.).
168
168
  * Aligned feature class naming to the new scheme. ([9c2cb9d](https://github.com/ckeditor/ckeditor5-typing/commit/9c2cb9d))
169
169
 
170
170
 
171
- ## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-typing/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2017-11-14)
171
+ ## [1.0.0-alpha.2](https://github.com/ckeditor/ckeditor5-typing/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (November 14, 2017)
172
172
 
173
173
  Internal changes only (updated dependencies, documentation, etc.).
174
174
 
175
- ## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-typing/compare/v0.10.0...v1.0.0-alpha.1) (2017-10-03)
175
+ ## [1.0.0-alpha.1](https://github.com/ckeditor/ckeditor5-typing/compare/v0.10.0...v1.0.0-alpha.1) (October 3, 2017)
176
176
 
177
177
  ### Bug fixes
178
178
 
@@ -180,7 +180,7 @@ Internal changes only (updated dependencies, documentation, etc.).
180
180
  * Fixed an error where using spellchecker on a word with a style applied sometimes resulted in that word being removed. Closes [#117](https://github.com/ckeditor/ckeditor5-typing/issues/117). ([1e8d02b](https://github.com/ckeditor/ckeditor5-typing/commit/1e8d02b))
181
181
 
182
182
 
183
- ## [0.10.0](https://github.com/ckeditor/ckeditor5-typing/compare/v0.9.1...v0.10.0) (2017-09-03)
183
+ ## [0.10.0](https://github.com/ckeditor/ckeditor5-typing/compare/v0.9.1...v0.10.0) (September 3, 2017)
184
184
 
185
185
  ### Bug fixes
186
186
 
@@ -201,17 +201,17 @@ Internal changes only (updated dependencies, documentation, etc.).
201
201
  * The command API has been changed.
202
202
 
203
203
 
204
- ## [0.9.1](https://github.com/ckeditor/ckeditor5-typing/compare/v0.9.0...v0.9.1) (2017-05-07)
204
+ ## [0.9.1](https://github.com/ckeditor/ckeditor5-typing/compare/v0.9.0...v0.9.1) (May 7, 2017)
205
205
 
206
206
  Internal changes only (updated dependencies, documentation, etc.).
207
207
 
208
- ## [0.9.0](https://github.com/ckeditor/ckeditor5-typing/compare/v0.8.0...v0.9.0) (2017-04-05)
208
+ ## [0.9.0](https://github.com/ckeditor/ckeditor5-typing/compare/v0.8.0...v0.9.0) (April 5, 2017)
209
209
 
210
210
  ### Bug fixes
211
211
 
212
- * [Safari] Fixed an issue when inserting a Spanish accent character on a non-collapsed selection wouldn't work. Closes [#82](https://github.com/ckeditor/ckeditor5-typing/issues/82). ([49cfe9c](https://github.com/ckeditor/ckeditor5-typing/commit/49cfe9c))
212
+ * [Safari] Fixed an issue when inserting a Spanish accent character on a non-collapsed selection would not work. Closes [#82](https://github.com/ckeditor/ckeditor5-typing/issues/82). ([49cfe9c](https://github.com/ckeditor/ckeditor5-typing/commit/49cfe9c))
213
213
  * `InputCommand` now accepts `Range` instead of `Position` as a parameter. Closes [#86](https://github.com/ckeditor/ckeditor5-typing/issues/86). Closes [#54](https://github.com/ckeditor/ckeditor5-typing/issues/54). ([0766407](https://github.com/ckeditor/ckeditor5-typing/commit/0766407))
214
- * New undo step should be created on selection change or applying an attribute. Closes [#20](https://github.com/ckeditor/ckeditor5-typing/issues/20). Closes [#21](https://github.com/ckeditor/ckeditor5-typing/issues/21). ([011452b](https://github.com/ckeditor/ckeditor5-typing/commit/011452b))
214
+ * A new undo step should be created on selection change or applying an attribute. Closes [#20](https://github.com/ckeditor/ckeditor5-typing/issues/20). Closes [#21](https://github.com/ckeditor/ckeditor5-typing/issues/21). ([011452b](https://github.com/ckeditor/ckeditor5-typing/commit/011452b))
215
215
  * Use `typing.undoStep` in both `InputCommand` and `DeleteCommand`. Closes [#79](https://github.com/ckeditor/ckeditor5-typing/issues/79). ([c597467](https://github.com/ckeditor/ckeditor5-typing/commit/c597467))
216
216
 
217
217
  ### Features
@@ -224,7 +224,7 @@ Internal changes only (updated dependencies, documentation, etc.).
224
224
  * The `undo.step` configuration option was replaced by `typing.undoStep` in `DeleteCommand`. See [#79](https://github.com/ckeditor/ckeditor5-typing/issues/79).
225
225
 
226
226
 
227
- ## [0.8.0](https://github.com/ckeditor/ckeditor5-typing/compare/v0.7.0...v0.8.0) (2017-03-06)
227
+ ## [0.8.0](https://github.com/ckeditor/ckeditor5-typing/compare/v0.7.0...v0.8.0) (March 6, 2017)
228
228
 
229
229
  ### Bug fixes
230
230
 
package/LICENSE.md CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
2
2
  ==========================
3
3
 
4
4
  **CKEditor&nbsp;5 typing feature** – https://github.com/ckeditor/ckeditor5-typing <br>
5
- Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
5
+ Copyright (c) 20032023, [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
 
@@ -13,9 +13,9 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
13
13
 
14
14
  The following libraries are included in CKEditor under the [MIT license](https://opensource.org/licenses/MIT):
15
15
 
16
- * lodash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/.
16
+ * Lodash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/.
17
17
 
18
18
  Trademarks
19
19
  ----------
20
20
 
21
- **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.
21
+ **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-typing",
3
- "version": "40.0.0",
3
+ "version": "40.2.0",
4
4
  "description": "Typing 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.0.0",
16
- "@ckeditor/ckeditor5-engine": "40.0.0",
17
- "@ckeditor/ckeditor5-utils": "40.0.0",
15
+ "@ckeditor/ckeditor5-core": "40.2.0",
16
+ "@ckeditor/ckeditor5-engine": "40.2.0",
17
+ "@ckeditor/ckeditor5-utils": "40.2.0",
18
18
  "lodash-es": "4.17.21"
19
19
  },
20
20
  "author": "CKSource (http://cksource.com/)",
@@ -1,27 +1,27 @@
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 { Delete, DeleteCommand, Input, InsertTextCommand, TextTransformation, TwoStepCaretMovement, Typing, TypingConfig } from './index';
6
- declare module '@ckeditor/ckeditor5-core' {
7
- interface EditorConfig {
8
- /**
9
- * The configuration of the typing features. Used by the features from the `@ckeditor/ckeditor5-typing` package.
10
- *
11
- * Read more in {@link module:typing/typingconfig~TypingConfig}.
12
- */
13
- typing?: TypingConfig;
14
- }
15
- interface CommandsMap {
16
- deleteForward: DeleteCommand;
17
- delete: DeleteCommand;
18
- insertText: InsertTextCommand;
19
- }
20
- interface PluginsMap {
21
- [Delete.pluginName]: Delete;
22
- [Input.pluginName]: Input;
23
- [TextTransformation.pluginName]: TextTransformation;
24
- [TwoStepCaretMovement.pluginName]: TwoStepCaretMovement;
25
- [Typing.pluginName]: Typing;
26
- }
27
- }
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 { Delete, DeleteCommand, Input, InsertTextCommand, TextTransformation, TwoStepCaretMovement, Typing, TypingConfig } from './index';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface EditorConfig {
8
+ /**
9
+ * The configuration of the typing features. Used by the features from the `@ckeditor/ckeditor5-typing` package.
10
+ *
11
+ * Read more in {@link module:typing/typingconfig~TypingConfig}.
12
+ */
13
+ typing?: TypingConfig;
14
+ }
15
+ interface CommandsMap {
16
+ deleteForward: DeleteCommand;
17
+ delete: DeleteCommand;
18
+ insertText: InsertTextCommand;
19
+ }
20
+ interface PluginsMap {
21
+ [Delete.pluginName]: Delete;
22
+ [Input.pluginName]: Input;
23
+ [TextTransformation.pluginName]: TextTransformation;
24
+ [TwoStepCaretMovement.pluginName]: TwoStepCaretMovement;
25
+ [Typing.pluginName]: Typing;
26
+ }
27
+ }
@@ -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/delete.d.ts CHANGED
@@ -1,32 +1,32 @@
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 typing/delete
7
- */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
9
- /**
10
- * The delete and backspace feature. Handles keys such as <kbd>Delete</kbd> and <kbd>Backspace</kbd>, other
11
- * keystrokes and user actions that result in deleting content in the editor.
12
- */
13
- export default class Delete extends Plugin {
14
- /**
15
- * Whether pressing backspace should trigger undo action
16
- */
17
- private _undoOnBackspace;
18
- /**
19
- * @inheritDoc
20
- */
21
- static get pluginName(): "Delete";
22
- /**
23
- * @inheritDoc
24
- */
25
- init(): void;
26
- /**
27
- * If the next user action after calling this method is pressing backspace, it would undo the last change.
28
- *
29
- * Requires {@link module:undo/undoediting~UndoEditing} plugin. If not loaded, does nothing.
30
- */
31
- requestUndoOnBackspace(): void;
32
- }
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 typing/delete
7
+ */
8
+ import { Plugin } from '@ckeditor/ckeditor5-core';
9
+ /**
10
+ * The delete and backspace feature. Handles keys such as <kbd>Delete</kbd> and <kbd>Backspace</kbd>, other
11
+ * keystrokes and user actions that result in deleting content in the editor.
12
+ */
13
+ export default class Delete extends Plugin {
14
+ /**
15
+ * Whether pressing backspace should trigger undo action
16
+ */
17
+ private _undoOnBackspace;
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get pluginName(): "Delete";
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ init(): void;
26
+ /**
27
+ * If the next user action after calling this method is pressing backspace, it would undo the last change.
28
+ *
29
+ * Requires {@link module:undo/undoediting~UndoEditing} plugin. If not loaded, does nothing.
30
+ */
31
+ requestUndoOnBackspace(): void;
32
+ }
package/src/delete.js CHANGED
@@ -1,82 +1,82 @@
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 typing/delete
7
- */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
9
- import DeleteCommand from './deletecommand';
10
- import DeleteObserver from './deleteobserver';
11
- /**
12
- * The delete and backspace feature. Handles keys such as <kbd>Delete</kbd> and <kbd>Backspace</kbd>, other
13
- * keystrokes and user actions that result in deleting content in the editor.
14
- */
15
- export default class Delete extends Plugin {
16
- /**
17
- * @inheritDoc
18
- */
19
- static get pluginName() {
20
- return 'Delete';
21
- }
22
- /**
23
- * @inheritDoc
24
- */
25
- init() {
26
- const editor = this.editor;
27
- const view = editor.editing.view;
28
- const viewDocument = view.document;
29
- const modelDocument = editor.model.document;
30
- view.addObserver(DeleteObserver);
31
- this._undoOnBackspace = false;
32
- const deleteForwardCommand = new DeleteCommand(editor, 'forward');
33
- // Register `deleteForward` command and add `forwardDelete` command as an alias for backward compatibility.
34
- editor.commands.add('deleteForward', deleteForwardCommand);
35
- editor.commands.add('forwardDelete', deleteForwardCommand);
36
- editor.commands.add('delete', new DeleteCommand(editor, 'backward'));
37
- this.listenTo(viewDocument, 'delete', (evt, data) => {
38
- // When not in composition, we handle the action, so prevent the default one.
39
- // When in composition, it's the browser who modify the DOM (renderer is disabled).
40
- if (!viewDocument.isComposing) {
41
- data.preventDefault();
42
- }
43
- const { direction, sequence, selectionToRemove, unit } = data;
44
- const commandName = direction === 'forward' ? 'deleteForward' : 'delete';
45
- const commandData = { sequence };
46
- if (unit == 'selection') {
47
- const modelRanges = Array.from(selectionToRemove.getRanges()).map(viewRange => {
48
- return editor.editing.mapper.toModelRange(viewRange);
49
- });
50
- commandData.selection = editor.model.createSelection(modelRanges);
51
- }
52
- else {
53
- commandData.unit = unit;
54
- }
55
- editor.execute(commandName, commandData);
56
- view.scrollToTheSelection();
57
- }, { priority: 'low' });
58
- if (this.editor.plugins.has('UndoEditing')) {
59
- this.listenTo(viewDocument, 'delete', (evt, data) => {
60
- if (this._undoOnBackspace && data.direction == 'backward' && data.sequence == 1 && data.unit == 'codePoint') {
61
- this._undoOnBackspace = false;
62
- editor.execute('undo');
63
- data.preventDefault();
64
- evt.stop();
65
- }
66
- }, { context: '$capture' });
67
- this.listenTo(modelDocument, 'change', () => {
68
- this._undoOnBackspace = false;
69
- });
70
- }
71
- }
72
- /**
73
- * If the next user action after calling this method is pressing backspace, it would undo the last change.
74
- *
75
- * Requires {@link module:undo/undoediting~UndoEditing} plugin. If not loaded, does nothing.
76
- */
77
- requestUndoOnBackspace() {
78
- if (this.editor.plugins.has('UndoEditing')) {
79
- this._undoOnBackspace = true;
80
- }
81
- }
82
- }
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 typing/delete
7
+ */
8
+ import { Plugin } from '@ckeditor/ckeditor5-core';
9
+ import DeleteCommand from './deletecommand';
10
+ import DeleteObserver from './deleteobserver';
11
+ /**
12
+ * The delete and backspace feature. Handles keys such as <kbd>Delete</kbd> and <kbd>Backspace</kbd>, other
13
+ * keystrokes and user actions that result in deleting content in the editor.
14
+ */
15
+ export default class Delete extends Plugin {
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ static get pluginName() {
20
+ return 'Delete';
21
+ }
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ init() {
26
+ const editor = this.editor;
27
+ const view = editor.editing.view;
28
+ const viewDocument = view.document;
29
+ const modelDocument = editor.model.document;
30
+ view.addObserver(DeleteObserver);
31
+ this._undoOnBackspace = false;
32
+ const deleteForwardCommand = new DeleteCommand(editor, 'forward');
33
+ // Register `deleteForward` command and add `forwardDelete` command as an alias for backward compatibility.
34
+ editor.commands.add('deleteForward', deleteForwardCommand);
35
+ editor.commands.add('forwardDelete', deleteForwardCommand);
36
+ editor.commands.add('delete', new DeleteCommand(editor, 'backward'));
37
+ this.listenTo(viewDocument, 'delete', (evt, data) => {
38
+ // When not in composition, we handle the action, so prevent the default one.
39
+ // When in composition, it's the browser who modify the DOM (renderer is disabled).
40
+ if (!viewDocument.isComposing) {
41
+ data.preventDefault();
42
+ }
43
+ const { direction, sequence, selectionToRemove, unit } = data;
44
+ const commandName = direction === 'forward' ? 'deleteForward' : 'delete';
45
+ const commandData = { sequence };
46
+ if (unit == 'selection') {
47
+ const modelRanges = Array.from(selectionToRemove.getRanges()).map(viewRange => {
48
+ return editor.editing.mapper.toModelRange(viewRange);
49
+ });
50
+ commandData.selection = editor.model.createSelection(modelRanges);
51
+ }
52
+ else {
53
+ commandData.unit = unit;
54
+ }
55
+ editor.execute(commandName, commandData);
56
+ view.scrollToTheSelection();
57
+ }, { priority: 'low' });
58
+ if (this.editor.plugins.has('UndoEditing')) {
59
+ this.listenTo(viewDocument, 'delete', (evt, data) => {
60
+ if (this._undoOnBackspace && data.direction == 'backward' && data.sequence == 1 && data.unit == 'codePoint') {
61
+ this._undoOnBackspace = false;
62
+ editor.execute('undo');
63
+ data.preventDefault();
64
+ evt.stop();
65
+ }
66
+ }, { context: '$capture' });
67
+ this.listenTo(modelDocument, 'change', () => {
68
+ this._undoOnBackspace = false;
69
+ });
70
+ }
71
+ }
72
+ /**
73
+ * If the next user action after calling this method is pressing backspace, it would undo the last change.
74
+ *
75
+ * Requires {@link module:undo/undoediting~UndoEditing} plugin. If not loaded, does nothing.
76
+ */
77
+ requestUndoOnBackspace() {
78
+ if (this.editor.plugins.has('UndoEditing')) {
79
+ this._undoOnBackspace = true;
80
+ }
81
+ }
82
+ }