@ckeditor/ckeditor5-typing 44.1.0 → 44.2.0-alpha.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.
Files changed (58) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/index-content.css +2 -2
  3. package/dist/index-editor.css +2 -2
  4. package/dist/index.css +2 -2
  5. package/dist/index.js +21 -9
  6. package/dist/index.js.map +1 -1
  7. package/package.json +24 -5
  8. package/src/augmentation.d.ts +1 -1
  9. package/src/augmentation.js +1 -1
  10. package/src/delete.d.ts +1 -1
  11. package/src/delete.js +1 -1
  12. package/src/deletecommand.d.ts +1 -1
  13. package/src/deletecommand.js +1 -1
  14. package/src/deleteobserver.d.ts +1 -1
  15. package/src/deleteobserver.js +1 -1
  16. package/src/index.d.ts +1 -1
  17. package/src/index.js +1 -1
  18. package/src/input.d.ts +1 -1
  19. package/src/input.js +1 -1
  20. package/src/inserttextcommand.d.ts +1 -1
  21. package/src/inserttextcommand.js +1 -1
  22. package/src/inserttextobserver.d.ts +1 -1
  23. package/src/inserttextobserver.js +1 -1
  24. package/src/texttransformation.d.ts +1 -1
  25. package/src/texttransformation.js +1 -1
  26. package/src/textwatcher.d.ts +1 -1
  27. package/src/textwatcher.js +1 -1
  28. package/src/twostepcaretmovement.d.ts +1 -1
  29. package/src/twostepcaretmovement.js +17 -5
  30. package/src/typing.d.ts +1 -1
  31. package/src/typing.js +1 -1
  32. package/src/typingconfig.d.ts +1 -1
  33. package/src/typingconfig.js +1 -1
  34. package/src/utils/changebuffer.d.ts +1 -1
  35. package/src/utils/changebuffer.js +1 -1
  36. package/src/utils/findattributerange.d.ts +1 -1
  37. package/src/utils/findattributerange.js +1 -1
  38. package/src/utils/getlasttextline.d.ts +1 -1
  39. package/src/utils/getlasttextline.js +1 -1
  40. package/src/utils/inlinehighlight.d.ts +1 -1
  41. package/src/utils/inlinehighlight.js +1 -1
  42. package/dist/augmentation.d.ts +0 -31
  43. package/dist/delete.d.ts +0 -40
  44. package/dist/deletecommand.d.ts +0 -87
  45. package/dist/deleteobserver.d.ts +0 -59
  46. package/dist/index.d.ts +0 -29
  47. package/dist/input.d.ts +0 -37
  48. package/dist/inserttextcommand.d.ts +0 -80
  49. package/dist/inserttextobserver.d.ts +0 -59
  50. package/dist/texttransformation.d.ts +0 -41
  51. package/dist/textwatcher.d.ts +0 -142
  52. package/dist/twostepcaretmovement.d.ts +0 -240
  53. package/dist/typing.d.ts +0 -31
  54. package/dist/typingconfig.d.ts +0 -208
  55. package/dist/utils/changebuffer.d.ts +0 -107
  56. package/dist/utils/findattributerange.d.ts +0 -37
  57. package/dist/utils/getlasttextline.d.ts +0 -53
  58. package/dist/utils/inlinehighlight.d.ts +0 -37
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-typing",
3
- "version": "44.1.0",
3
+ "version": "44.2.0-alpha.0",
4
4
  "description": "Typing feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,9 +13,9 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "@ckeditor/ckeditor5-core": "44.1.0",
17
- "@ckeditor/ckeditor5-engine": "44.1.0",
18
- "@ckeditor/ckeditor5-utils": "44.1.0",
16
+ "@ckeditor/ckeditor5-core": "44.2.0-alpha.0",
17
+ "@ckeditor/ckeditor5-engine": "44.2.0-alpha.0",
18
+ "@ckeditor/ckeditor5-utils": "44.2.0-alpha.0",
19
19
  "lodash-es": "4.17.21"
20
20
  },
21
21
  "author": "CKSource (http://cksource.com/)",
@@ -36,5 +36,24 @@
36
36
  "ckeditor5-metadata.json",
37
37
  "CHANGELOG.md"
38
38
  ],
