@ckeditor/ckeditor5-engine 41.4.1 → 42.0.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.
- package/README.md +6 -0
- package/dist/index.js +15151 -13052
- package/dist/index.js.map +1 -1
- package/dist/types/controller/datacontroller.d.ts +1 -1
- package/dist/types/controller/editingcontroller.d.ts +1 -1
- package/dist/types/conversion/downcastdispatcher.d.ts +1 -1
- package/dist/types/conversion/mapper.d.ts +1 -1
- package/dist/types/conversion/upcastdispatcher.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/model/differ.d.ts +134 -42
- package/dist/types/model/document.d.ts +1 -1
- package/dist/types/model/documentselection.d.ts +1 -1
- package/dist/types/model/liveposition.d.ts +1 -1
- package/dist/types/model/liverange.d.ts +1 -1
- package/dist/types/model/markercollection.d.ts +2 -2
- package/dist/types/model/model.d.ts +1 -1
- package/dist/types/model/schema.d.ts +32 -6
- package/dist/types/model/selection.d.ts +1 -1
- package/dist/types/view/document.d.ts +1 -1
- package/dist/types/view/documentfragment.d.ts +1 -1
- package/dist/types/view/documentselection.d.ts +1 -1
- package/dist/types/view/domconverter.d.ts +9 -0
- package/dist/types/view/editableelement.d.ts +1 -1
- package/dist/types/view/node.d.ts +1 -1
- package/dist/types/view/observer/observer.d.ts +1 -1
- package/dist/types/view/renderer.d.ts +1 -1
- package/dist/types/view/selection.d.ts +1 -1
- package/dist/types/view/view.d.ts +1 -1
- package/package.json +2 -2
- package/src/controller/datacontroller.d.ts +1 -1
- package/src/controller/datacontroller.js +1 -1
- package/src/controller/editingcontroller.d.ts +1 -1
- package/src/controller/editingcontroller.js +1 -1
- package/src/conversion/downcastdispatcher.d.ts +1 -1
- package/src/conversion/downcastdispatcher.js +1 -1
- package/src/conversion/mapper.d.ts +1 -1
- package/src/conversion/mapper.js +1 -1
- package/src/conversion/upcastdispatcher.d.ts +1 -1
- package/src/conversion/upcastdispatcher.js +1 -1
- package/src/index.d.ts +2 -1
- package/src/index.js +1 -0
- package/src/model/differ.d.ts +134 -42
- package/src/model/differ.js +247 -125
- package/src/model/document.d.ts +1 -1
- package/src/model/document.js +1 -1
- package/src/model/documentselection.d.ts +1 -1
- package/src/model/documentselection.js +1 -1
- package/src/model/liveposition.d.ts +1 -1
- package/src/model/liveposition.js +1 -1
- package/src/model/liverange.d.ts +1 -1
- package/src/model/liverange.js +1 -1
- package/src/model/markercollection.d.ts +2 -2
- package/src/model/markercollection.js +2 -2
- package/src/model/model.d.ts +1 -1
- package/src/model/model.js +1 -1
- package/src/model/schema.d.ts +32 -6
- package/src/model/schema.js +208 -101
- package/src/model/selection.d.ts +1 -1
- package/src/model/selection.js +1 -1
- package/src/view/document.d.ts +1 -1
- package/src/view/document.js +1 -1
- package/src/view/documentfragment.d.ts +1 -1
- package/src/view/documentfragment.js +1 -1
- package/src/view/documentselection.d.ts +1 -1
- package/src/view/documentselection.js +1 -1
- package/src/view/domconverter.d.ts +9 -0
- package/src/view/domconverter.js +27 -5
- package/src/view/editableelement.d.ts +1 -1
- package/src/view/editableelement.js +1 -1
- package/src/view/node.d.ts +1 -1
- package/src/view/node.js +1 -1
- package/src/view/observer/observer.d.ts +1 -1
- package/src/view/observer/observer.js +1 -1
- package/src/view/renderer.d.ts +1 -1
- package/src/view/renderer.js +1 -1
- package/src/view/selection.d.ts +1 -1
- package/src/view/selection.js +1 -1
- package/src/view/view.d.ts +1 -1
- package/src/view/view.js +1 -1
|
@@ -42,7 +42,7 @@ declare const DataController_base: {
|
|
|
42
42
|
* editor.data.get( { rootName: 'customRoot' } ); // -> '<p>Hello!</p>'
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
export default class DataController extends DataController_base {
|
|
45
|
+
export default class DataController extends /* #__PURE__ */ DataController_base {
|
|
46
46
|
/**
|
|
47
47
|
* Data model.
|
|
48
48
|
*/
|
|
@@ -22,7 +22,7 @@ declare const EditingController_base: {
|
|
|
22
22
|
* including selection handling. It also creates the {@link ~EditingController#view view} which builds a
|
|
23
23
|
* browser-independent virtualization over the DOM elements. The editing controller also attaches default converters.
|
|
24
24
|
*/
|
|
25
|
-
export default class EditingController extends EditingController_base {
|
|
25
|
+
export default class EditingController extends /* #__PURE__ */ EditingController_base {
|
|
26
26
|
/**
|
|
27
27
|
* Editor model.
|
|
28
28
|
*/
|
|
@@ -117,7 +117,7 @@ declare const DowncastDispatcher_base: {
|
|
|
117
117
|
* } );
|
|
118
118
|
* ```
|
|
119
119
|
*/
|
|
120
|
-
export default class DowncastDispatcher extends DowncastDispatcher_base {
|
|
120
|
+
export default class DowncastDispatcher extends /* #__PURE__ */ DowncastDispatcher_base {
|
|
121
121
|
/**
|
|
122
122
|
* A template for an interface passed by the dispatcher to the event callbacks.
|
|
123
123
|
*
|
|
@@ -41,7 +41,7 @@ declare const Mapper_base: {
|
|
|
41
41
|
* with `'lowest'` priority. To override default `Mapper` mapping, add custom callback with higher priority and
|
|
42
42
|
* stop the event.
|
|
43
43
|
*/
|
|
44
|
-
export default class Mapper extends Mapper_base {
|
|
44
|
+
export default class Mapper extends /* #__PURE__ */ Mapper_base {
|
|
45
45
|
/**
|
|
46
46
|
* Model element to view element mapping.
|
|
47
47
|
*/
|
|
@@ -121,7 +121,7 @@ declare const UpcastDispatcher_base: {
|
|
|
121
121
|
* @fires text
|
|
122
122
|
* @fires documentFragment
|
|
123
123
|
*/
|
|
124
|
-
export default class UpcastDispatcher extends UpcastDispatcher_base {
|
|
124
|
+
export default class UpcastDispatcher extends /* #__PURE__ */ UpcastDispatcher_base {
|
|
125
125
|
/**
|
|
126
126
|
* An interface passed by the dispatcher to the event callbacks.
|
|
127
127
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export type { default as ModelConsumable } from './conversion/modelconsumable.js
|
|
|
21
21
|
export type { Consumables, default as ViewConsumable } from './conversion/viewconsumable.js';
|
|
22
22
|
export type { default as DataProcessor } from './dataprocessor/dataprocessor.js';
|
|
23
23
|
export { default as HtmlDataProcessor } from './dataprocessor/htmldataprocessor.js';
|
|
24
|
+
export { default as XmlDataProcessor } from './dataprocessor/xmldataprocessor.js';
|
|
24
25
|
export type { default as Operation } from './model/operation/operation.js';
|
|
25
26
|
export { default as InsertOperation } from './model/operation/insertoperation.js';
|
|
26
27
|
export { default as MoveOperation } from './model/operation/moveoperation.js';
|
|
@@ -92,7 +93,7 @@ export { default as ClickObserver } from './view/observer/clickobserver.js';
|
|
|
92
93
|
export { default as DomEventObserver } from './view/observer/domeventobserver.js';
|
|
93
94
|
export { default as MouseObserver } from './view/observer/mouseobserver.js';
|
|
94
95
|
export { default as TabObserver } from './view/observer/tabobserver.js';
|
|
95
|
-
export { default as FocusObserver } from './view/observer/focusobserver.js';
|
|
96
|
+
export { default as FocusObserver, type ViewDocumentBlurEvent, type ViewDocumentFocusEvent } from './view/observer/focusobserver.js';
|
|
96
97
|
export { default as DowncastWriter } from './view/downcastwriter.js';
|
|
97
98
|
export { default as UpcastWriter } from './view/upcastwriter.js';
|
|
98
99
|
export { default as Matcher, type MatcherPattern, type MatcherObjectPattern, type Match, type MatchResult } from './view/matcher.js';
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
import Position from './position.js';
|
|
13
13
|
import Range from './range.js';
|
|
14
14
|
import type { default as MarkerCollection, MarkerData } from './markercollection.js';
|
|
15
|
-
import type Element from './element.js';
|
|
16
15
|
import type Item from './item.js';
|
|
16
|
+
import type Node from './node.js';
|
|
17
17
|
import type RootElement from './rootelement.js';
|
|
18
18
|
import type Operation from './operation/operation.js';
|
|
19
19
|
/**
|
|
@@ -25,6 +25,11 @@ import type Operation from './operation/operation.js';
|
|
|
25
25
|
* elements and new ones and returns a change set.
|
|
26
26
|
*/
|
|
27
27
|
export default class Differ {
|
|
28
|
+
/**
|
|
29
|
+
* Priority of the {@link ~Differ#_elementState element states}. States on higher indexes of the array can overwrite states on the lower
|
|
30
|
+
* indexes.
|
|
31
|
+
*/
|
|
32
|
+
private static readonly _statesPriority;
|
|
28
33
|
/**
|
|
29
34
|
* Reference to the model's marker collection.
|
|
30
35
|
*/
|
|
@@ -37,18 +42,48 @@ export default class Differ {
|
|
|
37
42
|
*/
|
|
38
43
|
private readonly _changesInElement;
|
|
39
44
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
45
|
+
* Stores a snapshot for these model nodes that might have changed.
|
|
46
|
+
*
|
|
47
|
+
* This complements {@link ~Differ#_elementChildrenSnapshots `_elementChildrenSnapshots`}.
|
|
48
|
+
*
|
|
49
|
+
* See also {@link ~DifferSnapshot}.
|
|
43
50
|
*/
|
|
44
|
-
private readonly
|
|
51
|
+
private readonly _elementsSnapshots;
|
|
52
|
+
/**
|
|
53
|
+
* For each element or document fragment inside which there was a change, it stores a snapshot of the child nodes list (an array
|
|
54
|
+
* of children snapshots that represent the state in the element / fragment before any change has happened).
|
|
55
|
+
*
|
|
56
|
+
* This complements {@link ~Differ#_elementsSnapshots `_elementsSnapshots`}.
|
|
57
|
+
*
|
|
58
|
+
* See also {@link ~DifferSnapshot}.
|
|
59
|
+
*/
|
|
60
|
+
private readonly _elementChildrenSnapshots;
|
|
61
|
+
/**
|
|
62
|
+
* Keeps the state for a given element, describing how the element was changed so far. It is used to evaluate the `action` property
|
|
63
|
+
* of diff items returned by {@link ~Differ#getChanges}.
|
|
64
|
+
*
|
|
65
|
+
* Possible values, in the order from the lowest priority to the highest priority:
|
|
66
|
+
*
|
|
67
|
+
* * `'refresh'` - element was refreshed,
|
|
68
|
+
* * `'rename'` - element was renamed,
|
|
69
|
+
* * `'move'` - element was moved (or, usually, removed, that is moved to the graveyard).
|
|
70
|
+
*
|
|
71
|
+
* Element that was refreshed, may change its state to `'rename'` if it was later renamed, or to `'move'` if it was removed.
|
|
72
|
+
* But the element cannot change its state from `'move'` to `'rename'`, or from `'rename'` to `'refresh'`.
|
|
73
|
+
*
|
|
74
|
+
* Only already existing elements are registered in `_elementState`. If a new element was inserted as a result of a buffered operation,
|
|
75
|
+
* it is not be registered in `_elementState`.
|
|
76
|
+
*/
|
|
77
|
+
private readonly _elementState;
|
|
45
78
|
/**
|
|
46
79
|
* A map that stores all changed markers.
|
|
47
80
|
*
|
|
48
81
|
* The keys of the map are marker names.
|
|
82
|
+
*
|
|
49
83
|
* The values of the map are objects with the following properties:
|
|
50
|
-
*
|
|
51
|
-
*
|
|
84
|
+
*
|
|
85
|
+
* * `oldMarkerData`,
|
|
86
|
+
* * `newMarkerData`.
|
|
52
87
|
*/
|
|
53
88
|
private readonly _changedMarkers;
|
|
54
89
|
/**
|
|
@@ -93,7 +128,7 @@ export default class Differ {
|
|
|
93
128
|
*/
|
|
94
129
|
get isEmpty(): boolean;
|
|
95
130
|
/**
|
|
96
|
-
* Buffers the given operation. An operation has to be buffered before it is executed
|
|
131
|
+
* Buffers the given operation. **An operation has to be buffered before it is executed.**
|
|
97
132
|
*
|
|
98
133
|
* @param operationToBuffer An operation to buffer.
|
|
99
134
|
*/
|
|
@@ -181,14 +216,6 @@ export default class Differ {
|
|
|
181
216
|
* Resets `Differ`. Removes all buffered changes.
|
|
182
217
|
*/
|
|
183
218
|
reset(): void;
|
|
184
|
-
/**
|
|
185
|
-
* Buffers the root state change after the root was attached or detached
|
|
186
|
-
*/
|
|
187
|
-
private _bufferRootStateChange;
|
|
188
|
-
/**
|
|
189
|
-
* Buffers a root attribute change.
|
|
190
|
-
*/
|
|
191
|
-
private _bufferRootAttributeChange;
|
|
192
219
|
/**
|
|
193
220
|
* Marks the given `item` in differ to be "refreshed". It means that the item will be marked as removed and inserted
|
|
194
221
|
* in the differ changes set, so it will be effectively re-converted when the differ changes are handled by a dispatcher.
|
|
@@ -210,6 +237,14 @@ export default class Differ {
|
|
|
210
237
|
* @internal
|
|
211
238
|
*/
|
|
212
239
|
_bufferRootLoad(root: RootElement): void;
|
|
240
|
+
/**
|
|
241
|
+
* Buffers the root state change after the root was attached or detached
|
|
242
|
+
*/
|
|
243
|
+
private _bufferRootStateChange;
|
|
244
|
+
/**
|
|
245
|
+
* Buffers a root attribute change.
|
|
246
|
+
*/
|
|
247
|
+
private _bufferRootAttributeChange;
|
|
213
248
|
/**
|
|
214
249
|
* Saves and handles an insert change.
|
|
215
250
|
*/
|
|
@@ -226,14 +261,34 @@ export default class Differ {
|
|
|
226
261
|
* Saves and handles a model change.
|
|
227
262
|
*/
|
|
228
263
|
private _markChange;
|
|
264
|
+
/**
|
|
265
|
+
* Tries to set given state for given item.
|
|
266
|
+
*
|
|
267
|
+
* This method does simple validation (it sets the state only for model elements, not for text proxy nodes). It also follows state
|
|
268
|
+
* setting rules, that is, `'refresh'` cannot overwrite `'rename'`, and `'rename'` cannot overwrite `'move'`.
|
|
269
|
+
*/
|
|
270
|
+
private _setElementState;
|
|
271
|
+
/**
|
|
272
|
+
* Returns a value for {@link ~DifferItemAction `action`} property for diff items returned by {@link ~Differ#getChanges}.
|
|
273
|
+
* This method aims to return `'rename'` or `'refresh'` when it should, and `diffItemType` ("default action") in all other cases.
|
|
274
|
+
*
|
|
275
|
+
* It bases on a few factors:
|
|
276
|
+
*
|
|
277
|
+
* * for text nodes, the method always returns `diffItemType`,
|
|
278
|
+
* * for newly inserted element, the method returns `diffItemType`,
|
|
279
|
+
* * if {@link ~Differ#_elementState element state} was not recorded, the method returns `diffItemType`,
|
|
280
|
+
* * if state was recorded, and it was `'move'` (default action), the method returns `diffItemType`,
|
|
281
|
+
* * finally, if state was `'refresh'` or `'rename'`, the method returns the state value.
|
|
282
|
+
*/
|
|
283
|
+
private _getDiffActionForNode;
|
|
229
284
|
/**
|
|
230
285
|
* Gets an array of changes that have already been saved for a given element.
|
|
231
286
|
*/
|
|
232
287
|
private _getChangesForElement;
|
|
233
288
|
/**
|
|
234
|
-
*
|
|
289
|
+
* Creates and saves a snapshot for all children of the given element.
|
|
235
290
|
*/
|
|
236
|
-
private
|
|
291
|
+
private _makeSnapshots;
|
|
237
292
|
/**
|
|
238
293
|
* For a given newly saved change, compares it with a change already done on the element and modifies the incoming
|
|
239
294
|
* change and/or the old change.
|
|
@@ -247,7 +302,9 @@ export default class Differ {
|
|
|
247
302
|
*
|
|
248
303
|
* @param parent The element in which the change happened.
|
|
249
304
|
* @param offset The offset at which change happened.
|
|
250
|
-
* @param
|
|
305
|
+
* @param action Further specifies what kind of action led to generating this change.
|
|
306
|
+
* @param elementSnapshot Snapshot of the inserted node after changes.
|
|
307
|
+
* @param elementSnapshotBefore Snapshot of the inserted node before changes.
|
|
251
308
|
* @returns The diff item.
|
|
252
309
|
*/
|
|
253
310
|
private _getInsertDiff;
|
|
@@ -256,7 +313,8 @@ export default class Differ {
|
|
|
256
313
|
*
|
|
257
314
|
* @param parent The element in which change happened.
|
|
258
315
|
* @param offset The offset at which change happened.
|
|
259
|
-
* @param
|
|
316
|
+
* @param action Further specifies what kind of action led to generating this change.
|
|
317
|
+
* @param elementSnapshot The snapshot of the removed node before changes.
|
|
260
318
|
* @returns The diff item.
|
|
261
319
|
*/
|
|
262
320
|
private _getRemoveDiff;
|
|
@@ -279,6 +337,32 @@ export default class Differ {
|
|
|
279
337
|
*/
|
|
280
338
|
private _removeAllNestedChanges;
|
|
281
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* Further specifies what kind of action led to generating a change:
|
|
342
|
+
*
|
|
343
|
+
* * `'insert'` if element was inserted,
|
|
344
|
+
* * `'remove'` if element was removed,
|
|
345
|
+
* * `'rename'` if element got renamed (e.g. `writer.rename()`),
|
|
346
|
+
* * `'refresh'` if element got refreshed (e.g. `model.editing.reconvertItem()`).
|
|
347
|
+
*/
|
|
348
|
+
export type DifferItemAction = 'insert' | 'remove' | 'rename' | 'refresh';
|
|
349
|
+
/**
|
|
350
|
+
* A snapshot is representing state of a given element before the first change was applied on that element.
|
|
351
|
+
*/
|
|
352
|
+
export interface DifferSnapshot {
|
|
353
|
+
/**
|
|
354
|
+
* Node for which was snapshot was made.
|
|
355
|
+
*/
|
|
356
|
+
node: Node;
|
|
357
|
+
/**
|
|
358
|
+
* Name of the element at the time when the snapshot was made. For text node snapshots, it is set to `'$text'`.
|
|
359
|
+
*/
|
|
360
|
+
name: string;
|
|
361
|
+
/**
|
|
362
|
+
* Attributes of the node at the time when the snapshot was made.
|
|
363
|
+
*/
|
|
364
|
+
attributes: Map<string, unknown>;
|
|
365
|
+
}
|
|
282
366
|
/**
|
|
283
367
|
* The single diff item.
|
|
284
368
|
*
|
|
@@ -298,19 +382,19 @@ export interface DiffItemInsert {
|
|
|
298
382
|
*/
|
|
299
383
|
type: 'insert';
|
|
300
384
|
/**
|
|
301
|
-
*
|
|
385
|
+
* Further specifies what kind of action led to generating this change.
|
|
302
386
|
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
387
|
+
* The action is set in relation to the document state before any change. It means that, for example, if an element was added and
|
|
388
|
+
* then renamed (during the same {@link module:engine/model/batch~Batch batch}), the action will be set to `'insert'`, because when
|
|
389
|
+
* compared to the document state before changes, a new element was inserted, and the renaming does not matter from this point of view.
|
|
306
390
|
*/
|
|
307
|
-
|
|
391
|
+
action: DifferItemAction;
|
|
308
392
|
/**
|
|
309
393
|
* The name of the inserted elements or `'$text'` for a text node.
|
|
310
394
|
*/
|
|
311
395
|
name: string;
|
|
312
396
|
/**
|
|
313
|
-
* Map of attributes
|
|
397
|
+
* Map of attributes of the inserted element.
|
|
314
398
|
*/
|
|
315
399
|
attributes: Map<string, unknown>;
|
|
316
400
|
/**
|
|
@@ -321,6 +405,25 @@ export interface DiffItemInsert {
|
|
|
321
405
|
* The length of an inserted text node. For elements, it is always 1 as each inserted element is counted as a one.
|
|
322
406
|
*/
|
|
323
407
|
length: number;
|
|
408
|
+
/**
|
|
409
|
+
* Holds information about the element state before all changes happened.
|
|
410
|
+
*
|
|
411
|
+
* For example, when `<paragraph textAlign="right">` was changed to `<codeBlock language="plaintext">`,
|
|
412
|
+
* `before.name` will be equal to `'paragraph'` and `before.attributes` map will have one entry: `'textAlign' -> 'right'`.
|
|
413
|
+
*
|
|
414
|
+
* The property is available only if the insertion change was due to element rename or refresh (when `action` property is `'rename'`
|
|
415
|
+
* or `'refresh'`). As such, `before` property is never available for text node changes.
|
|
416
|
+
*/
|
|
417
|
+
before?: {
|
|
418
|
+
/**
|
|
419
|
+
* The name of the inserted element before all changes.
|
|
420
|
+
*/
|
|
421
|
+
name: string;
|
|
422
|
+
/**
|
|
423
|
+
* Map of the attributes of the inserted element before all changes.
|
|
424
|
+
*/
|
|
425
|
+
attributes: Map<string, unknown>;
|
|
426
|
+
};
|
|
324
427
|
}
|
|
325
428
|
/**
|
|
326
429
|
* A single diff item for removed nodes.
|
|
@@ -331,24 +434,13 @@ export interface DiffItemRemove {
|
|
|
331
434
|
*/
|
|
332
435
|
type: 'remove';
|
|
333
436
|
/**
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
* Undefined if the diff item is related to text node deletion.
|
|
437
|
+
* Further specifies what kind of action led to generating this change.
|
|
337
438
|
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
* Instead, you should use {@link ~DiffItemRemove#name `DiffItemRemove#name`},
|
|
343
|
-
* {@link ~DiffItemRemove#attributes `DiffItemRemove#attributes`}, and {@link ~DiffItemRemove#position `DiffItemRemove#position`}.
|
|
344
|
-
*
|
|
345
|
-
* This property should be only used to check instance reference equality. For example, if you want to detect that some particular
|
|
346
|
-
* element was removed, you can check `_element` property. You can use it together with {@link ~DiffItemInsert#_element `#_element`} on
|
|
347
|
-
* insert diff items to detect move, refresh, or rename changes.
|
|
348
|
-
*
|
|
349
|
-
* @internal
|
|
439
|
+
* The action is set in relation to the document state before any change. It means that, for example, if an element was renamed and
|
|
440
|
+
* then removed (during the same {@link module:engine/model/batch~Batch batch}), the action will be set to `'remove'`, because when
|
|
441
|
+
* compared to the document state before changes, the element was removed, and it does not matter that it was also renamed at one point.
|
|
350
442
|
*/
|
|
351
|
-
|
|
443
|
+
action: DifferItemAction;
|
|
352
444
|
/**
|
|
353
445
|
* The name of the removed element or `'$text'` for a text node.
|
|
354
446
|
*/
|
|
@@ -40,7 +40,7 @@ declare const Document_base: {
|
|
|
40
40
|
* However, the document may contain multiple roots – e.g. when the editor has multiple editable areas
|
|
41
41
|
* (e.g. a title and a body of a message).
|
|
42
42
|
*/
|
|
43
|
-
export default class Document extends Document_base {
|
|
43
|
+
export default class Document extends /* #__PURE__ */ Document_base {
|
|
44
44
|
/**
|
|
45
45
|
* The {@link module:engine/model/model~Model model} that the document is a part of.
|
|
46
46
|
*/
|
|
@@ -43,7 +43,7 @@ declare const DocumentSelection_base: import("@ckeditor/ckeditor5-utils").Mixed<
|
|
|
43
43
|
* If you need to represent a selection in document fragment,
|
|
44
44
|
* use {@link module:engine/model/selection~Selection Selection class} instead.
|
|
45
45
|
*/
|
|
46
|
-
export default class DocumentSelection extends DocumentSelection_base {
|
|
46
|
+
export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection_base {
|
|
47
47
|
/**
|
|
48
48
|
* Selection used internally by that class (`DocumentSelection` is a proxy to that selection).
|
|
49
49
|
*/
|
|
@@ -27,7 +27,7 @@ declare const LivePosition_base: import("@ckeditor/ckeditor5-utils").Mixed<typeo
|
|
|
27
27
|
* have to be unbound.
|
|
28
28
|
* Use {@link module:engine/model/liveposition~LivePosition#detach} whenever you don't need `LivePosition` anymore.
|
|
29
29
|
*/
|
|
30
|
-
export default class LivePosition extends LivePosition_base {
|
|
30
|
+
export default class LivePosition extends /* #__PURE__ */ LivePosition_base {
|
|
31
31
|
/**
|
|
32
32
|
* Root of the position path.
|
|
33
33
|
*/
|
|
@@ -23,7 +23,7 @@ declare const LiveRange_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof R
|
|
|
23
23
|
* **Note:** Be very careful when dealing with `LiveRange`. Each `LiveRange` instance bind events that might
|
|
24
24
|
* have to be unbound. Use {@link module:engine/model/liverange~LiveRange#detach detach} whenever you don't need `LiveRange` anymore.
|
|
25
25
|
*/
|
|
26
|
-
export default class LiveRange extends LiveRange_base {
|
|
26
|
+
export default class LiveRange extends /* #__PURE__ */ LiveRange_base {
|
|
27
27
|
/**
|
|
28
28
|
* Creates a live range.
|
|
29
29
|
*
|
|
@@ -31,7 +31,7 @@ declare const MarkerCollection_base: {
|
|
|
31
31
|
*
|
|
32
32
|
* @see module:engine/model/markercollection~Marker
|
|
33
33
|
*/
|
|
34
|
-
export default class MarkerCollection extends MarkerCollection_base implements Iterable<Marker> {
|
|
34
|
+
export default class MarkerCollection extends /* #__PURE__ */ MarkerCollection_base implements Iterable<Marker> {
|
|
35
35
|
/**
|
|
36
36
|
* Stores {@link ~Marker markers} added to the collection.
|
|
37
37
|
*/
|
|
@@ -209,7 +209,7 @@ declare const Marker_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof Type
|
|
|
209
209
|
*
|
|
210
210
|
* `Marker` instances are created and destroyed only by {@link ~MarkerCollection MarkerCollection}.
|
|
211
211
|
*/
|
|
212
|
-
declare class Marker extends Marker_base {
|
|
212
|
+
declare class Marker extends /* #__PURE__ */ Marker_base {
|
|
213
213
|
/**
|
|
214
214
|
* Marker's name.
|
|
215
215
|
*/
|
|
@@ -32,7 +32,7 @@ declare const Model_base: {
|
|
|
32
32
|
* Editor's data model. Read about the model in the
|
|
33
33
|
* {@glink framework/architecture/editing-engine engine architecture} guide.
|
|
34
34
|
*/
|
|
35
|
-
export default class Model extends Model_base {
|
|
35
|
+
export default class Model extends /* #__PURE__ */ Model_base {
|
|
36
36
|
/**
|
|
37
37
|
* Model's marker collection.
|
|
38
38
|
*/
|
|
@@ -35,7 +35,7 @@ declare const Schema_base: {
|
|
|
35
35
|
* {@glink framework/architecture/editing-engine Introduction to the Editing engine architecture} guide.
|
|
36
36
|
* * The {@glink framework/deep-dive/schema Schema deep-dive} guide.
|
|
37
37
|
*/
|
|
38
|
-
export default class Schema extends Schema_base {
|
|
38
|
+
export default class Schema extends /* #__PURE__ */ Schema_base {
|
|
39
39
|
private readonly _sourceDefinitions;
|
|
40
40
|
/**
|
|
41
41
|
* A dictionary containing attribute properties.
|
|
@@ -677,9 +677,15 @@ export type SchemaCheckAttributeEvent = {
|
|
|
677
677
|
* * {@link ~SchemaItemDefinition#allowIn `allowIn`} – Defines in which other items this item will be allowed.
|
|
678
678
|
* * {@link ~SchemaItemDefinition#allowChildren `allowChildren`} – Defines which other items are allowed inside this item.
|
|
679
679
|
* * {@link ~SchemaItemDefinition#allowAttributes `allowAttributes`} – Defines allowed attributes of the given item.
|
|
680
|
-
* * {@link ~SchemaItemDefinition#
|
|
681
|
-
* * {@link ~SchemaItemDefinition#
|
|
682
|
-
* * {@link ~SchemaItemDefinition#
|
|
680
|
+
* * {@link ~SchemaItemDefinition#disallowIn `disallowIn`} – Defines in which other items this item will be disallowed.
|
|
681
|
+
* * {@link ~SchemaItemDefinition#disallowChildren `disallowChildren`} – Defines which other items are disallowed inside this item.
|
|
682
|
+
* * {@link ~SchemaItemDefinition#disallowAttributes `disallowAttributes`} – Defines disallowed attributes of the given item.
|
|
683
|
+
* * {@link ~SchemaItemDefinition#allowContentOf `allowContentOf`} – Makes this item allow children that are also allowed in the
|
|
684
|
+
* specified items. This acknowledges disallow rules.
|
|
685
|
+
* * {@link ~SchemaItemDefinition#allowWhere `allowWhere`} – Makes this item allowed where the specified items are allowed. This
|
|
686
|
+
* acknowledges disallow rules.
|
|
687
|
+
* * {@link ~SchemaItemDefinition#allowAttributesOf `allowAttributesOf`} – Inherits attributes from other items. This acknowledges
|
|
688
|
+
* disallow rules.
|
|
683
689
|
* * {@link ~SchemaItemDefinition#inheritTypesFrom `inheritTypesFrom`} – Inherits `is*` properties of other items.
|
|
684
690
|
* * {@link ~SchemaItemDefinition#inheritAllFrom `inheritAllFrom`} –
|
|
685
691
|
* A shorthand for `allowContentOf`, `allowWhere`, `allowAttributesOf`, `inheritTypesFrom`.
|
|
@@ -687,7 +693,6 @@ export type SchemaCheckAttributeEvent = {
|
|
|
687
693
|
* # The `is*` properties
|
|
688
694
|
*
|
|
689
695
|
* There are a couple commonly used `is*` properties. Their role is to assign additional semantics to schema items.
|
|
690
|
-
* You can define more properties but you will also need to implement support for them in the existing editor features.
|
|
691
696
|
*
|
|
692
697
|
* * {@link ~SchemaItemDefinition#isBlock `isBlock`} – Whether this item is paragraph-like.
|
|
693
698
|
* Generally speaking, content is usually made out of blocks like paragraphs, list items, images, headings, etc.
|
|
@@ -808,6 +813,15 @@ export type SchemaCheckAttributeEvent = {
|
|
|
808
813
|
* } );
|
|
809
814
|
* ```
|
|
810
815
|
*
|
|
816
|
+
* Register `inlineImage` as a kind of an inline object but disallow it inside captions:
|
|
817
|
+
*
|
|
818
|
+
* ```ts
|
|
819
|
+
* schema.register( 'imageInline', {
|
|
820
|
+
* inheritAllFrom: '$inlineObject',
|
|
821
|
+
* disallowIn: [ 'caption' ]
|
|
822
|
+
* } );
|
|
823
|
+
* ```
|
|
824
|
+
*
|
|
811
825
|
* Make `listItem` inherit all from `$block` but also allow additional attributes:
|
|
812
826
|
*
|
|
813
827
|
* ```ts
|
|
@@ -851,6 +865,18 @@ export interface SchemaItemDefinition {
|
|
|
851
865
|
* Defines allowed attributes of the given item.
|
|
852
866
|
*/
|
|
853
867
|
allowAttributes?: string | Array<string>;
|
|
868
|
+
/**
|
|
869
|
+
* Defines in which other items this item will be disallowed. Takes precedence over allow rules.
|
|
870
|
+
*/
|
|
871
|
+
disallowIn?: string | Array<string>;
|
|
872
|
+
/**
|
|
873
|
+
* Defines which other items are disallowed inside this item. Takes precedence over allow rules.
|
|
874
|
+
*/
|
|
875
|
+
disallowChildren?: string | Array<string>;
|
|
876
|
+
/**
|
|
877
|
+
* Defines disallowed attributes for this item. Takes precedence over allow rules.
|
|
878
|
+
*/
|
|
879
|
+
disallowAttributes?: string | Array<string>;
|
|
854
880
|
/**
|
|
855
881
|
* Inherits "allowed children" from other items.
|
|
856
882
|
*/
|
|
@@ -860,7 +886,7 @@ export interface SchemaItemDefinition {
|
|
|
860
886
|
*/
|
|
861
887
|
allowWhere?: string | Array<string>;
|
|
862
888
|
/**
|
|
863
|
-
* Inherits attributes from other items.
|
|
889
|
+
* Inherits "allowed attributes" from other items.
|
|
864
890
|
*/
|
|
865
891
|
allowAttributesOf?: string | Array<string>;
|
|
866
892
|
/**
|
|
@@ -24,7 +24,7 @@ declare const Selection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof T
|
|
|
24
24
|
* Additionally, selection may have its own attributes (think – whether text typed in in this selection
|
|
25
25
|
* should have those attributes – e.g. whether you type a bolded text).
|
|
26
26
|
*/
|
|
27
|
-
export default class Selection extends Selection_base {
|
|
27
|
+
export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
28
28
|
/**
|
|
29
29
|
* Specifies whether the last added range was added as a backward or forward range.
|
|
30
30
|
*/
|
|
@@ -22,7 +22,7 @@ declare const Document_base: import("@ckeditor/ckeditor5-utils").Mixed<{
|
|
|
22
22
|
* Document class creates an abstract layer over the content editable area, contains a tree of view elements and
|
|
23
23
|
* {@link module:engine/view/documentselection~DocumentSelection view selection} associated with this document.
|
|
24
24
|
*/
|
|
25
|
-
export default class Document extends Document_base {
|
|
25
|
+
export default class Document extends /* #__PURE__ */ Document_base {
|
|
26
26
|
/**
|
|
27
27
|
* Selection done on this document.
|
|
28
28
|
*/
|
|
@@ -21,7 +21,7 @@ declare const DocumentFragment_base: import("@ckeditor/ckeditor5-utils").Mixed<t
|
|
|
21
21
|
* {@link module:engine/view/upcastwriter~UpcastWriter#createDocumentFragment `UpcastWriter#createDocumentFragment()`}
|
|
22
22
|
* method.
|
|
23
23
|
*/
|
|
24
|
-
export default class DocumentFragment extends DocumentFragment_base implements Iterable<Node> {
|
|
24
|
+
export default class DocumentFragment extends /* #__PURE__ */ DocumentFragment_base implements Iterable<Node> {
|
|
25
25
|
/**
|
|
26
26
|
* The document to which this document fragment belongs.
|
|
27
27
|
*/
|
|
@@ -28,7 +28,7 @@ declare const DocumentSelection_base: import("@ckeditor/ckeditor5-utils").Mixed<
|
|
|
28
28
|
* the {@link module:engine/view/view~View#change `View#change()`} block
|
|
29
29
|
* (so via {@link module:engine/view/downcastwriter~DowncastWriter#setSelection `DowncastWriter#setSelection()`}).
|
|
30
30
|
*/
|
|
31
|
-
export default class DocumentSelection extends DocumentSelection_base {
|
|
31
|
+
export default class DocumentSelection extends /* #__PURE__ */ DocumentSelection_base {
|
|
32
32
|
/**
|
|
33
33
|
* Selection is used internally (`DocumentSelection` is a proxy to that selection).
|
|
34
34
|
*/
|
|
@@ -548,6 +548,15 @@ export default class DomConverter {
|
|
|
548
548
|
* @returns `true` if given `node` ends with space, `false` otherwise.
|
|
549
549
|
*/
|
|
550
550
|
private _nodeEndsWithSpace;
|
|
551
|
+
/**
|
|
552
|
+
* Checks whether given text contains preformatted white space. This is the case if
|
|
553
|
+
* * any of node ancestors has a name which is in `preElements` array, or
|
|
554
|
+
* * the closest ancestor that has the `white-space` CSS property sets it to a value that preserves spaces
|
|
555
|
+
*
|
|
556
|
+
* @param node Node to check
|
|
557
|
+
* @returns `true` if given node contains preformatted white space, `false` otherwise.
|
|
558
|
+
*/
|
|
559
|
+
private _isPreFormatted;
|
|
551
560
|
/**
|
|
552
561
|
* Helper function. For given {@link module:engine/view/text~Text view text node}, it finds previous or next sibling
|
|
553
562
|
* that is contained in the same container element. If there is no such sibling, `null` is returned.
|
|
@@ -23,7 +23,7 @@ declare const EditableElement_base: import("@ckeditor/ckeditor5-utils").Mixed<ty
|
|
|
23
23
|
* The constructor of this class shouldn't be used directly. To create new `EditableElement` use the
|
|
24
24
|
* {@link module:engine/view/downcastwriter~DowncastWriter#createEditableElement `downcastWriter#createEditableElement()`} method.
|
|
25
25
|
*/
|
|
26
|
-
export default class EditableElement extends EditableElement_base {
|
|
26
|
+
export default class EditableElement extends /* #__PURE__ */ EditableElement_base {
|
|
27
27
|
/**
|
|
28
28
|
* Whether the editable is in read-write or read-only mode.
|
|
29
29
|
*
|
|
@@ -21,7 +21,7 @@ declare const Node_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof TypeCh
|
|
|
21
21
|
* Use the {@link module:engine/view/downcastwriter~DowncastWriter} or {@link module:engine/view/upcastwriter~UpcastWriter}
|
|
22
22
|
* to create new instances of view nodes.
|
|
23
23
|
*/
|
|
24
|
-
export default abstract class Node extends Node_base {
|
|
24
|
+
export default abstract class Node extends /* #__PURE__ */ Node_base {
|
|
25
25
|
/**
|
|
26
26
|
* The document instance to which this node belongs.
|
|
27
27
|
*/
|
|
@@ -18,7 +18,7 @@ declare const Observer_base: {
|
|
|
18
18
|
* Observers can also add features to the view, for instance by updating its status or marking elements
|
|
19
19
|
* which need a refresh on DOM events.
|
|
20
20
|
*/
|
|
21
|
-
export default abstract class Observer extends Observer_base {
|
|
21
|
+
export default abstract class Observer extends /* #__PURE__ */ Observer_base {
|
|
22
22
|
/**
|
|
23
23
|
* An instance of the view controller.
|
|
24
24
|
*/
|
|
@@ -30,7 +30,7 @@ declare const Renderer_base: {
|
|
|
30
30
|
* Renderer uses {@link module:engine/view/domconverter~DomConverter} to transform view nodes and positions
|
|
31
31
|
* to and from the DOM.
|
|
32
32
|
*/
|
|
33
|
-
export default class Renderer extends Renderer_base {
|
|
33
|
+
export default class Renderer extends /* #__PURE__ */ Renderer_base {
|
|
34
34
|
/**
|
|
35
35
|
* Set of DOM Documents instances.
|
|
36
36
|
*/
|
|
@@ -30,7 +30,7 @@ declare const Selection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof T
|
|
|
30
30
|
* A selection can consist of {@link module:engine/view/range~Range ranges} that can be set by using
|
|
31
31
|
* the {@link module:engine/view/selection~Selection#setTo `Selection#setTo()`} method.
|
|
32
32
|
*/
|
|
33
|
-
export default class Selection extends Selection_base {
|
|
33
|
+
export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
34
34
|
/**
|
|
35
35
|
* Stores all ranges that are selected.
|
|
36
36
|
*/
|
|
@@ -68,7 +68,7 @@ declare const View_base: {
|
|
|
68
68
|
* If you do not need full a DOM - view management, and only want to transform a tree of view elements to a tree of DOM
|
|
69
69
|
* elements you do not need this controller. You can use the {@link module:engine/view/domconverter~DomConverter DomConverter} instead.
|
|
70
70
|
*/
|
|
71
|
-
export default class View extends View_base {
|
|
71
|
+
export default class View extends /* #__PURE__ */ View_base {
|
|
72
72
|
/**
|
|
73
73
|
* Instance of the {@link module:engine/view/document~Document} associated with this view controller.
|
|
74
74
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-engine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "42.0.0-alpha.0",
|
|
4
4
|
"description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wysiwyg",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"type": "module",
|
|
25
25
|
"main": "src/index.js",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ckeditor/ckeditor5-utils": "
|
|
27
|
+
"@ckeditor/ckeditor5-utils": "42.0.0-alpha.0",
|
|
28
28
|
"lodash-es": "4.17.21"
|
|
29
29
|
},
|
|
30
30
|
"author": "CKSource (http://cksource.com/)",
|