@ckeditor/ckeditor5-engine 37.0.0-alpha.0 → 37.0.0-alpha.1

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 (63) hide show
  1. package/package.json +23 -23
  2. package/src/controller/datacontroller.d.ts +24 -24
  3. package/src/controller/datacontroller.js +10 -7
  4. package/src/conversion/downcastdispatcher.d.ts +8 -8
  5. package/src/conversion/mapper.d.ts +6 -2
  6. package/src/conversion/upcastdispatcher.d.ts +8 -8
  7. package/src/conversion/viewconsumable.d.ts +193 -1
  8. package/src/conversion/viewconsumable.js +1 -30
  9. package/src/index.d.ts +6 -3
  10. package/src/index.js +3 -0
  11. package/src/model/document.d.ts +2 -1
  12. package/src/model/documentselection.d.ts +4 -4
  13. package/src/model/liveposition.d.ts +1 -1
  14. package/src/model/liverange.d.ts +2 -2
  15. package/src/model/markercollection.d.ts +5 -5
  16. package/src/model/model.d.ts +97 -24
  17. package/src/model/model.js +0 -51
  18. package/src/model/operation/mergeoperation.d.ts +2 -2
  19. package/src/model/operation/mergeoperation.js +1 -1
  20. package/src/model/operation/splitoperation.d.ts +1 -1
  21. package/src/model/operation/splitoperation.js +1 -1
  22. package/src/model/operation/utils.d.ts +1 -1
  23. package/src/model/operation/utils.js +1 -1
  24. package/src/model/schema.d.ts +10 -10
  25. package/src/model/schema.js +4 -4
  26. package/src/model/selection.d.ts +2 -2
  27. package/src/model/typecheckable.d.ts +31 -1
  28. package/src/model/writer.d.ts +100 -3
  29. package/src/model/writer.js +0 -57
  30. package/src/view/document.d.ts +1 -1
  31. package/src/view/documentfragment.d.ts +0 -1
  32. package/src/view/documentfragment.js +0 -1
  33. package/src/view/documentselection.d.ts +88 -1
  34. package/src/view/documentselection.js +0 -55
  35. package/src/view/domconverter.d.ts +30 -0
  36. package/src/view/domconverter.js +0 -9
  37. package/src/view/downcastwriter.d.ts +192 -0
  38. package/src/view/downcastwriter.js +0 -123
  39. package/src/view/element.d.ts +2 -0
  40. package/src/view/node.d.ts +4 -1
  41. package/src/view/observer/arrowkeysobserver.d.ts +1 -1
  42. package/src/view/observer/clickobserver.d.ts +1 -1
  43. package/src/view/observer/compositionobserver.d.ts +3 -3
  44. package/src/view/observer/fakeselectionobserver.d.ts +0 -3
  45. package/src/view/observer/fakeselectionobserver.js +0 -3
  46. package/src/view/observer/focusobserver.d.ts +2 -2
  47. package/src/view/observer/inputobserver.d.ts +2 -2
  48. package/src/view/observer/keyobserver.d.ts +3 -4
  49. package/src/view/observer/mouseobserver.d.ts +4 -4
  50. package/src/view/observer/selectionobserver.d.ts +3 -2
  51. package/src/view/observer/selectionobserver.js +8 -8
  52. package/src/view/observer/tabobserver.d.ts +1 -1
  53. package/src/view/position.d.ts +1 -1
  54. package/src/view/position.js +1 -1
  55. package/src/view/selection.d.ts +1 -1
  56. package/src/view/stylesmap.d.ts +3 -3
  57. package/src/view/typecheckable.d.ts +49 -2
  58. package/src/view/uielement.d.ts +1 -1
  59. package/src/view/uielement.js +1 -1
  60. package/src/view/upcastwriter.d.ts +92 -3
  61. package/src/view/upcastwriter.js +0 -61
  62. package/src/view/view.d.ts +91 -1
  63. package/src/view/view.js +3 -60