39
- "types": "src/index.d.ts"
39
+ "types": "src/index.d.ts",
40
+ "exports": {
41
+ ".": {
42
+ "types": "./src/index.d.ts",
43
+ "import": "./src/index.js",
44
+ "default": "./src/index.js"
45
+ },
46
+ "./dist/*": {
47
+ "types": "./src/index.d.ts",
48
+ "import": "./dist/*",
49
+ "default": "./dist/*"
50
+ },
51
+ "./src/*": {
52
+ "types": "./src/*.d.ts",
53
+ "import": "./src/*",
54
+ "default": "./src/*"
55
+ },
56
+ "./ckeditor5-metadata.json": "./ckeditor5-metadata.json",
57
+ "./package.json": "./package.json"
58
+ }
40
59
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  import type { Delete, DeleteCommand, Input, InsertTextCommand, TextTransformation, TwoStepCaretMovement, Typing, TypingConfig } from './index.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  export {};
package/src/delete.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
package/src/delete.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  import { DomEventData, Observer, type BubblingEvent, type ViewDocumentSelection, type ViewSelection, type EditingView } from '@ckeditor/ckeditor5-engine';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
package/src/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
package/src/input.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
package/src/input.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  import { DomEventData, Observer, FocusObserver, type EditingView, type ViewDocumentSelection, type ViewSelection } from '@ckeditor/ckeditor5-engine';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  import type { Batch, Model, Range } from '@ckeditor/ckeditor5-engine';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Plugin } from '@ckeditor/ckeditor5-core';
9
9
  import { keyCodes } from '@ckeditor/ckeditor5-utils';
