@ckeditor/ckeditor5-engine 41.4.2 → 42.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.
- 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
|
@@ -544,6 +544,15 @@ export default class DomConverter {
|
|
|
544
544
|
* @returns `true` if given `node` ends with space, `false` otherwise.
|
|
545
545
|
*/
|
|
546
546
|
private _nodeEndsWithSpace;
|
|
547
|
+
/**
|
|
548
|
+
* Checks whether given text contains preformatted white space. This is the case if
|
|
549
|
+
* * any of node ancestors has a name which is in `preElements` array, or
|
|
550
|
+
* * the closest ancestor that has the `white-space` CSS property sets it to a value that preserves spaces
|
|
551
|
+
*
|
|
552
|
+
* @param node Node to check
|
|
553
|
+
* @returns `true` if given node contains preformatted white space, `false` otherwise.
|
|
554
|
+
*/
|
|
555
|
+
private _isPreFormatted;
|
|
547
556
|
/**
|
|
548
557
|
* Helper function. For given {@link module:engine/view/text~Text view text node}, it finds previous or next sibling
|
|
549
558
|
* that is contained in the same container element. If there is no such sibling, `null` is returned.
|
package/src/view/domconverter.js
CHANGED
|
@@ -1123,7 +1123,7 @@ export default class DomConverter {
|
|
|
1123
1123
|
}
|
|
1124
1124
|
let data;
|
|
1125
1125
|
let nodeEndsWithSpace = false;
|
|
1126
|
-
if (
|
|
1126
|
+
if (this._isPreFormatted(node)) {
|
|
1127
1127
|
data = getDataWithoutFiller(node.data);
|
|
1128
1128
|
}
|
|
1129
1129
|
else {
|
|
@@ -1207,9 +1207,8 @@ export default class DomConverter {
|
|
|
1207
1207
|
*/
|
|
1208
1208
|
_processDataFromViewText(node) {
|
|
1209
1209
|
let data = node.data;
|
|
1210
|
-
// If
|
|
1211
|
-
|
|
1212
|
-
if (node.getAncestors().some(parent => this.preElements.includes(parent.name))) {
|
|
1210
|
+
// If the currently processed view text node is preformatted, we should not change whitespaces.
|
|
1211
|
+
if (this._isPreFormatted(node)) {
|
|
1213
1212
|
return data;
|
|
1214
1213
|
}
|
|
1215
1214
|
// 1. Replace the first space with a nbsp if the previous node ends with a space or there is no previous node
|
|
@@ -1247,12 +1246,35 @@ export default class DomConverter {
|
|
|
1247
1246
|
* @returns `true` if given `node` ends with space, `false` otherwise.
|
|
1248
1247
|
*/
|
|
1249
1248
|
_nodeEndsWithSpace(node) {
|
|
1250
|
-
if (
|
|
1249
|
+
if (this._isPreFormatted(node)) {
|
|
1251
1250
|
return false;
|
|
1252
1251
|
}
|
|
1253
1252
|
const data = this._processDataFromViewText(node);
|
|
1254
1253
|
return data.charAt(data.length - 1) == ' ';
|
|
1255
1254
|
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Checks whether given text contains preformatted white space. This is the case if
|
|
1257
|
+
* * any of node ancestors has a name which is in `preElements` array, or
|
|
1258
|
+
* * the closest ancestor that has the `white-space` CSS property sets it to a value that preserves spaces
|
|
1259
|
+
*
|
|
1260
|
+
* @param node Node to check
|
|
1261
|
+
* @returns `true` if given node contains preformatted white space, `false` otherwise.
|
|
1262
|
+
*/
|
|
1263
|
+
_isPreFormatted(node) {
|
|
1264
|
+
if (_hasViewParentOfType(node, this.preElements)) {
|
|
1265
|
+
return true;
|
|
1266
|
+
}
|
|
1267
|
+
for (const ancestor of node.getAncestors({ parentFirst: true })) {
|
|
1268
|
+
if (!ancestor.is('element') || !ancestor.hasStyle('white-space') || ancestor.getStyle('white-space') === 'inherit') {
|
|
1269
|
+
continue;
|
|
1270
|
+
}
|
|
1271
|
+
// If the node contains the `white-space` property with a value that does not preserve spaces, it will take
|
|
1272
|
+
// precedence over any white-space settings its ancestors contain, so no further parent checking needs to
|
|
1273
|
+
// be done.
|
|
1274
|
+
return ['pre', 'pre-wrap', 'break-spaces'].includes(ancestor.getStyle('white-space'));
|
|
1275
|
+
}
|
|
1276
|
+
return false;
|
|
1277
|
+
}
|
|
1256
1278
|
/**
|
|
1257
1279
|
* Helper function. For given {@link module:engine/view/text~Text view text node}, it finds previous or next sibling
|
|
1258
1280
|
* that is contained in the same container element. If there is no such sibling, `null` is returned.
|
|
@@ -19,7 +19,7 @@ declare const EditableElement_base: import("@ckeditor/ckeditor5-utils").Mixed<ty
|
|
|
19
19
|
* The constructor of this class shouldn't be used directly. To create new `EditableElement` use the
|
|
20
20
|
* {@link module:engine/view/downcastwriter~DowncastWriter#createEditableElement `downcastWriter#createEditableElement()`} method.
|
|
21
21
|
*/
|
|
22
|
-
export default class EditableElement extends EditableElement_base {
|
|
22
|
+
export default class EditableElement extends /* #__PURE__ */ EditableElement_base {
|
|
23
23
|
/**
|
|
24
24
|
* Whether the editable is in read-write or read-only mode.
|
|
25
25
|
*
|
|
@@ -16,7 +16,7 @@ import { ObservableMixin } from '@ckeditor/ckeditor5-utils';
|
|
|
16
16
|
* The constructor of this class shouldn't be used directly. To create new `EditableElement` use the
|
|
17
17
|
* {@link module:engine/view/downcastwriter~DowncastWriter#createEditableElement `downcastWriter#createEditableElement()`} method.
|
|
18
18
|
*/
|
|
19
|
-
export default class EditableElement extends ObservableMixin(ContainerElement) {
|
|
19
|
+
export default class EditableElement extends /* #__PURE__ */ ObservableMixin(ContainerElement) {
|
|
20
20
|
/**
|
|
21
21
|
* Creates an editable element.
|
|
22
22
|
*
|
package/src/view/node.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare const Node_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof TypeCh
|
|
|
17
17
|
* Use the {@link module:engine/view/downcastwriter~DowncastWriter} or {@link module:engine/view/upcastwriter~UpcastWriter}
|
|
18
18
|
* to create new instances of view nodes.
|
|
19
19
|
*/
|
|
20
|
-
export default abstract class Node extends Node_base {
|
|
20
|
+
export default abstract class Node extends /* #__PURE__ */ Node_base {
|
|
21
21
|
/**
|
|
22
22
|
* The document instance to which this node belongs.
|
|
23
23
|
*/
|
package/src/view/node.js
CHANGED
|
@@ -15,7 +15,7 @@ import { clone } from 'lodash-es';
|
|
|
15
15
|
* Use the {@link module:engine/view/downcastwriter~DowncastWriter} or {@link module:engine/view/upcastwriter~UpcastWriter}
|
|
16
16
|
* to create new instances of view nodes.
|
|
17
17
|
*/
|
|
18
|
-
export default class Node extends EmitterMixin(TypeCheckable) {
|
|
18
|
+
export default class Node extends /* #__PURE__ */ EmitterMixin(TypeCheckable) {
|
|
19
19
|
/**
|
|
20
20
|
* Creates a tree view node.
|
|
21
21
|
*
|
|
@@ -14,7 +14,7 @@ declare const Observer_base: {
|
|
|
14
14
|
* Observers can also add features to the view, for instance by updating its status or marking elements
|
|
15
15
|
* which need a refresh on DOM events.
|
|
16
16
|
*/
|
|
17
|
-
export default abstract class Observer extends Observer_base {
|
|
17
|
+
export default abstract class Observer extends /* #__PURE__ */ Observer_base {
|
|
18
18
|
/**
|
|
19
19
|
* An instance of the view controller.
|
|
20
20
|
*/
|
|
@@ -12,7 +12,7 @@ import { DomEmitterMixin } from '@ckeditor/ckeditor5-utils';
|
|
|
12
12
|
* Observers can also add features to the view, for instance by updating its status or marking elements
|
|
13
13
|
* which need a refresh on DOM events.
|
|
14
14
|
*/
|
|
15
|
-
export default class Observer extends DomEmitterMixin() {
|
|
15
|
+
export default class Observer extends /* #__PURE__ */ DomEmitterMixin() {
|
|
16
16
|
/**
|
|
17
17
|
* Creates an instance of the observer.
|
|
18
18
|
*/
|
package/src/view/renderer.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ declare const Renderer_base: {
|
|
|
26
26
|
* Renderer uses {@link module:engine/view/domconverter~DomConverter} to transform view nodes and positions
|
|
27
27
|
* to and from the DOM.
|
|
28
28
|
*/
|
|
29
|
-
export default class Renderer extends Renderer_base {
|
|
29
|
+
export default class Renderer extends /* #__PURE__ */ Renderer_base {
|
|
30
30
|
/**
|
|
31
31
|
* Set of DOM Documents instances.
|
|
32
32
|
*/
|
package/src/view/renderer.js
CHANGED
|
@@ -23,7 +23,7 @@ import '../../theme/renderer.css';
|
|
|
23
23
|
* Renderer uses {@link module:engine/view/domconverter~DomConverter} to transform view nodes and positions
|
|
24
24
|
* to and from the DOM.
|
|
25
25
|
*/
|
|
26
|
-
export default class Renderer extends ObservableMixin() {
|
|
26
|
+
export default class Renderer extends /* #__PURE__ */ ObservableMixin() {
|
|
27
27
|
/**
|
|
28
28
|
* Creates a renderer instance.
|
|
29
29
|
*
|
package/src/view/selection.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ declare const Selection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof T
|
|
|
26
26
|
* A selection can consist of {@link module:engine/view/range~Range ranges} that can be set by using
|
|
27
27
|
* the {@link module:engine/view/selection~Selection#setTo `Selection#setTo()`} method.
|
|
28
28
|
*/
|
|
29
|
-
export default class Selection extends Selection_base {
|
|
29
|
+
export default class Selection extends /* #__PURE__ */ Selection_base {
|
|
30
30
|
/**
|
|
31
31
|
* Stores all ranges that are selected.
|
|
32
32
|
*/
|
package/src/view/selection.js
CHANGED
|
@@ -23,7 +23,7 @@ import { CKEditorError, EmitterMixin, count, isIterable } from '@ckeditor/ckedit
|
|
|
23
23
|
* A selection can consist of {@link module:engine/view/range~Range ranges} that can be set by using
|
|
24
24
|
* the {@link module:engine/view/selection~Selection#setTo `Selection#setTo()`} method.
|
|
25
25
|
*/
|
|
26
|
-
export default class Selection extends EmitterMixin(TypeCheckable) {
|
|
26
|
+
export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckable) {
|
|
27
27
|
/**
|
|
28
28
|
* Creates new selection instance.
|
|
29
29
|
*
|
package/src/view/view.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ declare const View_base: {
|
|
|
64
64
|
* 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
|
|
65
65
|
* elements you do not need this controller. You can use the {@link module:engine/view/domconverter~DomConverter DomConverter} instead.
|
|
66
66
|
*/
|
|
67
|
-
export default class View extends View_base {
|
|
67
|
+
export default class View extends /* #__PURE__ */ View_base {
|
|
68
68
|
/**
|
|
69
69
|
* Instance of the {@link module:engine/view/document~Document} associated with this view controller.
|
|
70
70
|
*/
|
package/src/view/view.js
CHANGED
|
@@ -57,7 +57,7 @@ import { cloneDeep } from 'lodash-es';
|
|
|
57
57
|
* 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
|
|
58
58
|
* elements you do not need this controller. You can use the {@link module:engine/view/domconverter~DomConverter DomConverter} instead.
|
|
59
59
|
*/
|
|
60
|
-
export default class View extends ObservableMixin() {
|
|
60
|
+
export default class View extends /* #__PURE__ */ ObservableMixin() {
|
|
61
61
|
/**
|
|
62
62
|
* @param stylesProcessor The styles processor instance.
|
|
63
63
|
*/
|