package/src/index.d.ts CHANGED
@@ -15,10 +15,13 @@ export type { AddHighlightCallback, AttributeDescriptor, ElementCreatorFunction,
15
15
  export type { default as Mapper, MapperModelToViewPositionEvent, MapperViewToModelPositionEvent } from './conversion/mapper';
16
16
  export type { default as ModelConsumable } from './conversion/modelconsumable';
17
17
  export type { Consumables, default as ViewConsumable } from './conversion/viewconsumable';
18
- export { default as DataProcessor } from './dataprocessor/dataprocessor';
18
+ export type { default as DataProcessor } from './dataprocessor/dataprocessor';
19
19
  export { default as HtmlDataProcessor } from './dataprocessor/htmldataprocessor';
20
20
  export type { default as Operation } from './model/operation/operation';
21
21
  export { default as InsertOperation } from './model/operation/insertoperation';
22
+ export { default as MoveOperation } from './model/operation/moveoperation';
23
+ export { default as MergeOperation } from './model/operation/mergeoperation';
24
+ export { default as SplitOperation } from './model/operation/splitoperation';
22
25
  export { default as MarkerOperation } from './model/operation/markeroperation';
23
26
  export { default as OperationFactory } from './model/operation/operationfactory';
24
27
  export type { default as AttributeOperation } from './model/operation/attributeoperation';
@@ -58,7 +61,7 @@ export { default as Renderer } from './view/renderer';
58
61
  export { default as View } from './view/view';
59
62
  export { default as ViewDocument } from './view/document';
60
63
  export { default as ViewText } from './view/text';
61
- export { default as ViewElement, ElementAttributes as ViewElementAttributes } from './view/element';
64
+ export { default as ViewElement, type ElementAttributes as ViewElementAttributes } from './view/element';
62
65
  export { default as ViewContainerElement } from './view/containerelement';
63
66
  export { default as ViewEditableElement } from './view/editableelement';
64
67
  export { default as ViewAttributeElement } from './view/attributeelement';
@@ -97,7 +100,7 @@ export type { ViewDocumentTabEvent } from './view/observer/tabobserver';
97
100
  export type { ViewDocumentClickEvent } from './view/observer/clickobserver';
98
101
  export type { ViewDocumentSelectionChangeEvent } from './view/observer/selectionobserver';
99
102
  export type { ViewRenderEvent } from './view/view';
100
- export { StylesProcessor, BoxSides } from './view/stylesmap';
103
+ export { StylesProcessor, type BoxSides } from './view/stylesmap';
101
104
  export * from './view/styles/background';
102
105
  export * from './view/styles/border';
103
106
  export * from './view/styles/margin';
package/src/index.js CHANGED
@@ -13,6 +13,9 @@ export { default as DataController } from './controller/datacontroller';
13
13
  export { default as Conversion } from './conversion/conversion';
14
14
  export { default as HtmlDataProcessor } from './dataprocessor/htmldataprocessor';
15
15
  export { default as InsertOperation } from './model/operation/insertoperation';
16
+ export { default as MoveOperation } from './model/operation/moveoperation';
17
+ export { default as MergeOperation } from './model/operation/mergeoperation';
18
+ export { default as SplitOperation } from './model/operation/splitoperation';
16
19
  export { default as MarkerOperation } from './model/operation/markeroperation';
17
20
  export { default as OperationFactory } from './model/operation/operationfactory';
18
21
  export { transformSets } from './model/operation/transform';
@@ -231,7 +231,8 @@ export default class Document extends Document_base {
231
231
  * } );
