@ckeditor/ckeditor5-engine 34.2.0 → 35.1.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/CHANGELOG.md +823 -0
- package/LICENSE.md +4 -0
- package/package.json +32 -25
- package/src/controller/datacontroller.js +467 -561
- package/src/controller/editingcontroller.js +168 -204
- package/src/conversion/conversion.js +541 -565
- package/src/conversion/conversionhelpers.js +24 -28
- package/src/conversion/downcastdispatcher.js +457 -686
- package/src/conversion/downcasthelpers.js +1583 -1965
- package/src/conversion/mapper.js +518 -707
- package/src/conversion/modelconsumable.js +240 -283
- package/src/conversion/upcastdispatcher.js +372 -718
- package/src/conversion/upcasthelpers.js +707 -818
- package/src/conversion/viewconsumable.js +524 -581
- package/src/dataprocessor/basichtmlwriter.js +12 -16
- package/src/dataprocessor/dataprocessor.js +5 -0
- package/src/dataprocessor/htmldataprocessor.js +101 -117
- package/src/dataprocessor/htmlwriter.js +1 -18
- package/src/dataprocessor/xmldataprocessor.js +117 -138
- package/src/dev-utils/model.js +260 -352
- package/src/dev-utils/operationreplayer.js +106 -126
- package/src/dev-utils/utils.js +34 -51
- package/src/dev-utils/view.js +632 -753
- package/src/index.js +0 -11
- package/src/model/batch.js +111 -127
- package/src/model/differ.js +988 -1233
- package/src/model/document.js +340 -449
- package/src/model/documentfragment.js +327 -364
- package/src/model/documentselection.js +996 -1189
- package/src/model/element.js +306 -410
- package/src/model/history.js +224 -262
- package/src/model/item.js +5 -0
- package/src/model/liveposition.js +84 -145
- package/src/model/liverange.js +108 -185
- package/src/model/markercollection.js +379 -480
- package/src/model/model.js +883 -1034
- package/src/model/node.js +419 -463
- package/src/model/nodelist.js +175 -201
- package/src/model/operation/attributeoperation.js +153 -182
- package/src/model/operation/detachoperation.js +64 -83
- package/src/model/operation/insertoperation.js +135 -166
- package/src/model/operation/markeroperation.js +114 -140
- package/src/model/operation/mergeoperation.js +163 -191
- package/src/model/operation/moveoperation.js +157 -187
- package/src/model/operation/nooperation.js +28 -38
- package/src/model/operation/operation.js +106 -125
- package/src/model/operation/operationfactory.js +30 -34
- package/src/model/operation/renameoperation.js +109 -135
- package/src/model/operation/rootattributeoperation.js +155 -188
- package/src/model/operation/splitoperation.js +196 -232
- package/src/model/operation/transform.js +1833 -2204
- package/src/model/operation/utils.js +140 -204
- package/src/model/position.js +899 -1053
- package/src/model/range.js +910 -1028
- package/src/model/rootelement.js +77 -97
- package/src/model/schema.js +1189 -1835
- package/src/model/selection.js +745 -862
- package/src/model/text.js +90 -114
- package/src/model/textproxy.js +204 -240
- package/src/model/treewalker.js +316 -397
- package/src/model/typecheckable.js +16 -0
- package/src/model/utils/autoparagraphing.js +32 -44
- package/src/model/utils/deletecontent.js +334 -418
- package/src/model/utils/findoptimalinsertionrange.js +25 -36
- package/src/model/utils/getselectedcontent.js +96 -118
- package/src/model/utils/insertcontent.js +654 -773
- package/src/model/utils/insertobject.js +96 -119
- package/src/model/utils/modifyselection.js +120 -158
- package/src/model/utils/selection-post-fixer.js +153 -201
- package/src/model/writer.js +1305 -1474
- package/src/view/attributeelement.js +189 -225
- package/src/view/containerelement.js +75 -85
- package/src/view/document.js +172 -215
- package/src/view/documentfragment.js +200 -249
- package/src/view/documentselection.js +338 -367
- package/src/view/domconverter.js +1371 -1613
- package/src/view/downcastwriter.js +1747 -2076
- package/src/view/editableelement.js +81 -97
- package/src/view/element.js +739 -890
- package/src/view/elementdefinition.js +5 -0
- package/src/view/emptyelement.js +82 -92
- package/src/view/filler.js +35 -50
- package/src/view/item.js +5 -0
- package/src/view/matcher.js +260 -559
- package/src/view/node.js +274 -360
- package/src/view/observer/arrowkeysobserver.js +19 -28
- package/src/view/observer/bubblingemittermixin.js +120 -263
- package/src/view/observer/bubblingeventinfo.js +47 -55
- package/src/view/observer/clickobserver.js +7 -13
- package/src/view/observer/compositionobserver.js +14 -24
- package/src/view/observer/domeventdata.js +57 -67
- package/src/view/observer/domeventobserver.js +40 -64
- package/src/view/observer/fakeselectionobserver.js +81 -96
- package/src/view/observer/focusobserver.js +45 -61
- package/src/view/observer/inputobserver.js +7 -13
- package/src/view/observer/keyobserver.js +17 -27
- package/src/view/observer/mouseobserver.js +7 -14
- package/src/view/observer/mutationobserver.js +220 -315
- package/src/view/observer/observer.js +81 -102
- package/src/view/observer/selectionobserver.js +191 -246
- package/src/view/observer/tabobserver.js +23 -36
- package/src/view/placeholder.js +128 -173
- package/src/view/position.js +350 -401
- package/src/view/range.js +453 -513
- package/src/view/rawelement.js +85 -112
- package/src/view/renderer.js +874 -1014
- package/src/view/rooteditableelement.js +80 -90
- package/src/view/selection.js +608 -689
- package/src/view/styles/background.js +43 -44
- package/src/view/styles/border.js +220 -276
- package/src/view/styles/margin.js +8 -17
- package/src/view/styles/padding.js +8 -16
- package/src/view/styles/utils.js +127 -160
- package/src/view/stylesmap.js +728 -905
- package/src/view/text.js +102 -126
- package/src/view/textproxy.js +144 -170
- package/src/view/treewalker.js +383 -479
- package/src/view/typecheckable.js +19 -0
- package/src/view/uielement.js +166 -187
- package/src/view/upcastwriter.js +395 -449
- package/src/view/view.js +569 -664
- package/src/dataprocessor/dataprocessor.jsdoc +0 -64
- package/src/model/item.jsdoc +0 -14
- package/src/view/elementdefinition.jsdoc +0 -59
- package/src/view/item.jsdoc +0 -14
package/src/view/emptyelement.js
CHANGED
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module engine/view/emptyelement
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import Element from './element';
|
|
11
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
12
9
|
import Node from './node';
|
|
13
|
-
|
|
10
|
+
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
14
11
|
/**
|
|
15
12
|
* Empty element class. It is used to represent elements that cannot contain any child nodes (for example `<img>` elements).
|
|
16
13
|
*
|
|
@@ -20,97 +17,90 @@ import Node from './node';
|
|
|
20
17
|
* @extends module:engine/view/element~Element
|
|
21
18
|
*/
|
|
22
19
|
export default class EmptyElement extends Element {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
* emptyElement.is( 'element', 'img' ); // -> true if this is a img element
|
|
66
|
-
* emptyElement.is( 'emptyElement', 'img' ); // -> same as above
|
|
67
|
-
* text.is( 'element', 'img' ); -> false
|
|
68
|
-
*
|
|
69
|
-
* {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.
|
|
70
|
-
*
|
|
71
|
-
* @param {String} type Type to check.
|
|
72
|
-
* @param {String} [name] Element name.
|
|
73
|
-
* @returns {Boolean}
|
|
74
|
-
*/
|
|
75
|
-
is( type, name = null ) {
|
|
76
|
-
if ( !name ) {
|
|
77
|
-
return type === 'emptyElement' || type === 'view:emptyElement' ||
|
|
78
|
-
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
|
|
79
|
-
type === 'element' || type === 'view:element' ||
|
|
80
|
-
type === 'node' || type === 'view:node';
|
|
81
|
-
} else {
|
|
82
|
-
return name === this.name && (
|
|
83
|
-
type === 'emptyElement' || type === 'view:emptyElement' ||
|
|
84
|
-
type === 'element' || type === 'view:element'
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Overrides {@link module:engine/view/element~Element#_insertChild} method.
|
|
91
|
-
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-emptyelement-cannot-add` to prevent
|
|
92
|
-
* adding any child nodes to EmptyElement.
|
|
93
|
-
*
|
|
94
|
-
* @protected
|
|
95
|
-
*/
|
|
96
|
-
_insertChild( index, nodes ) {
|
|
97
|
-
if ( nodes && ( nodes instanceof Node || Array.from( nodes ).length > 0 ) ) {
|
|
98
|
-
/**
|
|
99
|
-
* Cannot add children to {@link module:engine/view/emptyelement~EmptyElement}.
|
|
100
|
-
*
|
|
101
|
-
* @error view-emptyelement-cannot-add
|
|
102
|
-
*/
|
|
103
|
-
throw new CKEditorError(
|
|
104
|
-
'view-emptyelement-cannot-add',
|
|
105
|
-
[ this, nodes ]
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates new instance of EmptyElement.
|
|
22
|
+
*
|
|
23
|
+
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-emptyelement-cannot-add` when third parameter is passed,
|
|
24
|
+
* to inform that usage of EmptyElement is incorrect (adding child nodes to EmptyElement is forbidden).
|
|
25
|
+
*
|
|
26
|
+
* @see module:engine/view/downcastwriter~DowncastWriter#createEmptyElement
|
|
27
|
+
* @protected
|
|
28
|
+
* @param {module:engine/view/document~Document} document The document instance to which this element belongs.
|
|
29
|
+
* @param {String} name Node name.
|
|
30
|
+
* @param {Object|Iterable} [attrs] Collection of attributes.
|
|
31
|
+
* @param {module:engine/view/node~Node|Iterable.<module:engine/view/node~Node>} [children]
|
|
32
|
+
* A list of nodes to be inserted into created element.
|
|
33
|
+
*/
|
|
34
|
+
constructor(document, name, attributes, children) {
|
|
35
|
+
super(document, name, attributes, children);
|
|
36
|
+
/**
|
|
37
|
+
* Returns `null` because filler is not needed for EmptyElements.
|
|
38
|
+
*
|
|
39
|
+
* @method #getFillerOffset
|
|
40
|
+
* @returns {null} Always returns null.
|
|
41
|
+
*/
|
|
42
|
+
this.getFillerOffset = getFillerOffset;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Overrides {@link module:engine/view/element~Element#_insertChild} method.
|
|
46
|
+
* Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-emptyelement-cannot-add` to prevent
|
|
47
|
+
* adding any child nodes to EmptyElement.
|
|
48
|
+
*
|
|
49
|
+
* @protected
|
|
50
|
+
*/
|
|
51
|
+
_insertChild(index, items) {
|
|
52
|
+
if (items && (items instanceof Node || Array.from(items).length > 0)) {
|
|
53
|
+
/**
|
|
54
|
+
* Cannot add children to {@link module:engine/view/emptyelement~EmptyElement}.
|
|
55
|
+
*
|
|
56
|
+
* @error view-emptyelement-cannot-add
|
|
57
|
+
*/
|
|
58
|
+
throw new CKEditorError('view-emptyelement-cannot-add', [this, items]);
|
|
59
|
+
}
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
109
62
|
}
|
|
110
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Checks whether this object is of the given.
|
|
65
|
+
*
|
|
66
|
+
* emptyElement.is( 'emptyElement' ); // -> true
|
|
67
|
+
* emptyElement.is( 'element' ); // -> true
|
|
68
|
+
* emptyElement.is( 'node' ); // -> true
|
|
69
|
+
* emptyElement.is( 'view:emptyElement' ); // -> true
|
|
70
|
+
* emptyElement.is( 'view:element' ); // -> true
|
|
71
|
+
* emptyElement.is( 'view:node' ); // -> true
|
|
72
|
+
*
|
|
73
|
+
* emptyElement.is( 'model:element' ); // -> false
|
|
74
|
+
* emptyElement.is( 'documentFragment' ); // -> false
|
|
75
|
+
*
|
|
76
|
+
* Assuming that the object being checked is an empty element, you can also check its
|
|
77
|
+
* {@link module:engine/view/emptyelement~EmptyElement#name name}:
|
|
78
|
+
*
|
|
79
|
+
* emptyElement.is( 'element', 'img' ); // -> true if this is a img element
|
|
80
|
+
* emptyElement.is( 'emptyElement', 'img' ); // -> same as above
|
|
81
|
+
* text.is( 'element', 'img' ); -> false
|
|
82
|
+
*
|
|
83
|
+
* {@link module:engine/view/node~Node#is Check the entire list of view objects} which implement the `is()` method.
|
|
84
|
+
*
|
|
85
|
+
* @param {String} type Type to check.
|
|
86
|
+
* @param {String} [name] Element name.
|
|
87
|
+
* @returns {Boolean}
|
|
88
|
+
*/
|
|
89
|
+
EmptyElement.prototype.is = function (type, name) {
|
|
90
|
+
if (!name) {
|
|
91
|
+
return type === 'emptyElement' || type === 'view:emptyElement' ||
|
|
92
|
+
// From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
|
|
93
|
+
type === 'element' || type === 'view:element' ||
|
|
94
|
+
type === 'node' || type === 'view:node';
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return name === this.name && (type === 'emptyElement' || type === 'view:emptyElement' ||
|
|
98
|
+
type === 'element' || type === 'view:element');
|
|
99
|
+
}
|
|
100
|
+
};
|
|
111
101
|
// Returns `null` because block filler is not needed for EmptyElements.
|
|
112
102
|
//
|
|
113
103
|
// @returns {null}
|
|
114
104
|
function getFillerOffset() {
|
|
115
|
-
|
|
105
|
+
return null;
|
|
116
106
|
}
|
package/src/view/filler.js
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
|
|
7
6
|
import isText from '@ckeditor/ckeditor5-utils/src/dom/istext';
|
|
8
|
-
|
|
9
7
|
/**
|
|
10
8
|
* Set of utilities related to handling block and inline fillers.
|
|
11
9
|
*
|
|
@@ -34,7 +32,6 @@ import isText from '@ckeditor/ckeditor5-utils/src/dom/istext';
|
|
|
34
32
|
*
|
|
35
33
|
* @module engine/view/filler
|
|
36
34
|
*/
|
|
37
|
-
|
|
38
35
|
/**
|
|
39
36
|
* Non-breaking space filler creator. This function creates the ` ` text node.
|
|
40
37
|
* It defines how the filler is created.
|
|
@@ -43,8 +40,7 @@ import isText from '@ckeditor/ckeditor5-utils/src/dom/istext';
|
|
|
43
40
|
* @see module:engine/view/filler~BR_FILLER
|
|
44
41
|
* @function
|
|
45
42
|
*/
|
|
46
|
-
export const NBSP_FILLER = domDocument => domDocument.createTextNode(
|
|
47
|
-
|
|
43
|
+
export const NBSP_FILLER = (domDocument) => domDocument.createTextNode('\u00A0');
|
|
48
44
|
/**
|
|
49
45
|
* Marked non-breaking space filler creator. This function creates the `<span data-cke-filler="true"> </span>` element.
|
|
50
46
|
* It defines how the filler is created.
|
|
@@ -53,14 +49,12 @@ export const NBSP_FILLER = domDocument => domDocument.createTextNode( '\u00A0' )
|
|
|
53
49
|
* @see module:engine/view/filler~BR_FILLER
|
|
54
50
|
* @function
|
|
55
51
|
*/
|
|
56
|
-
export const MARKED_NBSP_FILLER = domDocument => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return span;
|
|
52
|
+
export const MARKED_NBSP_FILLER = (domDocument) => {
|
|
53
|
+
const span = domDocument.createElement('span');
|
|
54
|
+
span.dataset.ckeFiller = 'true';
|
|
55
|
+
span.innerText = '\u00A0';
|
|
56
|
+
return span;
|
|
62
57
|
};
|
|
63
|
-
|
|
64
58
|
/**
|
|
65
59
|
* `<br>` filler creator. This function creates the `<br data-cke-filler="true">` element.
|
|
66
60
|
* It defines how the filler is created.
|
|
@@ -69,25 +63,21 @@ export const MARKED_NBSP_FILLER = domDocument => {
|
|
|
69
63
|
* @see module:engine/view/filler~MARKED_NBSP_FILLER
|
|
70
64
|
* @function
|
|
71
65
|
*/
|
|
72
|
-
export const BR_FILLER = domDocument => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return fillerBr;
|
|
66
|
+
export const BR_FILLER = (domDocument) => {
|
|
67
|
+
const fillerBr = domDocument.createElement('br');
|
|
68
|
+
fillerBr.dataset.ckeFiller = 'true';
|
|
69
|
+
return fillerBr;
|
|
77
70
|
};
|
|
78
|
-
|
|
79
71
|
/**
|
|
80
72
|
* Length of the {@link module:engine/view/filler~INLINE_FILLER INLINE_FILLER}.
|
|
81
73
|
*/
|
|
82
74
|
export const INLINE_FILLER_LENGTH = 7;
|
|
83
|
-
|
|
84
75
|
/**
|
|
85
76
|
* Inline filler which is a sequence of the word joiners.
|
|
86
77
|
*
|
|
87
78
|
* @type {String}
|
|
88
79
|
*/
|
|
89
|
-
export const INLINE_FILLER = '\u2060'.repeat(
|
|
90
|
-
|
|
80
|
+
export const INLINE_FILLER = '\u2060'.repeat(INLINE_FILLER_LENGTH);
|
|
91
81
|
/**
|
|
92
82
|
* Checks if the node is a text node which starts with the {@link module:engine/view/filler~INLINE_FILLER inline filler}.
|
|
93
83
|
*
|
|
@@ -99,10 +89,9 @@ export const INLINE_FILLER = '\u2060'.repeat( INLINE_FILLER_LENGTH );
|
|
|
99
89
|
* @param {Node} domNode DOM node.
|
|
100
90
|
* @returns {Boolean} True if the text node starts with the {@link module:engine/view/filler~INLINE_FILLER inline filler}.
|
|
101
91
|
*/
|
|
102
|
-
export function startsWithFiller(
|
|
103
|
-
|
|
92
|
+
export function startsWithFiller(domNode) {
|
|
93
|
+
return isText(domNode) && (domNode.data.substr(0, INLINE_FILLER_LENGTH) === INLINE_FILLER);
|
|
104
94
|
}
|
|
105
|
-
|
|
106
95
|
/**
|
|
107
96
|
* Checks if the text node contains only the {@link module:engine/view/filler~INLINE_FILLER inline filler}.
|
|
108
97
|
*
|
|
@@ -112,10 +101,9 @@ export function startsWithFiller( domNode ) {
|
|
|
112
101
|
* @param {Text} domText DOM text node.
|
|
113
102
|
* @returns {Boolean} True if the text node contains only the {@link module:engine/view/filler~INLINE_FILLER inline filler}.
|
|
114
103
|
*/
|
|
115
|
-
export function isInlineFiller(
|
|
116
|
-
|
|
104
|
+
export function isInlineFiller(domText) {
|
|
105
|
+
return domText.data.length == INLINE_FILLER_LENGTH && startsWithFiller(domText);
|
|
117
106
|
}
|
|
118
|
-
|
|
119
107
|
/**
|
|
120
108
|
* Get string data from the text node, removing an {@link module:engine/view/filler~INLINE_FILLER inline filler} from it,
|
|
121
109
|
* if text node contains it.
|
|
@@ -126,36 +114,33 @@ export function isInlineFiller( domText ) {
|
|
|
126
114
|
* @param {Text} domText DOM text node, possible with inline filler.
|
|
127
115
|
* @returns {String} Data without filler.
|
|
128
116
|
*/
|
|
129
|
-
export function getDataWithoutFiller(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
117
|
+
export function getDataWithoutFiller(domText) {
|
|
118
|
+
if (startsWithFiller(domText)) {
|
|
119
|
+
return domText.data.slice(INLINE_FILLER_LENGTH);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
return domText.data;
|
|
123
|
+
}
|
|
135
124
|
}
|
|
136
|
-
|
|
137
125
|
/**
|
|
138
126
|
* Assign key observer which move cursor from the end of the inline filler to the beginning of it when
|
|
139
127
|
* the left arrow is pressed, so the filler does not break navigation.
|
|
140
128
|
*
|
|
141
129
|
* @param {module:engine/view/view~View} view View controller instance we should inject quirks handling on.
|
|
142
130
|
*/
|
|
143
|
-
export function injectQuirksHandling(
|
|
144
|
-
|
|
131
|
+
export function injectQuirksHandling(view) {
|
|
132
|
+
view.document.on('arrowKey', jumpOverInlineFiller, { priority: 'low' });
|
|
145
133
|
}
|
|
146
|
-
|
|
147
134
|
// Move cursor from the end of the inline filler to the beginning of it when, so the filler does not break navigation.
|
|
148
|
-
function jumpOverInlineFiller(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
}
|
|
135
|
+
function jumpOverInlineFiller(evt, data) {
|
|
136
|
+
if (data.keyCode == keyCodes.arrowleft) {
|
|
137
|
+
const domSelection = data.domTarget.ownerDocument.defaultView.getSelection();
|
|
138
|
+
if (domSelection.rangeCount == 1 && domSelection.getRangeAt(0).collapsed) {
|
|
139
|
+
const domParent = domSelection.getRangeAt(0).startContainer;
|
|
140
|
+
const domOffset = domSelection.getRangeAt(0).startOffset;
|
|
141
|
+
if (startsWithFiller(domParent) && domOffset <= INLINE_FILLER_LENGTH) {
|
|
142
|
+
domSelection.collapse(domParent, 0);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
161
146
|
}
|