@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/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)<br>
5
- Copyright (c) 2003–2024, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
5
+ Copyright (c) 2003–2025, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
6
6
 
7
7
  Licensed under a dual-license model, this software is available under:
8
8
 
@@ -1,4 +1,4 @@
1
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
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
@@ -1,4 +1,4 @@
1
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
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
package/dist/index.css CHANGED
@@ -1,4 +1,4 @@
1
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
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
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
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  import { Command, Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';
6
6
  import { env, EventInfo, count, keyCodes, isInsideSurrogatePair, isInsideCombinedSymbol, isInsideEmojiSequence, ObservableMixin } from '@ckeditor/ckeditor5-utils/dist/index.js';
7
- import { Observer, FocusObserver, DomEventData, LiveRange, BubblingEventInfo, MouseObserver } from '@ckeditor/ckeditor5-engine/dist/index.js';
7
+ import { Observer, FocusObserver, DomEventData, LiveRange, BubblingEventInfo, MouseObserver, TouchObserver } from '@ckeditor/ckeditor5-engine/dist/index.js';
8
8
  import { debounce, escapeRegExp } from 'lodash-es';
9
9
 
10
10
  /**
11
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
11
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
12
12
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
13
13
  */ /**
14
14
  * @module typing/utils/changebuffer
@@ -1253,7 +1253,7 @@ const DELETE_EVENT_TYPES = {
1253
1253
  }
1254
1254
 
1255
1255
  /**
1256
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
1256
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
1257
1257
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
1258
1258
  */ /**
1259
1259
  * @module typing/utils/getlasttextline
@@ -1800,19 +1800,31 @@ const DELETE_EVENT_TYPES = {
1800
1800
  const selection = model.document.selection;
1801
1801
  const document = editor.editing.view.document;
1802
1802
  editor.editing.view.addObserver(MouseObserver);
1803
+ editor.editing.view.addObserver(TouchObserver);
1804
+ let touched = false;
1803
1805
  let clicked = false;
1804
- // Detect the click.
1806
+ // This event should be fired before selection on mobile devices.
1807
+ this.listenTo(document, 'touchstart', ()=>{
1808
+ clicked = false;
1809
+ touched = true;
1810
+ });
1811
+ // Track mouse click event.
1812
+ // Keep in mind that it's often called after the selection change on iOS devices.
1813
+ // On the Android devices, it's called before the selection change.
1814
+ // That's why we watch `touchstart` event on mobile and set `touched` flag, as it's fired before the selection change.
1815
+ // See more: https://github.com/ckeditor/ckeditor5/issues/17171
1805
1816
  this.listenTo(document, 'mousedown', ()=>{
1806
1817
  clicked = true;
1807
1818
  });
1808
1819
  // When the selection has changed...
1809
1820
  this.listenTo(document, 'selectionChange', ()=>{
1810
1821
  const attributes = this.attributes;
1811
- if (!clicked) {
1822
+ if (!clicked && !touched) {
1812
1823
  return;
1813
1824
  }
1814
- // ...and it was caused by the click...
1825
+ // ...and it was caused by the click or touch...
1815
1826
  clicked = false;
1827
+ touched = false;
1816
1828
  // ...and no text is selected...
1817
1829
  if (!selection.isCollapsed) {
1818
1830
  return;
@@ -2372,7 +2384,7 @@ const DEFAULT_TRANSFORMATIONS = [
2372
2384
  }
2373
2385
 
2374
2386
  /**
2375
- * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
2387
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
2376
2388
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
2377
2389
  */ /**
2378
2390
  * @module typing/utils/findattributerange