232
232
  * ```
233
233
  *
234
- * @eventName change
234
+ * @eventName ~Document#change
235
+ * @eventName ~Document#change:data
235
236
  * @param batch The batch that was used in the executed changes block.
236
237
  */
237
238
  export type DocumentChangeEvent = {
@@ -353,7 +353,7 @@ export default class DocumentSelection extends DocumentSelection_base {
353
353
  /**
354
354
  * Fired when selection range(s) changed.
355
355
  *
356
- * @eventName change:range
356
+ * @eventName ~DocumentSelection#change:range
357
357
  * @param directChange In case of {@link module:engine/model/selection~Selection} class it is always set
358
358
  * to `true` which indicates that the selection change was caused by a direct use of selection's API.
359
359
  * The {@link module:engine/model/documentselection~DocumentSelection}, however, may change because its position
@@ -366,7 +366,7 @@ export type DocumentSelectionChangeRangeEvent = SelectionChangeRangeEvent;
366
366
  /**
367
367
  * Fired when selection attribute changed.
368
368
  *
369
- * @eventName change:attribute
369
+ * @eventName ~DocumentSelection#change:attribute
370
370
  * @param directChange In case of {@link module:engine/model/selection~Selection} class it is always set
371
371
  * to `true` which indicates that the selection change was caused by a direct use of selection's API.
372
372
  * The {@link module:engine/model/documentselection~DocumentSelection}, however, may change because its attributes
@@ -380,7 +380,7 @@ export type DocumentSelectionChangeAttributeEvent = SelectionChangeAttributeEven
380
380
  /**
381
381
  * Fired when selection marker(s) changed.
382
382
  *
383
- * @eventName change:marker
383
+ * @eventName ~DocumentSelection#change:marker
384
384
  * @param directChange This is always set to `false` in case of `change:marker` event as there is no possibility
385
385
  * to change markers directly through {@link module:engine/model/documentselection~DocumentSelection} API.
386
386
  * See also {@link module:engine/model/documentselection~DocumentSelection#event:change:range} and
@@ -399,7 +399,7 @@ export type DocumentSelectionChangeMarkerEvent = {
399
399
  /**
400
400
  * Fired when selection range(s), attribute(s) or marker(s) changed.
401
401
  *
402
- * @eventName change
402
+ * @eventName ~DocumentSelection#change
403
403
  * @param directChange This is always set to `false` in case of `change:marker` event as there is no possibility
404
404
  * to change markers directly through {@link module:engine/model/documentselection~DocumentSelection} API.
405
405
  * See also {@link module:engine/model/documentselection~DocumentSelection#event:change:range} and
@@ -67,7 +67,7 @@ export default class LivePosition extends LivePosition_base {
67
67
  /**
68
68
  * Fired when `LivePosition` instance is changed due to changes on {@link module:engine/model/document~Document}.
69
69
  *
70
- * @eventName change
70
+ * @eventName ~LivePosition#change
71
71
  * @param oldPosition Position equal to this live position before it got changed.
72
72
  */
73
73
  export type LivePositionChangeEvent = {
@@ -60,7 +60,7 @@ export default class LiveRange extends LiveRange_base {
60
60
  * Fired when `LiveRange` instance boundaries have changed due to changes in the
61
61
  * {@link module:engine/model/document~Document document}.
62
62
  *
63
- * @eventName change:range
63
+ * @eventName ~LiveRange#change:range
64
64
  * @param oldRange Range with start and end position equal to start and end position of this live
65
65
  * range before it got changed.
66
66
  * @param data Object with additional information about the change.
@@ -77,7 +77,7 @@ export type LiveRangeChangeRangeEvent = {
77
77
  * Fired when `LiveRange` instance boundaries have not changed after a change in {@link module:engine/model/document~Document document}
78
78
  * but the change took place inside the range, effectively changing its content.
79
79
  *
80
- * @eventName change:content
80
+ * @eventName ~LiveRange#change:content
81
81
  * @param range Range with start and end position equal to start and end position of
82
82
  * change range.
83
83
  * @param data Object with additional information about the change.
@@ -294,9 +294,9 @@ export type { Marker };
294
294
  * {@link module:engine/model/markercollection~MarkerCollection#event:update MarkerCollection update event}.
295
295
  *
296
296
  * @see module:engine/model/liverange~LiveRange#event:change:range
297
- * @eventName change:range
297
+ * @eventName ~Marker#change:range
298
298
  */
299
- export type MarkerCollectionChangeRangeEvent = LiveRangeChangeRangeEvent;
299
+ export type MarkerChangeRangeEvent = LiveRangeChangeRangeEvent;
300
300
  /**
301
301
  * Fired whenever change on {@link module:engine/model/document~Document} is done inside {@link ~Marker#_liveRange marker range}.
302
302
  * This is a delegated {@link module:engine/model/liverange~LiveRange#event:change:content LiveRange change:content event}.
@@ -306,17 +306,17 @@ export type MarkerCollectionChangeRangeEvent = LiveRangeChangeRangeEvent;
306
306
  * {@link module:engine/model/markercollection~MarkerCollection#event:update MarkerCollection update event}.
307
307
  *
308
308
  * @see module:engine/model/liverange~LiveRange#event:change:content
309
- * @eventName change:content
309
+ * @eventName ~Marker#change:content
310
310
  */
311
311
  export type MarkerCollectionChangeContentEvent = LiveRangeChangeContentEvent;
312
312
  /**
313
313
  * Describes `change:range` or `change:content` event.
314
314
  */
315
- export type MarkerCollectionChangeEvent = LiveRangeChangeEvent;
315
+ export type MarkerChangeEvent = LiveRangeChangeEvent;
316
316
  /**
317
317
  * Fired whenever marker is added, updated or removed from `MarkerCollection`.
318
318
  *
319
- * @eventName update
319
+ * @eventName ~MarkerCollection#update
320
320
  * @param marker Updated Marker.
321
321
  * @param oldRange Marker range before the update. When is not defined it
322
322
  * means that marker is just added.
@@ -117,10 +117,9 @@ export default class Model extends Model_base {
117
117
  *
118
118
  * By default, a new batch with the default {@link module:engine/model/batch~Batch#constructor batch type} is created.
119
119
  * To define the {@link module:engine/model/batch~Batch} into which you want to add your changes,
120
- * use {@link #enqueueChange#CUSTOM_BATCH}.
120
+ * use {@link #enqueueChange:CUSTOM_BATCH `enqueueChange( batchOrType, callback )`}.
121
121
  *
122
122
  * @label DEFAULT_BATCH
123
- * If not defined, a new batch with the default type will be created.
124
123
  * @param callback Callback function which may modify the model.
125
124
  */
126
125
  enqueueChange(callback: (writer: Writer) => unknown): void;
@@ -147,7 +146,8 @@ export default class Model extends Model_base {
147
146
  * done in the outer `change()` block.
148
147
  *
149
148
  * Second, it lets you define the {@link module:engine/model/batch~Batch} into which you want to add your changes.
150
- * If you want to use default {@link module:engine/model/batch~Batch#constructor batch type}, use {@link #enqueueChange#DEFAULT_BATCH}.
149
+ * If you want to use default {@link module:engine/model/batch~Batch#constructor batch type}, use
150
+ * {@link #enqueueChange:DEFAULT_BATCH `enqueueChange( callback )`}.
151
151
  *
152
152
  * ```ts
