@ckeditor/ckeditor5-engine 35.3.2 → 35.4.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/package.json +22 -22
- package/src/controller/datacontroller.js +5 -7
- package/src/controller/editingcontroller.js +2 -3
- package/src/conversion/conversion.js +1 -2
- package/src/conversion/downcastdispatcher.js +2 -2
- package/src/conversion/downcasthelpers.js +1 -2
- package/src/conversion/mapper.js +2 -3
- package/src/conversion/modelconsumable.js +1 -1
- package/src/conversion/upcastdispatcher.js +2 -3
- package/src/conversion/upcasthelpers.js +2 -2
- package/src/conversion/viewconsumable.js +1 -1
- package/src/dataprocessor/htmldataprocessor.js +2 -1
- package/src/dataprocessor/xmldataprocessor.js +5 -1
- package/src/dev-utils/model.js +2 -2
- package/src/index.js +11 -2
- package/src/model/batch.js +1 -1
- package/src/model/document.js +2 -5
- package/src/model/documentfragment.js +1 -1
- package/src/model/documentselection.js +1 -6
- package/src/model/element.js +1 -1
- package/src/model/liveposition.js +1 -3
- package/src/model/liverange.js +1 -2
- package/src/model/markercollection.js +2 -4
- package/src/model/model.js +2 -3
- package/src/model/node.js +1 -3
- package/src/model/nodelist.js +1 -2
- package/src/model/operation/attributeoperation.js +1 -1
- package/src/model/operation/detachoperation.js +1 -1
- package/src/model/operation/insertoperation.js +1 -1
- package/src/model/operation/mergeoperation.js +1 -1
- package/src/model/operation/moveoperation.js +1 -2
- package/src/model/operation/renameoperation.js +1 -1
- package/src/model/operation/rootattributeoperation.js +1 -1
- package/src/model/operation/splitoperation.js +1 -1
- package/src/model/operation/transform.js +1 -1
- package/src/model/operation/utils.js +1 -2
- package/src/model/position.js +1 -2
- package/src/model/range.js +1 -2
- package/src/model/schema.js +9 -10
- package/src/model/selection.js +1 -4
- package/src/model/textproxy.js +1 -1
- package/src/model/treewalker.js +1 -1
- package/src/model/utils/findoptimalinsertionrange.js +1 -1
- package/src/model/utils/insertcontent.js +1 -1
- package/src/model/utils/insertobject.js +21 -19
- package/src/model/utils/modifyselection.js +1 -1
- package/src/model/writer.js +1 -2
- package/src/view/attributeelement.js +1 -1
- package/src/view/document.js +18 -4
- package/src/view/documentfragment.js +1 -3
- package/src/view/documentselection.js +1 -2
- package/src/view/domconverter.js +1 -6
- package/src/view/downcastwriter.js +1 -2
- package/src/view/editableelement.js +1 -2
- package/src/view/element.js +1 -3
- package/src/view/emptyelement.js +1 -1
- package/src/view/filler.js +1 -2
- package/src/view/matcher.js +1 -1
- package/src/view/node.js +1 -4
- package/src/view/observer/bubblingemittermixin.js +2 -5
- package/src/view/observer/bubblingeventinfo.js +1 -1
- package/src/view/observer/fakeselectionobserver.js +1 -1
- package/src/view/observer/focusobserver.js +5 -1
- package/src/view/observer/inputobserver.js +1 -1
- package/src/view/observer/keyobserver.js +1 -1
- package/src/view/observer/observer.js +2 -2
- package/src/view/observer/selectionobserver.js +9 -2
- package/src/view/observer/tabobserver.js +1 -1
- package/src/view/position.js +1 -2
- package/src/view/rawelement.js +1 -1
- package/src/view/renderer.js +15 -11
- package/src/view/selection.js +1 -5
- package/src/view/textproxy.js +1 -1
- package/src/view/treewalker.js +1 -1
- package/src/view/uielement.js +1 -2
- package/src/view/view.js +5 -5
package/src/view/renderer.js
CHANGED
|
@@ -8,16 +8,7 @@
|
|
|
8
8
|
import ViewText from './text';
|
|
9
9
|
import ViewPosition from './position';
|
|
10
10
|
import { INLINE_FILLER, INLINE_FILLER_LENGTH, startsWithFiller, isInlineFiller } from './filler';
|
|
11
|
-
import {
|
|
12
|
-
import insertAt from '@ckeditor/ckeditor5-utils/src/dom/insertat';
|
|
13
|
-
import remove from '@ckeditor/ckeditor5-utils/src/dom/remove';
|
|
14
|
-
import { Observable } from '@ckeditor/ckeditor5-utils/src/observablemixin';
|
|
15
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
16
|
-
import isText from '@ckeditor/ckeditor5-utils/src/dom/istext';
|
|
17
|
-
import isComment from '@ckeditor/ckeditor5-utils/src/dom/iscomment';
|
|
18
|
-
import isNode from '@ckeditor/ckeditor5-utils/src/dom/isnode';
|
|
19
|
-
import fastDiff from '@ckeditor/ckeditor5-utils/src/fastdiff';
|
|
20
|
-
import env from '@ckeditor/ckeditor5-utils/src/env';
|
|
11
|
+
import { CKEditorError, ObservableMixin, diff, env, fastDiff, insertAt, isComment, isNode, isText, remove } from '@ckeditor/ckeditor5-utils';
|
|
21
12
|
import '../../theme/renderer.css';
|
|
22
13
|
/**
|
|
23
14
|
* Renderer is responsible for updating the DOM structure and the DOM selection based on
|
|
@@ -32,7 +23,7 @@ import '../../theme/renderer.css';
|
|
|
32
23
|
* Renderer uses {@link module:engine/view/domconverter~DomConverter} to transform view nodes and positions
|
|
33
24
|
* to and from the DOM.
|
|
34
25
|
*/
|
|
35
|
-
export default class Renderer extends
|
|
26
|
+
export default class Renderer extends ObservableMixin() {
|
|
36
27
|
/**
|
|
37
28
|
* Creates a renderer instance.
|
|
38
29
|
*
|
|
@@ -91,6 +82,14 @@ export default class Renderer extends Observable {
|
|
|
91
82
|
* @observable
|
|
92
83
|
*/
|
|
93
84
|
this.set('isFocused', false);
|
|
85
|
+
/**
|
|
86
|
+
* Indicates if the view document is changing the focus (`true`) and selection rendering should be prevented.
|
|
87
|
+
*
|
|
88
|
+
* @internal
|
|
89
|
+
* @observable
|
|
90
|
+
* @member {Boolean}
|
|
91
|
+
*/
|
|
92
|
+
this.set('_isFocusChanging', false);
|
|
94
93
|
/**
|
|
95
94
|
* Indicates whether the user is making a selection in the document (e.g. holding the mouse button and moving the cursor).
|
|
96
95
|
* When they stop selecting, the property goes back to `false`.
|
|
@@ -759,6 +758,11 @@ export default class Renderer extends Observable {
|
|
|
759
758
|
if (env.isBlink && !env.isAndroid && this.isSelecting && !this.markedChildren.size) {
|
|
760
759
|
return;
|
|
761
760
|
}
|
|
761
|
+
// The focus is still in progress and we are waiting for new values from `selectionchange` event.
|
|
762
|
+
// In that case, we need to prevent update selection since it would be updated using old values.
|
|
763
|
+
if (this._isFocusChanging) {
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
762
766
|
// If there is no selection - remove DOM and fake selections.
|
|
763
767
|
if (this.selection.rangeCount === 0) {
|
|
764
768
|
this._removeDomSelection();
|
package/src/view/selection.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
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
|
-
/* eslint-disable new-cap */
|
|
6
5
|
/**
|
|
7
6
|
* @module engine/view/selection
|
|
8
7
|
*/
|
|
@@ -11,10 +10,7 @@ import Range from './range';
|
|
|
11
10
|
import Position from './position';
|
|
12
11
|
import Node from './node';
|
|
13
12
|
import DocumentSelection from './documentselection';
|
|
14
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils
|
|
15
|
-
import count from '@ckeditor/ckeditor5-utils/src/count';
|
|
16
|
-
import isIterable from '@ckeditor/ckeditor5-utils/src/isiterable';
|
|
17
|
-
import EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin';
|
|
13
|
+
import { CKEditorError, EmitterMixin, count, isIterable } from '@ckeditor/ckeditor5-utils';
|
|
18
14
|
/**
|
|
19
15
|
* Class representing an arbirtary selection in the view.
|
|
20
16
|
* See also {@link module:engine/view/documentselection~DocumentSelection}.
|
package/src/view/textproxy.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module engine/view/textproxy
|
|
7
7
|
*/
|
|
8
8
|
import TypeCheckable from './typecheckable';
|
|
9
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils
|
|
9
|
+
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
/**
|
|
11
11
|
* TextProxy is a wrapper for substring of {@link module:engine/view/text~Text}. Instance of this class is created by
|
|
12
12
|
* {@link module:engine/view/treewalker~TreeWalker} when only a part of {@link module:engine/view/text~Text} needs to be returned.
|
package/src/view/treewalker.js
CHANGED
|
@@ -9,7 +9,7 @@ import Element from './element';
|
|
|
9
9
|
import Text from './text';
|
|
10
10
|
import TextProxy from './textproxy';
|
|
11
11
|
import Position from './position';
|
|
12
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils
|
|
12
|
+
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
13
13
|
/**
|
|
14
14
|
* Position iterator class. It allows to iterate forward and backward over the document.
|
|
15
15
|
*/
|
package/src/view/uielement.js
CHANGED
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import Element from './element';
|
|
9
9
|
import Node from './node';
|
|
10
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils
|
|
11
|
-
import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
|
|
10
|
+
import { CKEditorError, keyCodes } from '@ckeditor/ckeditor5-utils';
|
|
12
11
|
/**
|
|
13
12
|
* UI element class. It should be used to represent editing UI which needs to be injected into the editing view
|
|
14
13
|
* If possible, you should keep your UI outside the editing view. However, if that is not possible,
|
package/src/view/view.js
CHANGED
|
@@ -21,11 +21,9 @@ import CompositionObserver from './observer/compositionobserver';
|
|
|
21
21
|
import InputObserver from './observer/inputobserver';
|
|
22
22
|
import ArrowKeysObserver from './observer/arrowkeysobserver';
|
|
23
23
|
import TabObserver from './observer/tabobserver';
|
|
24
|
-
import {
|
|
25
|
-
import { scrollViewportToShowTarget } from '@ckeditor/ckeditor5-utils/src/dom/scroll';
|
|
24
|
+
import { CKEditorError, ObservableMixin, scrollViewportToShowTarget } from '@ckeditor/ckeditor5-utils';
|
|
26
25
|
import { injectUiElementHandling } from './uielement';
|
|
27
26
|
import { injectQuirksHandling } from './filler';
|
|
28
|
-
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
29
27
|
/**
|
|
30
28
|
* Editor's view controller class. Its main responsibility is DOM - View management for editing purposes, to provide
|
|
31
29
|
* abstraction over the DOM structure and events and hide all browsers quirks.
|
|
@@ -58,7 +56,7 @@ import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
|
58
56
|
*
|
|
59
57
|
* @mixes module:utils/observablemixin~ObservableMixin
|
|
60
58
|
*/
|
|
61
|
-
export default class View extends
|
|
59
|
+
export default class View extends ObservableMixin() {
|
|
62
60
|
/**
|
|
63
61
|
* @param {module:engine/view/stylesmap~StylesProcessor} stylesProcessor The styles processor instance.
|
|
64
62
|
*/
|
|
@@ -108,7 +106,8 @@ export default class View extends Observable {
|
|
|
108
106
|
* @type {module:engine/view/renderer~Renderer}
|
|
109
107
|
*/
|
|
110
108
|
this._renderer = new Renderer(this.domConverter, this.document.selection);
|
|
111
|
-
this._renderer.bind('isFocused', 'isSelecting', 'isComposing'
|
|
109
|
+
this._renderer.bind('isFocused', 'isSelecting', 'isComposing', '_isFocusChanging')
|
|
110
|
+
.to(this.document, 'isFocused', 'isSelecting', 'isComposing', '_isFocusChanging');
|
|
112
111
|
/**
|
|
113
112
|
* A DOM root attributes cache. It saves the initial values of DOM root attributes before the DOM element
|
|
114
113
|
* is {@link module:engine/view/view~View#attachDomRoot attached} to the view so later on, when
|
|
@@ -452,6 +451,7 @@ export default class View extends Observable {
|
|
|
452
451
|
*/
|
|
453
452
|
forceRender() {
|
|
454
453
|
this._hasChangedSinceTheLastRendering = true;
|
|
454
|
+
this.document._isFocusChanging = false;
|
|
455
455
|
this.change(() => { });
|
|
456
456
|
}
|
|
457
457
|
/**
|