10
- import { MouseObserver } from '@ckeditor/ckeditor5-engine';
10
+ import { MouseObserver, TouchObserver } from '@ckeditor/ckeditor5-engine';
11
11
  /**
12
12
  * This plugin enables the two-step caret (phantom) movement behavior for
13
13
  * {@link module:typing/twostepcaretmovement~TwoStepCaretMovement#registerAttribute registered attributes}
@@ -404,19 +404,31 @@ export default class TwoStepCaretMovement extends Plugin {
404
404
  const selection = model.document.selection;
405
405
  const document = editor.editing.view.document;
406
406
  editor.editing.view.addObserver(MouseObserver);
407
+ editor.editing.view.addObserver(TouchObserver);
408
+ let touched = false;
407
409
  let clicked = false;
408
- // Detect the click.
410
+ // This event should be fired before selection on mobile devices.
411
+ this.listenTo(document, 'touchstart', () => {
412
+ clicked = false;
413
+ touched = true;
414
+ });
415
+ // Track mouse click event.
416
+ // Keep in mind that it's often called after the selection change on iOS devices.
417
+ // On the Android devices, it's called before the selection change.
418
+ // That's why we watch `touchstart` event on mobile and set `touched` flag, as it's fired before the selection change.
419
+ // See more: https://github.com/ckeditor/ckeditor5/issues/17171
409
420
  this.listenTo(document, 'mousedown', () => {
410
421
  clicked = true;
411
422
  });
412
423
  // When the selection has changed...
413
424
  this.listenTo(document, 'selectionChange', () => {
414
425
  const attributes = this.attributes;
415
- if (!clicked) {
426
+ if (!clicked && !touched) {
416
427
  return;
417
428
  }
418
- // ...and it was caused by the click...
429
+ // ...and it was caused by the click or touch...
419
430
  clicked = false;
431
+ touched = false;
420
432
  // ...and no text is selected...
421
433
  if (!selection.isCollapsed) {
422
434
  return;
package/src/typing.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
package/src/typing.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  import type { Editor } from '@ckeditor/ckeditor5-core';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  /**
@@ -1,31 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- import type { Delete, DeleteCommand, Input, InsertTextCommand, TextTransformation, TwoStepCaretMovement, Typing, TypingConfig } from './index.js';
10
- declare module '@ckeditor/ckeditor5-core' {
11
- interface EditorConfig {
12
- /**
13
- * The configuration of the typing features. Used by the features from the `@ckeditor/ckeditor5-typing` package.
14
- *
15
- * Read more in {@link module:typing/typingconfig~TypingConfig}.
16
- */
17
- typing?: TypingConfig;
18
- }
19
- interface CommandsMap {
20
- deleteForward: DeleteCommand;
21
- delete: DeleteCommand;
22
- insertText: InsertTextCommand;
23
- }
24
- interface PluginsMap {
25
- [Delete.pluginName]: Delete;
26
- [Input.pluginName]: Input;
27
- [TextTransformation.pluginName]: TextTransformation;
28
- [TwoStepCaretMovement.pluginName]: TwoStepCaretMovement;
29
- [Typing.pluginName]: Typing;
30
- }
31
- }
package/dist/delete.d.ts DELETED
@@ -1,40 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module typing/delete
11
- */
12
- import { Plugin } from '@ckeditor/ckeditor5-core';
13
- /**
14
- * The delete and backspace feature. Handles keys such as <kbd>Delete</kbd> and <kbd>Backspace</kbd>, other
15
- * keystrokes and user actions that result in deleting content in the editor.
16
- */
17
- export default class Delete extends Plugin {
18
- /**
19
- * Whether pressing backspace should trigger undo action
20
- */
21
- private _undoOnBackspace;
22
- /**
23
- * @inheritDoc
24
- */
25
- static get pluginName(): "Delete";
26
- /**
27
- * @inheritDoc
28
- */
29
- static get isOfficialPlugin(): true;
30
- /**
31
- * @inheritDoc
32
- */
33
- init(): void;
34
- /**
35
- * If the next user action after calling this method is pressing backspace, it would undo the last change.
36
- *
37
- * Requires {@link module:undo/undoediting~UndoEditing} plugin. If not loaded, does nothing.
38
- */
39
- requestUndoOnBackspace(): void;
40
- }
@@ -1,87 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module typing/deletecommand
11
- */
12
- import { Command, type Editor } from '@ckeditor/ckeditor5-core';
13
- import type { DocumentSelection, Selection } from '@ckeditor/ckeditor5-engine';
14
- import ChangeBuffer from './utils/changebuffer.js';
15
- /**
16
- * The delete command. Used by the {@link module:typing/delete~Delete delete feature} to handle the <kbd>Delete</kbd> and
17
- * <kbd>Backspace</kbd> keys.
18
- */
19
- export default class DeleteCommand extends Command {
20
- /**
21
- * The directionality of the delete describing in what direction it should
22
- * consume the content when the selection is collapsed.
23
- */
24
- readonly direction: 'forward' | 'backward';
25
- /**
26
- * Delete's change buffer used to group subsequent changes into batches.
27
- */
28
- private readonly _buffer;
29
- /**
30
- * Creates an instance of the command.
31
- *
32
- * @param direction The directionality of the delete describing in what direction it
33
- * should consume the content when the selection is collapsed.
34
- */
35
- constructor(editor: Editor, direction: 'forward' | 'backward');
36
- /**
37
- * The current change buffer.
38
- */
39
- get buffer(): ChangeBuffer;
40
- /**
41
- * Executes the delete command. Depending on whether the selection is collapsed or not, deletes its content
42
- * or a piece of content in the {@link #direction defined direction}.
43
- *
44
- * @fires execute
45
- * @param options The command options.
46
- * @param options.unit See {@link module:engine/model/utils/modifyselection~modifySelection}'s options.
47
- * @param options.sequence A number describing which subsequent delete event it is without the key being released.
48
- * See the {@link module:engine/view/document~Document#event:delete} event data.
49
- * @param options.selection Selection to remove. If not set, current model selection will be used.
50
- */
51
- execute(options?: {
52
- unit?: 'character' | 'codePoint' | 'word';
53
- sequence?: number;
54
- selection?: Selection | DocumentSelection;
55
- }): void;
56
- /**
57
- * If the user keeps <kbd>Backspace</kbd> or <kbd>Delete</kbd> key pressed, the content of the current
58
- * editable will be cleared. However, this will not yet lead to resetting the remaining block to a paragraph
59
- * (which happens e.g. when the user does <kbd>Ctrl</kbd> + <kbd>A</kbd>, <kbd>Backspace</kbd>).
60
- *
61
- * But, if the user pressed the key in an empty editable for the first time,
62
- * we want to replace the entire content with a paragraph if:
63
- *
64
- * * the current limit element is empty,
65
- * * the paragraph is allowed in the limit element,
66
- * * the limit doesn't already have a paragraph inside.
67
- *
68
- * See https://github.com/ckeditor/ckeditor5-typing/issues/61.
69
- *
70
- * @param sequence A number describing which subsequent delete event it is without the key being released.
71
- */
72
- private _shouldEntireContentBeReplacedWithParagraph;
73
- /**
74
- * The entire content is replaced with the paragraph. Selection is moved inside the paragraph.
75
- *
76
- * @param writer The model writer.
77
- */
78
- private _replaceEntireContentWithParagraph;
79
- /**
80
- * Checks if the selection is inside an empty element that is the first child of the limit element
81
- * and should be replaced with a paragraph.
82
- *
83
- * @param selection The selection.
84
- * @param sequence A number describing which subsequent delete event it is without the key being released.
85
- */
86
- private _shouldReplaceFirstBlockWithParagraph;
87
- }
@@ -1,59 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- import { DomEventData, Observer, type BubblingEvent, type ViewDocumentSelection, type ViewSelection, type EditingView } from '@ckeditor/ckeditor5-engine';
10
- /**
11
- * Delete observer introduces the {@link module:engine/view/document~Document#event:delete} event.
12
- */
13
- export default class DeleteObserver extends Observer {
14
- /**
15
- * @inheritDoc
16
- */
17
- constructor(view: EditingView);
18
- /**
19
- * @inheritDoc
20
- */
21
- observe(): void;
22
- /**
23
- * @inheritDoc
24
- */
25
- stopObserving(): void;
26
- }
27
- /**
28
- * Event fired when the user tries to delete content (e.g. presses <kbd>Delete</kbd> or <kbd>Backspace</kbd>).
29
- *
30
- * Note: This event is fired by the {@link module:typing/deleteobserver~DeleteObserver delete observer}
31
- * (usually registered by the {@link module:typing/delete~Delete delete feature}).
32
- *
33
- * @eventName module:engine/view/document~Document#delete
34
- * @param data The event data.
35
- */
36
- export type ViewDocumentDeleteEvent = BubblingEvent<{
37
- name: 'delete';
38
- args: [data: DeleteEventData];
39
- }>;
40
- export interface DeleteEventData extends DomEventData<InputEvent> {
41
- /**
42
- * The direction in which the deletion should happen.
43
- */
44
- direction: 'backward' | 'forward';
45
- /**
46
- * The "amount" of content that should be deleted.
47
- */
48
- unit: 'selection' | 'codePoint' | 'character' | 'word';
49
- /**
50
- * A number describing which subsequent delete event it is without the key being released.
51
- * If it's 2 or more it means that the key was pressed and hold.
52
- */
53
- sequence: number;
54
- /**
55
- * View selection which content should be removed. If not set,
56
- * current selection should be used.
57
- */
58
- selectionToRemove?: ViewSelection | ViewDocumentSelection;
59
- }
package/dist/index.d.ts DELETED
@@ -1,29 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2024, 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
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
8
- */
9
- /**
10
- * @module typing
11
- */
12
- export { default as Typing } from './typing.js';
13
- export { default as Input } from './input.js';
14
- export { default as Delete } from './delete.js';
15
- export { default as TextWatcher } from './textwatcher.js';
16
- export { default as TwoStepCaretMovement } from './twostepcaretmovement.js';
17
- export { default as TextTransformation } from './texttransformation.js';
18
- export type { TextTransformationConfig } from './typingconfig.js';
19
- export { default as inlineHighlight } from './utils/inlinehighlight.js';
20
- export { default as findAttributeRange, findAttributeRangeBound } from './utils/findattributerange.js';
21
- export { default as getLastTextLine, type LastTextLineData } from './utils/getlasttextline.js';
22
- export { default as InsertTextCommand, type InsertTextCommandExecuteEvent } from './inserttextcommand.js';
23
- export type { default as DeleteCommand } from './deletecommand.js';
24
- export type { TypingConfig } from './typingconfig.js';
25
- export type { ViewDocumentDeleteEvent } from './deleteobserver.js';
26
- export type { ViewDocumentInsertTextEvent, InsertTextEventData } from './inserttextobserver.js';
27
- export type { TextWatcherMatchedEvent } from './textwatcher.js';
28
- export type { TextWatcherMatchedDataEvent } from './textwatcher.js';
29
- import './augmentation.js';