153
153
  * model.enqueueChange( { isUndoable: false }, writer => {
@@ -650,9 +650,82 @@ export default class Model extends Model_base {
650
650
  * @param item
651
651
  */
652
652
  createRangeOn(item: Item): ModelRange;
653
+ /**
654
+ * Creates a new selection instance based on the given {@link module:engine/model/selection~Selectable selectable}
655
+ * or creates an empty selection if no arguments were passed.
656
+ *
657
+ * Note: This method is also available as
658
+ * {@link module:engine/model/writer~Writer#createSelection `Writer#createSelection()`}.
659
+ *
660
+ * ```ts
661
+ * // Creates selection at the given offset in the given element.
662
+ * const paragraph = writer.createElement( 'paragraph' );
663
+ * const selection = writer.createSelection( paragraph, offset );
664
+ *
665
+ * // Creates a range inside an {@link module:engine/model/element~Element element} which starts before the
666
+ * // first child of that element and ends after the last child of that element.
667
+ * const selection = writer.createSelection( paragraph, 'in' );
668
+ *
669
+ * // Creates a range on an {@link module:engine/model/item~Item item} which starts before the item and ends
670
+ * // just after the item.
671
+ * const selection = writer.createSelection( paragraph, 'on' );
672
+ *
673
+ * // Additional options (`'backward'`) can be specified as the last argument.
674
+ *
675
+ * // Creates backward selection.
676
+ * const selection = writer.createSelection( element, 'in', { backward: true } );
677
+ * ```
678
+ *
679
+ * See also: {@link #createSelection:SELECTABLE `createSelection( selectable, options )`}.
680
+ *
681
+ * @label NODE_OFFSET
682
+ */
653
683
  createSelection(selectable: Node, placeOrOffset: PlaceOrOffset, options?: {
654
684
  backward?: boolean;
655
685
  }): ModelSelection;
686
+ /**
687
+ * Creates a new selection instance based on the given {@link module:engine/model/selection~Selectable selectable}
688
+ * or creates an empty selection if no arguments were passed.
689
+ *
690
+ * Note: This method is also available as
691
+ * {@link module:engine/model/writer~Writer#createSelection `Writer#createSelection()`}.
692
+ *
693
+ * ```ts
694
+ * // Creates empty selection without ranges.
695
+ * const selection = writer.createSelection();
696
+ *
697
+ * // Creates selection at the given range.
698
+ * const range = writer.createRange( start, end );
699
+ * const selection = writer.createSelection( range );
700
+ *
701
+ * // Creates selection at the given ranges
702
+ * const ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];
703
+ * const selection = writer.createSelection( ranges );
704
+ *
705
+ * // Creates selection from the other selection.
706
+ * // Note: It doesn't copies selection attributes.
707
+ * const otherSelection = writer.createSelection();
708
+ * const selection = writer.createSelection( otherSelection );
709
+ *
710
+ * // Creates selection from the given document selection.
711
+ * // Note: It doesn't copies selection attributes.
712
+ * const documentSelection = model.document.selection;
713
+ * const selection = writer.createSelection( documentSelection );
714
+ *
715
+ * // Creates selection at the given position.
716
+ * const position = writer.createPositionFromPath( root, path );
717
+ * const selection = writer.createSelection( position );
718
+ *
719
+ * // Additional options (`'backward'`) can be specified as the last argument.
720
+ *
721
+ * // Creates backward selection.
722
+ * const selection = writer.createSelection( range, { backward: true } );
723
+ * ```
724
+ *
725
+ * See also: {@link #createSelection:NODE_OFFSET `createSelection( node, placeOrOffset, options )`}.
726
+ *
727
+ * @label SELECTABLE
728
+ */
656
729
  createSelection(selectable?: Exclude<Selectable, Node>, options?: {
657
730
  backward?: boolean;
658
731
  }): ModelSelection;
@@ -691,7 +764,7 @@ export default class Model extends Model_base {
691
764
  * {@link module:engine/model/model~Model#change} block.
692
765
  *
693
766
  * @internal
694
- * @eventName _beforeChanges
767
+ * @eventName ~Model#_beforeChanges
695
768
  */
696
769
  export type BeforeChangesEvent = {
697
770
  name: '_beforeChanges';
@@ -702,7 +775,7 @@ export type BeforeChangesEvent = {
702
775
  * {@link module:engine/model/model~Model#change} block.
703
776
  *
704
777
  * @internal
705
- * @eventName _afterChanges
778
+ * @eventName ~Model#_afterChanges
706
779
  */
707
780
  export type AfterChangesEvent = {
708
781
  name: '_afterChanges';
@@ -710,7 +783,7 @@ export type AfterChangesEvent = {
710
783
  };
711
784
  /**
712
785
  * Fired every time any {@link module:engine/model/operation/operation~Operation operation} is applied on the model
713
- * using {@link #applyOperation}.
786
+ * using {@link ~Model#applyOperation}.
714
787
  *
715
788
  * Note that this event is suitable only for very specific use-cases. Use it if you need to listen to every single operation
716
789
  * applied on the document. However, in most cases {@link module:engine/model/document~Document#event:change} should
@@ -724,21 +797,21 @@ export type AfterChangesEvent = {
724
797
  * * with `low` priority {@link module:engine/model/liveposition~LivePosition} and {@link module:engine/model/liverange~LiveRange}
725
798
  * update themselves.
726
799
  *
727
- * @eventName applyOperation
800
+ * @eventName ~Model#applyOperation
728
801
  * @param args Arguments of the `applyOperation` which is an array with a single element - applied
729
802
  * {@link module:engine/model/operation/operation~Operation operation}.
730
803
  */
731
804
  export type ModelApplyOperationEvent = DecoratedMethodEvent<Model, 'applyOperation'>;
732
805
  /**
733
- * Event fired when {@link #insertContent} method is called.
806
+ * Event fired when {@link ~Model#insertContent} method is called.
734
807
  *
735
- * The {@link #insertContent default action of that method} is implemented as a
808
+ * The {@link ~Model#insertContent default action of that method} is implemented as a
736
809
  * listener to this event so it can be fully customized by the features.
737
810
  *
738
- * **Note** The `selectable` parameter for the {@link #insertContent} is optional. When `undefined` value is passed the method uses
811
+ * **Note** The `selectable` parameter for the {@link ~Model#insertContent} is optional. When `undefined` value is passed the method uses
739
812
  * {@link module:engine/model/document~Document#selection document selection}.
740
813
  *
741
- * @eventName insertContent
814
+ * @eventName ~Model#insertContent
742
815
  * @param args The arguments passed to the original method.
743
816
  */
744
817
  export type ModelInsertContentEvent = {
@@ -753,15 +826,15 @@ export type ModelInsertContentEvent = {
753
826
  return: ModelRange;
754
827
  };
755
828
  /**
756
- * Event fired when the {@link #insertObject} method is called.
829
+ * Event fired when the {@link ~Model#insertObject} method is called.
757
830
  *
758
- * The {@link #insertObject default action of that method} is implemented as a
831
+ * The {@link ~Model#insertObject default action of that method} is implemented as a
759
832
  * listener to this event so it can be fully customized by the features.
760
833
  *
761
- * **Note** The `selectable` parameter for the {@link #insertObject} is optional. When `undefined` value is passed the method uses
834
+ * **Note** The `selectable` parameter for the {@link ~Model#insertObject} is optional. When `undefined` value is passed the method uses
762
835
  * {@link module:engine/model/document~Document#selection document selection}.
763
836
  *
764
- * @eventName insertObject
837
+ * @eventName ~Model#insertObject
765
838
  * @param args The arguments passed to the original method.
766
839
  */
767
840
  export type ModelInsertObjectEvent = {
@@ -780,32 +853,32 @@ export type ModelInsertObjectEvent = {
780
853
  return: ModelRange;
781
854
  };
782
855
  /**
783
- * Event fired when {@link #deleteContent} method is called.
856
+ * Event fired when {@link ~Model#deleteContent} method is called.
784
857
  *
785
- * The {@link #deleteContent default action of that method} is implemented as a
858
+ * The {@link ~Model#deleteContent default action of that method} is implemented as a
786
859
  * listener to this event so it can be fully customized by the features.
787
860
  *
788
- * @eventName deleteContent
861
+ * @eventName ~Model#deleteContent
789
862
  * @param args The arguments passed to the original method.
790
863
  */
791
864
  export type ModelDeleteContentEvent = DecoratedMethodEvent<Model, 'deleteContent'>;
792
865
  /**
793
- * Event fired when {@link #modifySelection} method is called.
866
+ * Event fired when {@link ~Model#modifySelection} method is called.
794
867
  *
795
- * The {@link #modifySelection default action of that method} is implemented as a
868
+ * The {@link ~Model#modifySelection default action of that method} is implemented as a
796
869
  * listener to this event so it can be fully customized by the features.
797
870
  *
798
- * @eventName modifySelection
871
+ * @eventName ~Model#modifySelection
799
872
  * @param args The arguments passed to the original method.
800
873
  */
801
874
  export type ModelModifySelectionEvent = DecoratedMethodEvent<Model, 'modifySelection'>;
802
875
  /**
803
- * Event fired when {@link #getSelectedContent} method is called.
876
+ * Event fired when {@link ~Model#getSelectedContent} method is called.
804
877
  *
805
- * The {@link #getSelectedContent default action of that method} is implemented as a
878
+ * The {@link ~Model#getSelectedContent default action of that method} is implemented as a
806
879
  * listener to this event so it can be fully customized by the features.
807
880
  *
808
- * @eventName getSelectedContent
881
+ * @eventName ~Model#getSelectedContent
809
882
  * @param args The arguments passed to the original method.
810
883
  */
811
884
  export type ModelGetSelectedContentEvent = DecoratedMethodEvent<Model, 'getSelectedContent'>;
@@ -730,57 +730,6 @@ export default class Model extends ObservableMixin() {
730
730
  createRangeOn(item) {
731
731
  return ModelRange._createOn(item);
732
732
  }
733
- /**
734
- * Creates a new selection instance based on the given {@link module:engine/model/selection~Selectable selectable}
735
- * or creates an empty selection if no arguments were passed.
736
- *
737
- * Note: This method is also available as
738
- * {@link module:engine/model/writer~Writer#createSelection `Writer#createSelection()`}.
739
- *
740
- * ```ts
741
- * // Creates empty selection without ranges.
742
- * const selection = writer.createSelection();
743
- *
744
- * // Creates selection at the given range.
745
- * const range = writer.createRange( start, end );
746
- * const selection = writer.createSelection( range );
747
- *
748
- * // Creates selection at the given ranges
749
- * const ranges = [ writer.createRange( start1, end2 ), writer.createRange( star2, end2 ) ];
750
- * const selection = writer.createSelection( ranges );
751
- *
752
- * // Creates selection from the other selection.
753
- * // Note: It doesn't copies selection attributes.
754
- * const otherSelection = writer.createSelection();
755
- * const selection = writer.createSelection( otherSelection );
756
- *
757
- * // Creates selection from the given document selection.
758
- * // Note: It doesn't copies selection attributes.
759
- * const documentSelection = model.document.selection;
760
- * const selection = writer.createSelection( documentSelection );
761
- *
762
- * // Creates selection at the given position.
763
- * const position = writer.createPositionFromPath( root, path );
764
- * const selection = writer.createSelection( position );
765
- *
766
- * // Creates selection at the given offset in the given element.
767
- * const paragraph = writer.createElement( 'paragraph' );
768
- * const selection = writer.createSelection( paragraph, offset );
769
- *
770
- * // Creates a range inside an {@link module:engine/model/element~Element element} which starts before the
771
- * // first child of that element and ends after the last child of that element.
772
- * const selection = writer.createSelection( paragraph, 'in' );
773
- *
774
- * // Creates a range on an {@link module:engine/model/item~Item item} which starts before the item and ends
775
- * // just after the item.
776
- * const selection = writer.createSelection( paragraph, 'on' );
777
- *
778
- * // Additional options (`'backward'`) can be specified as the last argument.
779
- *
780
- * // Creates backward selection.
781
- * const selection = writer.createSelection( range, { backward: true } );
782
- * ```
783
- */
784
733
  createSelection(...args) {
785
734
  return new ModelSelection(...args);
786
735
  }
@@ -19,7 +19,7 @@ import type Document from '../document';
19
19
  */
20
20
  export default class MergeOperation extends Operation {
21
21
  /**
22
- * Position inside the merged element. All nodes from that element after that position will be moved to {@link ~#targetPosition}.
22
+ * Position inside the merged element. All nodes from that element after that position will be moved to {@link #targetPosition}.
23
23
  */
24
24
  sourcePosition: Position;
25
25
  /**
@@ -38,7 +38,7 @@ export default class MergeOperation extends Operation {
38
38
  * Creates a merge operation.
39
39
  *
40
40
  * @param sourcePosition Position inside the merged element. All nodes from that
41
- * element after that position will be moved to {@link ~#targetPosition}.
41
+ * element after that position will be moved to {@link #targetPosition}.
42
42
  * @param howMany Summary offset size of nodes which will be moved from the merged element to the new parent.
43
43
  * @param targetPosition Position which the nodes from the merged elements will be moved to.
44
44
  * @param graveyardPosition Position in graveyard to which the merged element will be moved.
@@ -24,7 +24,7 @@ export default class MergeOperation extends Operation {
24
24
  * Creates a merge operation.
25
25
  *
26
26
  * @param sourcePosition Position inside the merged element. All nodes from that
27
- * element after that position will be moved to {@link ~#targetPosition}.
27
+ * element after that position will be moved to {@link #targetPosition}.
28
28
  * @param howMany Summary offset size of nodes which will be moved from the merged element to the new parent.
29
29
  * @param targetPosition Position which the nodes from the merged elements will be moved to.
30
30
  * @param graveyardPosition Position in graveyard to which the merged element will be moved.
@@ -58,7 +58,7 @@ export default class SplitOperation extends Operation {
58
58
  get moveTargetPosition(): Position;
59
59
  /**
60
60
  * Artificial range that contains all the nodes from the split element that will be moved to the new element.
61
- * The range starts at {@link ~#splitPosition} and ends in the same parent, at `POSITIVE_INFINITY` offset.
61
+ * The range starts at {@link #splitPosition} and ends in the same parent, at `POSITIVE_INFINITY` offset.
62
62
  */
63
63
  get movedRange(): Range;
64
64
  /**
@@ -59,7 +59,7 @@ export default class SplitOperation extends Operation {
59
59
  }
60
60
  /**
61
61
  * Artificial range that contains all the nodes from the split element that will be moved to the new element.
62
- * The range starts at {@link ~#splitPosition} and ends in the same parent, at `POSITIVE_INFINITY` offset.
62
+ * The range starts at {@link #splitPosition} and ends in the same parent, at `POSITIVE_INFINITY` offset.
63
63
  */
64
64
  get movedRange() {
65
65
  const end = this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);
@@ -47,7 +47,7 @@ export declare function _move(this: any, sourceRange: Range, targetPosition: Pos
47
47
  export declare function _setAttribute(range: Range, key: string, value: unknown): void;
48
48
  /**
49
49
  * Normalizes given object or an array of objects to an array of {@link module:engine/model/node~Node nodes}. See
50
- * {@link module:engine/model/node~NodeSet NodeSet} for details on how normalization is performed.
50
+ * {@link ~NodeSet NodeSet} for details on how normalization is performed.
51
51
  *
52
52
  * @internal
53
53
  * @param nodes Objects to normalize.
@@ -115,7 +115,7 @@ export function _setAttribute(range, key, value) {
115
115
  }
116
116
  /**
117
117
  * Normalizes given object or an array of objects to an array of {@link module:engine/model/node~Node nodes}. See
118
- * {@link module:engine/model/node~NodeSet NodeSet} for details on how normalization is performed.
118
+ * {@link ~NodeSet NodeSet} for details on how normalization is performed.
119
119
  *
120
120
  * @internal
121
121
  * @param nodes Objects to normalize.
@@ -509,16 +509,16 @@ export default class Schema extends Schema_base {
509
509
  private _getValidRangesForRange;
510
510
  }
511
511
  /**
512
- * Event fired when the {@link #checkChild} method is called. It allows plugging in
512
+ * Event fired when the {@link ~Schema#checkChild} method is called. It allows plugging in
513
513
  * additional behavior, for example implementing rules which cannot be defined using the declarative
514
514
  * {@link module:engine/model/schema~SchemaItemDefinition} interface.
515
515
  *
516
- * **Note:** The {@link #addChildCheck} method is a more handy way to register callbacks. Internally,
516
+ * **Note:** The {@link ~Schema#addChildCheck} method is a more handy way to register callbacks. Internally,
517
517
  * it registers a listener to this event but comes with a simpler API and it is the recommended choice
518
518
  * in most of the cases.
519
519
  *
520
- * The {@link #checkChild} method fires an event because it is
521
- * {@link module:utils/observablemixin~ObservableMixin#decorate decorated} with it. Thanks to that you can
520
+ * The {@link ~Schema#checkChild} method fires an event because it is
521
+ * {@link module:utils/observablemixin~Observable#decorate decorated} with it. Thanks to that you can
522
522
  * use this event in various ways, but the most important use case is overriding standard behavior of the
523
523
  * `checkChild()` method. Let's see a typical listener template:
524
524
  *
@@ -571,7 +571,7 @@ export default class Schema extends Schema_base {
571
571
  * }, { priority: 'high' } );
572
572
  * ```
573
573
  *
574
- * @eventName checkChild
574
+ * @eventName ~Schema#checkChild
575
575
  * @param args The `checkChild()`'s arguments.
576
576
  */
577
577
  export type SchemaCheckChildEvent = {
@@ -579,16 +579,16 @@ export type SchemaCheckChildEvent = {
579
579
  args: [[context: SchemaContext, def: SchemaCompiledItemDefinition]];
580
580
  };
581
581
  /**
582
- * Event fired when the {@link #checkAttribute} method is called. It allows plugging in
582
+ * Event fired when the {@link ~Schema#checkAttribute} method is called. It allows plugging in
583
583
  * additional behavior, for example implementing rules which cannot be defined using the declarative
584
584
  * {@link module:engine/model/schema~SchemaItemDefinition} interface.
585
585
  *
586
- * **Note:** The {@link #addAttributeCheck} method is a more handy way to register callbacks. Internally,
586
+ * **Note:** The {@link ~Schema#addAttributeCheck} method is a more handy way to register callbacks. Internally,
587
587
  * it registers a listener to this event but comes with a simpler API and it is the recommended choice
588
588
  * in most of the cases.
589
589
  *
590
- * The {@link #checkAttribute} method fires an event because it is
591
- * {@link module:utils/observablemixin~ObservableMixin#decorate decorated} with it. Thanks to that you can
590
+ * The {@link ~Schema#checkAttribute} method fires an event because it is
591
+ * {@link module:utils/observablemixin~Observable#decorate decorated} with it. Thanks to that you can
592
592
  * use this event in various ways, but the most important use case is overriding the standard behavior of the
593
593
  * `checkAttribute()` method. Let's see a typical listener template:
594
594
  *
@@ -638,7 +638,7 @@ export type SchemaCheckChildEvent = {
638
638
  * }, { priority: 'high' } );
639
639
  * ```
640
640
  *
641
- * @eventName checkAttribute
641
+ * @eventName ~Schema#checkAttribute
642
642
  * @param args The `checkAttribute()`'s arguments.
643
643
  */
644
644
  export type SchemaCheckAttributeEvent = {
@@ -61,9 +61,9 @@ export default class Schema extends ObservableMixin() {
61
61
  *
62
62
  * This situation may happen when:
63
63
  *
64
- * * Two or more plugins called {@link #register `register()`} with the same name. This will usually mean that
65
- * there is a collision between plugins which try to use the same element in the model. Unfortunately,
66
- * the only way to solve this is by modifying one of these plugins to use a unique model element name.
64
+ * * Two or more plugins called {@link module:engine/model/schema~Schema#register `register()`} with the same name.
65
+ * This will usually mean that there is a collision between plugins which try to use the same element in the model.
66
+ * Unfortunately, the only way to solve this is by modifying one of these plugins to use a unique model element name.
67
67
  * * A single plugin was loaded twice. This happens when it is installed by npm/yarn in two versions
68
68
  * and usually means one or more of the following issues:
69
69
  * * a version mismatch (two of your dependencies require two different versions of this plugin),
@@ -113,7 +113,7 @@ export default class Schema extends ObservableMixin() {
113
113
  * Cannot extend an item which was not registered yet.
114
114
  *
115
115
  * This error happens when a plugin tries to extend the schema definition of an item which was not
116
- * {@link #register registered} yet.
116
+ * {@link module:engine/model/schema~Schema#register registered} yet.
117
117
  *
118
118
  * @param itemName The name of the model element which is being extended.
119
119
  * @error schema-cannot-extend-missing-item
@@ -420,7 +420,7 @@ export type SelectionChangeEvent = {
420
420
  /**
421
421
  * Fired when selection range(s) changed.
422
422
  *
423
- * @eventName change:range
423
+ * @eventName ~Selection#change:range
424
424
  * @param directChange In case of {@link module:engine/model/selection~Selection} class it is always set
425
425
  * to `true` which indicates that the selection change was caused by a direct use of selection's API.
426
426
  * The {@link module:engine/model/documentselection~DocumentSelection}, however, may change because its position
@@ -440,7 +440,7 @@ export type SelectionChangeRangeEvent = {
440
440
  /**
441
441
  * Fired when selection attribute changed.
442
442
  *
443
- * @eventName change:attribute
443
+ * @eventName ~Selection#change:attribute
444
444
  * @param directChange In case of {@link module:engine/model/selection~Selection} class it is always set
445
445
  * to `true` which indicates that the selection change was caused by a direct use of selection's API.
446
446
  * The {@link module:engine/model/documentselection~DocumentSelection}, however, may change because its attributes