@ckeditor/ckeditor5-engine 38.2.0-alpha.1 → 39.0.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 +0 -1
- package/package.json +3 -4
- package/src/controller/datacontroller.d.ts +15 -15
- package/src/controller/datacontroller.js +11 -11
- package/src/controller/editingcontroller.d.ts +7 -7
- package/src/controller/editingcontroller.js +8 -8
- package/src/conversion/conversion.d.ts +6 -6
- package/src/conversion/conversion.js +2 -2
- package/src/conversion/downcastdispatcher.d.ts +28 -13
- package/src/conversion/downcastdispatcher.js +30 -21
- package/src/conversion/downcasthelpers.d.ts +21 -21
- package/src/conversion/downcasthelpers.js +11 -11
- package/src/conversion/mapper.d.ts +9 -9
- package/src/conversion/mapper.js +5 -5
- package/src/conversion/modelconsumable.d.ts +5 -5
- package/src/conversion/modelconsumable.js +1 -1
- package/src/conversion/upcastdispatcher.d.ts +12 -12
- package/src/conversion/upcastdispatcher.js +5 -5
- package/src/conversion/upcasthelpers.d.ts +9 -9
- package/src/conversion/upcasthelpers.js +3 -3
- package/src/conversion/viewconsumable.d.ts +5 -5
- package/src/dataprocessor/basichtmlwriter.d.ts +1 -1
- package/src/dataprocessor/dataprocessor.d.ts +2 -2
- package/src/dataprocessor/htmldataprocessor.d.ts +6 -6
- package/src/dataprocessor/htmldataprocessor.js +2 -2
- package/src/dataprocessor/xmldataprocessor.d.ts +6 -6
- package/src/dataprocessor/xmldataprocessor.js +2 -2
- package/src/dev-utils/model.d.ts +10 -10
- package/src/dev-utils/model.js +16 -16
- package/src/dev-utils/operationreplayer.d.ts +2 -2
- package/src/dev-utils/operationreplayer.js +1 -1
- package/src/dev-utils/view.d.ts +8 -8
- package/src/dev-utils/view.js +15 -15
- package/src/index.d.ts +107 -106
- package/src/index.js +65 -64
- package/src/model/batch.d.ts +1 -1
- package/src/model/differ.d.ts +19 -5
- package/src/model/differ.js +72 -13
- package/src/model/document.d.ts +18 -12
- package/src/model/document.js +18 -13
- package/src/model/documentfragment.d.ts +4 -4
- package/src/model/documentfragment.js +5 -5
- package/src/model/documentselection.d.ts +8 -8
- package/src/model/documentselection.js +8 -5
- package/src/model/element.d.ts +2 -2
- package/src/model/element.js +4 -4
- package/src/model/history.d.ts +1 -1
- package/src/model/item.d.ts +2 -2
- package/src/model/liveposition.d.ts +4 -4
- package/src/model/liveposition.js +1 -1
- package/src/model/liverange.d.ts +5 -5
- package/src/model/liverange.js +1 -1
- package/src/model/markercollection.d.ts +4 -4
- package/src/model/markercollection.js +2 -2
- package/src/model/model.d.ts +14 -15
- package/src/model/model.js +18 -19
- package/src/model/node.d.ts +5 -5
- package/src/model/node.js +2 -2
- package/src/model/nodelist.d.ts +1 -1
- package/src/model/nodelist.js +1 -1
- package/src/model/operation/attributeoperation.d.ts +4 -4
- package/src/model/operation/attributeoperation.js +3 -3
- package/src/model/operation/detachoperation.d.ts +3 -3
- package/src/model/operation/detachoperation.js +3 -3
- package/src/model/operation/insertoperation.d.ts +6 -6
- package/src/model/operation/insertoperation.js +7 -7
- package/src/model/operation/markeroperation.d.ts +5 -5
- package/src/model/operation/markeroperation.js +2 -2
- package/src/model/operation/mergeoperation.d.ts +5 -5
- package/src/model/operation/mergeoperation.js +5 -5
- package/src/model/operation/moveoperation.d.ts +4 -4
- package/src/model/operation/moveoperation.js +4 -4
- package/src/model/operation/nooperation.d.ts +2 -2
- package/src/model/operation/nooperation.js +1 -1
- package/src/model/operation/operation.d.ts +3 -3
- package/src/model/operation/operationfactory.d.ts +2 -2
- package/src/model/operation/operationfactory.js +11 -11
- package/src/model/operation/renameoperation.d.ts +4 -4
- package/src/model/operation/renameoperation.js +3 -3
- package/src/model/operation/rootattributeoperation.d.ts +4 -4
- package/src/model/operation/rootattributeoperation.js +1 -1
- package/src/model/operation/rootoperation.d.ts +3 -7
- package/src/model/operation/rootoperation.js +1 -25
- package/src/model/operation/splitoperation.d.ts +5 -5
- package/src/model/operation/splitoperation.js +5 -5
- package/src/model/operation/transform.d.ts +2 -2
- package/src/model/operation/transform.js +14 -14
- package/src/model/operation/utils.d.ts +6 -6
- package/src/model/operation/utils.js +4 -4
- package/src/model/position.d.ts +14 -14
- package/src/model/position.js +3 -3
- package/src/model/range.d.ts +12 -12
- package/src/model/range.js +3 -3
- package/src/model/rootelement.d.ts +8 -2
- package/src/model/rootelement.js +7 -1
- package/src/model/schema.d.ts +9 -9
- package/src/model/schema.js +10 -5
- package/src/model/selection.d.ts +7 -7
- package/src/model/selection.js +4 -4
- package/src/model/text.d.ts +1 -1
- package/src/model/text.js +1 -1
- package/src/model/textproxy.d.ts +5 -5
- package/src/model/textproxy.js +1 -1
- package/src/model/treewalker.d.ts +3 -3
- package/src/model/treewalker.js +4 -4
- package/src/model/typecheckable.d.ts +13 -13
- package/src/model/utils/autoparagraphing.d.ts +4 -4
- package/src/model/utils/autoparagraphing.js +1 -2
- package/src/model/utils/deletecontent.d.ts +3 -3
- package/src/model/utils/deletecontent.js +3 -3
- package/src/model/utils/findoptimalinsertionrange.d.ts +4 -4
- package/src/model/utils/getselectedcontent.d.ts +4 -4
- package/src/model/utils/insertcontent.d.ts +6 -6
- package/src/model/utils/insertcontent.js +6 -6
- package/src/model/utils/insertobject.d.ts +5 -5
- package/src/model/utils/insertobject.js +1 -1
- package/src/model/utils/modifyselection.d.ts +3 -3
- package/src/model/utils/modifyselection.js +4 -4
- package/src/model/utils/selection-post-fixer.d.ts +3 -3
- package/src/model/utils/selection-post-fixer.js +2 -2
- package/src/model/writer.d.ts +12 -12
- package/src/model/writer.js +17 -17
- package/src/view/attributeelement.d.ts +3 -3
- package/src/view/attributeelement.js +1 -1
- package/src/view/containerelement.d.ts +3 -3
- package/src/view/containerelement.js +1 -1
- package/src/view/document.d.ts +4 -4
- package/src/view/document.js +2 -2
- package/src/view/documentfragment.d.ts +4 -4
- package/src/view/documentfragment.js +3 -3
- package/src/view/documentselection.d.ts +8 -8
- package/src/view/documentselection.js +2 -2
- package/src/view/domconverter.d.ts +19 -13
- package/src/view/domconverter.js +28 -10
- package/src/view/downcastwriter.d.ts +17 -17
- package/src/view/downcastwriter.js +11 -11
- package/src/view/editableelement.d.ts +14 -4
- package/src/view/editableelement.js +2 -1
- package/src/view/element.d.ts +5 -5
- package/src/view/element.js +5 -5
- package/src/view/emptyelement.d.ts +4 -4
- package/src/view/emptyelement.js +2 -2
- package/src/view/filler.d.ts +1 -1
- package/src/view/item.d.ts +2 -2
- package/src/view/matcher.d.ts +1 -1
- package/src/view/node.d.ts +5 -5
- package/src/view/node.js +2 -2
- package/src/view/observer/arrowkeysobserver.d.ts +4 -4
- package/src/view/observer/arrowkeysobserver.js +2 -2
- package/src/view/observer/bubblingemittermixin.d.ts +2 -2
- package/src/view/observer/bubblingemittermixin.js +1 -1
- package/src/view/observer/bubblingeventinfo.d.ts +3 -3
- package/src/view/observer/clickobserver.d.ts +3 -3
- package/src/view/observer/clickobserver.js +1 -1
- package/src/view/observer/compositionobserver.d.ts +3 -3
- package/src/view/observer/compositionobserver.js +1 -1
- package/src/view/observer/domeventdata.d.ts +3 -3
- package/src/view/observer/domeventobserver.d.ts +1 -1
- package/src/view/observer/domeventobserver.js +2 -2
- package/src/view/observer/fakeselectionobserver.d.ts +2 -2
- package/src/view/observer/fakeselectionobserver.js +2 -2
- package/src/view/observer/focusobserver.d.ts +3 -3
- package/src/view/observer/focusobserver.js +1 -1
- package/src/view/observer/inputobserver.d.ts +4 -4
- package/src/view/observer/inputobserver.js +2 -2
- package/src/view/observer/keyobserver.d.ts +2 -2
- package/src/view/observer/keyobserver.js +1 -1
- package/src/view/observer/mouseobserver.d.ts +2 -2
- package/src/view/observer/mouseobserver.js +1 -1
- package/src/view/observer/mutationobserver.d.ts +4 -4
- package/src/view/observer/mutationobserver.js +2 -2
- package/src/view/observer/observer.d.ts +2 -2
- package/src/view/observer/selectionobserver.d.ts +7 -7
- package/src/view/observer/selectionobserver.js +5 -5
- package/src/view/observer/tabobserver.d.ts +4 -4
- package/src/view/observer/tabobserver.js +2 -2
- package/src/view/placeholder.d.ts +18 -7
- package/src/view/placeholder.js +48 -11
- package/src/view/position.d.ts +7 -7
- package/src/view/position.js +4 -4
- package/src/view/range.d.ts +7 -7
- package/src/view/range.js +3 -3
- package/src/view/rawelement.d.ts +5 -5
- package/src/view/rawelement.js +2 -2
- package/src/view/renderer.d.ts +5 -5
- package/src/view/renderer.js +4 -5
- package/src/view/rooteditableelement.d.ts +2 -2
- package/src/view/rooteditableelement.js +1 -1
- package/src/view/selection.d.ts +8 -8
- package/src/view/selection.js +5 -5
- package/src/view/styles/background.d.ts +1 -1
- package/src/view/styles/background.js +1 -1
- package/src/view/styles/border.d.ts +1 -1
- package/src/view/styles/border.js +1 -1
- package/src/view/styles/margin.d.ts +1 -1
- package/src/view/styles/margin.js +1 -1
- package/src/view/styles/padding.d.ts +1 -1
- package/src/view/styles/padding.js +1 -1
- package/src/view/styles/utils.d.ts +1 -1
- package/src/view/text.d.ts +2 -2
- package/src/view/text.js +1 -1
- package/src/view/textproxy.d.ts +6 -6
- package/src/view/textproxy.js +1 -1
- package/src/view/treewalker.d.ts +3 -3
- package/src/view/treewalker.js +4 -4
- package/src/view/typecheckable.d.ts +16 -16
- package/src/view/uielement.d.ts +6 -6
- package/src/view/uielement.js +2 -2
- package/src/view/upcastwriter.d.ts +9 -9
- package/src/view/upcastwriter.js +6 -6
- package/src/view/view.d.ts +26 -19
- package/src/view/view.js +31 -19
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module engine/view/observer/bubblingemittermixin
|
|
7
7
|
*/
|
|
8
8
|
import { CKEditorError, EmitterMixin, EventInfo, toArray } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
import BubblingEventInfo from './bubblingeventinfo
|
|
9
|
+
import BubblingEventInfo from './bubblingeventinfo';
|
|
10
10
|
const contextsSymbol = Symbol('bubbling contexts');
|
|
11
11
|
/**
|
|
12
12
|
* Bubbling emitter mixin for the view document as described in the {@link ~BubblingEmitter} interface.
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* @module engine/view/observer/bubblingeventinfo
|
|
7
7
|
*/
|
|
8
8
|
import { EventInfo } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
import type Document from '../document
|
|
10
|
-
import type Node from '../node
|
|
11
|
-
import type Range from '../range
|
|
9
|
+
import type Document from '../document';
|
|
10
|
+
import type Node from '../node';
|
|
11
|
+
import type Range from '../range';
|
|
12
12
|
/**
|
|
13
13
|
* The event object passed to bubbling event callbacks. It is used to provide information about the event as well as a tool to
|
|
14
14
|
* manipulate it.
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/clickobserver
|
|
7
7
|
*/
|
|
8
|
-
import DomEventObserver from './domeventobserver
|
|
9
|
-
import type DomEventData from './domeventdata
|
|
10
|
-
import type { BubblingEvent } from './bubblingemittermixin
|
|
8
|
+
import DomEventObserver from './domeventobserver';
|
|
9
|
+
import type DomEventData from './domeventdata';
|
|
10
|
+
import type { BubblingEvent } from './bubblingemittermixin';
|
|
11
11
|
/**
|
|
12
12
|
* {@link module:engine/view/document~Document#event:click Click} event observer.
|
|
13
13
|
*
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/compositionobserver
|
|
7
7
|
*/
|
|
8
|
-
import DomEventObserver from './domeventobserver
|
|
9
|
-
import type View from '../view
|
|
10
|
-
import type DomEventData from './domeventdata
|
|
8
|
+
import DomEventObserver from './domeventobserver';
|
|
9
|
+
import type View from '../view';
|
|
10
|
+
import type DomEventData from './domeventdata';
|
|
11
11
|
/**
|
|
12
12
|
* {@link module:engine/view/document~Document#event:compositionstart Compositionstart},
|
|
13
13
|
* {@link module:engine/view/document~Document#event:compositionupdate compositionupdate} and
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/compositionobserver
|
|
7
7
|
*/
|
|
8
|
-
import DomEventObserver from './domeventobserver
|
|
8
|
+
import DomEventObserver from './domeventobserver';
|
|
9
9
|
/**
|
|
10
10
|
* {@link module:engine/view/document~Document#event:compositionstart Compositionstart},
|
|
11
11
|
* {@link module:engine/view/document~Document#event:compositionupdate compositionupdate} and
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, 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
|
-
import type Document from '../document
|
|
6
|
-
import type Element from '../element
|
|
7
|
-
import type View from '../view
|
|
5
|
+
import type Document from '../document';
|
|
6
|
+
import type Element from '../element';
|
|
7
|
+
import type View from '../view';
|
|
8
8
|
/**
|
|
9
9
|
* Information about a DOM event in context of the {@link module:engine/view/document~Document}.
|
|
10
10
|
* It wraps the native event, which usually should not be used as the wrapper contains
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/domeventobserver
|
|
7
7
|
*/
|
|
8
|
-
import Observer from './observer
|
|
8
|
+
import Observer from './observer';
|
|
9
9
|
import type { EventInfo } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
/**
|
|
11
11
|
* Base class for DOM event observers. This class handles
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/domeventobserver
|
|
7
7
|
*/
|
|
8
|
-
import Observer from './observer
|
|
9
|
-
import DomEventData from './domeventdata
|
|
8
|
+
import Observer from './observer';
|
|
9
|
+
import DomEventData from './domeventdata';
|
|
10
10
|
/**
|
|
11
11
|
* Base class for DOM event observers. This class handles
|
|
12
12
|
* {@link module:engine/view/observer/observer~Observer#observe adding} listeners to DOM elements,
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/fakeselectionobserver
|
|
7
7
|
*/
|
|
8
|
-
import Observer from './observer
|
|
9
|
-
import type View from '../view
|
|
8
|
+
import Observer from './observer';
|
|
9
|
+
import type View from '../view';
|
|
10
10
|
/**
|
|
11
11
|
* Fake selection observer class. If view selection is fake it is placed in dummy DOM container. This observer listens
|
|
12
12
|
* on {@link module:engine/view/document~Document#event:keydown keydown} events and handles moving fake view selection to the correct place
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/fakeselectionobserver
|
|
7
7
|
*/
|
|
8
|
-
import Observer from './observer
|
|
9
|
-
import ViewSelection from '../selection
|
|
8
|
+
import Observer from './observer';
|
|
9
|
+
import ViewSelection from '../selection';
|
|
10
10
|
import { keyCodes } from '@ckeditor/ckeditor5-utils';
|
|
11
11
|
import { debounce } from 'lodash-es';
|
|
12
12
|
/**
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/focusobserver
|
|
7
7
|
*/
|
|
8
|
-
import DomEventObserver from './domeventobserver
|
|
9
|
-
import type DomEventData from './domeventdata
|
|
10
|
-
import type View from '../view
|
|
8
|
+
import DomEventObserver from './domeventobserver';
|
|
9
|
+
import type DomEventData from './domeventdata';
|
|
10
|
+
import type View from '../view';
|
|
11
11
|
/**
|
|
12
12
|
* {@link module:engine/view/document~Document#event:focus Focus}
|
|
13
13
|
* and {@link module:engine/view/document~Document#event:blur blur} events observer.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module engine/view/observer/focusobserver
|
|
7
7
|
*/
|
|
8
8
|
/* globals setTimeout, clearTimeout */
|
|
9
|
-
import DomEventObserver from './domeventobserver
|
|
9
|
+
import DomEventObserver from './domeventobserver';
|
|
10
10
|
/**
|
|
11
11
|
* {@link module:engine/view/document~Document#event:focus Focus}
|
|
12
12
|
* and {@link module:engine/view/document~Document#event:blur blur} events observer.
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/inputobserver
|
|
7
7
|
*/
|
|
8
|
-
import DomEventObserver from './domeventobserver
|
|
9
|
-
import type DomEventData from './domeventdata
|
|
10
|
-
import type ViewRange from '../range
|
|
11
|
-
import DataTransfer from '../datatransfer
|
|
8
|
+
import DomEventObserver from './domeventobserver';
|
|
9
|
+
import type DomEventData from './domeventdata';
|
|
10
|
+
import type ViewRange from '../range';
|
|
11
|
+
import DataTransfer from '../datatransfer';
|
|
12
12
|
/**
|
|
13
13
|
* Observer for events connected with data input.
|
|
14
14
|
*
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/inputobserver
|
|
7
7
|
*/
|
|
8
|
-
import DomEventObserver from './domeventobserver
|
|
9
|
-
import DataTransfer from '../datatransfer
|
|
8
|
+
import DomEventObserver from './domeventobserver';
|
|
9
|
+
import DataTransfer from '../datatransfer';
|
|
10
10
|
import { env } from '@ckeditor/ckeditor5-utils';
|
|
11
11
|
/**
|
|
12
12
|
* Observer for events connected with data input.
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/keyobserver
|
|
7
7
|
*/
|
|
8
|
-
import DomEventObserver from './domeventobserver
|
|
9
|
-
import type DomEventData from './domeventdata
|
|
8
|
+
import DomEventObserver from './domeventobserver';
|
|
9
|
+
import type DomEventData from './domeventdata';
|
|
10
10
|
import { type KeystrokeInfo } from '@ckeditor/ckeditor5-utils';
|
|
11
11
|
/**
|
|
12
12
|
* Observer for events connected with pressing keyboard keys.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/keyobserver
|
|
7
7
|
*/
|
|
8
|
-
import DomEventObserver from './domeventobserver
|
|
8
|
+
import DomEventObserver from './domeventobserver';
|
|
9
9
|
import { getCode } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
/**
|
|
11
11
|
* Observer for events connected with pressing keyboard keys.
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/mouseobserver
|
|
7
7
|
*/
|
|
8
|
-
import DomEventObserver from './domeventobserver
|
|
9
|
-
import type DomEventData from './domeventdata
|
|
8
|
+
import DomEventObserver from './domeventobserver';
|
|
9
|
+
import type DomEventData from './domeventdata';
|
|
10
10
|
/**
|
|
11
11
|
* Mouse events observer.
|
|
12
12
|
*
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/mutationobserver
|
|
7
7
|
*/
|
|
8
|
-
import Observer from './observer
|
|
9
|
-
import type DomConverter from '../domconverter
|
|
10
|
-
import type Renderer from '../renderer
|
|
11
|
-
import type View from '../view
|
|
8
|
+
import Observer from './observer';
|
|
9
|
+
import type DomConverter from '../domconverter';
|
|
10
|
+
import type Renderer from '../renderer';
|
|
11
|
+
import type View from '../view';
|
|
12
12
|
/**
|
|
13
13
|
* Mutation observer's role is to watch for any DOM changes inside the editor that weren't
|
|
14
14
|
* done by the editor's {@link module:engine/view/renderer~Renderer} itself and reverting these changes.
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @module engine/view/observer/mutationobserver
|
|
7
7
|
*/
|
|
8
8
|
/* globals window */
|
|
9
|
-
import Observer from './observer
|
|
10
|
-
import { startsWithFiller } from '../filler
|
|
9
|
+
import Observer from './observer';
|
|
10
|
+
import { startsWithFiller } from '../filler';
|
|
11
11
|
import { isEqualWith } from 'lodash-es';
|
|
12
12
|
/**
|
|
13
13
|
* Mutation observer's role is to watch for any DOM changes inside the editor that weren't
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, 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
|
-
import type Document from '../document
|
|
6
|
-
import type View from '../view
|
|
5
|
+
import type Document from '../document';
|
|
6
|
+
import type View from '../view';
|
|
7
7
|
declare const Observer_base: {
|
|
8
8
|
new (): import("@ckeditor/ckeditor5-utils").DomEmitter;
|
|
9
9
|
prototype: import("@ckeditor/ckeditor5-utils").DomEmitter;
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/selectionobserver
|
|
7
7
|
*/
|
|
8
|
-
import Observer from './observer
|
|
9
|
-
import MutationObserver from './mutationobserver
|
|
10
|
-
import type View from '../view
|
|
11
|
-
import type DocumentSelection from '../documentselection
|
|
12
|
-
import type DomConverter from '../domconverter
|
|
13
|
-
import type Selection from '../selection
|
|
14
|
-
import FocusObserver from './focusobserver
|
|
8
|
+
import Observer from './observer';
|
|
9
|
+
import MutationObserver from './mutationobserver';
|
|
10
|
+
import type View from '../view';
|
|
11
|
+
import type DocumentSelection from '../documentselection';
|
|
12
|
+
import type DomConverter from '../domconverter';
|
|
13
|
+
import type Selection from '../selection';
|
|
14
|
+
import FocusObserver from './focusobserver';
|
|
15
15
|
type DomSelection = globalThis.Selection;
|
|
16
16
|
/**
|
|
17
17
|
* Selection observer class observes selection changes in the document. If a selection changes on the document this
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* @module engine/view/observer/selectionobserver
|
|
7
7
|
*/
|
|
8
8
|
/* global setInterval, clearInterval */
|
|
9
|
-
import Observer from './observer
|
|
10
|
-
import MutationObserver from './mutationobserver
|
|
9
|
+
import Observer from './observer';
|
|
10
|
+
import MutationObserver from './mutationobserver';
|
|
11
11
|
import { env } from '@ckeditor/ckeditor5-utils';
|
|
12
12
|
import { debounce } from 'lodash-es';
|
|
13
|
-
import FocusObserver from './focusobserver
|
|
13
|
+
import FocusObserver from './focusobserver';
|
|
14
14
|
/**
|
|
15
15
|
* Selection observer class observes selection changes in the document. If a selection changes on the document this
|
|
16
16
|
* observer checks if the DOM selection is different from the {@link module:engine/view/document~Document#selection view selection}.
|
|
@@ -151,6 +151,8 @@ export default class SelectionObserver extends Observer {
|
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
153
|
this.view.hasDomSelection = true;
|
|
154
|
+
// Mark the latest focus change as complete (we got new selection after the focus so the selection is in the focused element).
|
|
155
|
+
this.focusObserver.flush();
|
|
154
156
|
if (this.selection.isEqual(newViewSelection) && this.domConverter.isDomSelectionCorrect(domSelection)) {
|
|
155
157
|
return;
|
|
156
158
|
}
|
|
@@ -165,8 +167,6 @@ export default class SelectionObserver extends Observer {
|
|
|
165
167
|
this._reportInfiniteLoop();
|
|
166
168
|
return;
|
|
167
169
|
}
|
|
168
|
-
// Mark the latest focus change as complete (we got new selection after the focus so the selection is in the focused element).
|
|
169
|
-
this.focusObserver.flush();
|
|
170
170
|
if (this.selection.isSimilar(newViewSelection)) {
|
|
171
171
|
// If selection was equal and we are at this point of algorithm, it means that it was incorrect.
|
|
172
172
|
// Just re-render it, no need to fire any events, etc.
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/observer/tabobserver
|
|
7
7
|
*/
|
|
8
|
-
import type View from '../view
|
|
9
|
-
import Observer from './observer
|
|
10
|
-
import type { KeyEventData } from './keyobserver
|
|
11
|
-
import type { BubblingEvent } from './bubblingemittermixin
|
|
8
|
+
import type View from '../view';
|
|
9
|
+
import Observer from './observer';
|
|
10
|
+
import type { KeyEventData } from './keyobserver';
|
|
11
|
+
import type { BubblingEvent } from './bubblingemittermixin';
|
|
12
12
|
/**
|
|
13
13
|
* Tab observer introduces the {@link module:engine/view/document~Document#event:tab `Document#tab`} event.
|
|
14
14
|
*
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, 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
|
-
import Observer from './observer
|
|
6
|
-
import BubblingEventInfo from './bubblingeventinfo
|
|
5
|
+
import Observer from './observer';
|
|
6
|
+
import BubblingEventInfo from './bubblingeventinfo';
|
|
7
7
|
import { keyCodes } from '@ckeditor/ckeditor5-utils';
|
|
8
8
|
/**
|
|
9
9
|
* Tab observer introduces the {@link module:engine/view/document~Document#event:tab `Document#tab`} event.
|
|
@@ -6,32 +6,34 @@
|
|
|
6
6
|
* @module engine/view/placeholder
|
|
7
7
|
*/
|
|
8
8
|
import '../../theme/placeholder.css';
|
|
9
|
-
import type DowncastWriter from './downcastwriter
|
|
10
|
-
import type
|
|
11
|
-
import type
|
|
9
|
+
import type DowncastWriter from './downcastwriter';
|
|
10
|
+
import type EditableElement from './editableelement';
|
|
11
|
+
import type Element from './element';
|
|
12
|
+
import type View from './view';
|
|
12
13
|
/**
|
|
13
14
|
* A helper that enables a placeholder on the provided view element (also updates its visibility).
|
|
14
15
|
* The placeholder is a CSS pseudo–element (with a text content) attached to the element.
|
|
15
16
|
*
|
|
16
|
-
* To change the placeholder text,
|
|
17
|
+
* To change the placeholder text, change value of the `placeholder` property in the provided `element`.
|
|
17
18
|
*
|
|
18
19
|
* To disable the placeholder, use {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} helper.
|
|
19
20
|
*
|
|
20
21
|
* @param options Configuration options of the placeholder.
|
|
21
22
|
* @param options.view Editing view instance.
|
|
22
23
|
* @param options.element Element that will gain a placeholder. See `options.isDirectHost` to learn more.
|
|
23
|
-
* @param options.text Placeholder text.
|
|
24
24
|
* @param options.isDirectHost If set `false`, the placeholder will not be enabled directly
|
|
25
25
|
* in the passed `element` but in one of its children (selected automatically, i.e. a first empty child element).
|
|
26
26
|
* Useful when attaching placeholders to elements that can host other elements (not just text), for instance,
|
|
27
27
|
* editable root elements.
|
|
28
|
+
* @param options.text Placeholder text. It's **deprecated** and will be removed soon. Use
|
|
29
|
+
* {@link module:engine/view/placeholder~PlaceholderableElement#placeholder `options.element.placeholder`} instead.
|
|
28
30
|
* @param options.keepOnFocus If set `true`, the placeholder stay visible when the host element is focused.
|
|
29
31
|
*/
|
|
30
32
|
export declare function enablePlaceholder({ view, element, text, isDirectHost, keepOnFocus }: {
|
|
31
33
|
view: View;
|
|
32
|
-
element:
|
|
33
|
-
text: string;
|
|
34
|
+
element: PlaceholderableElement | EditableElement;
|
|
34
35
|
isDirectHost?: boolean;
|
|
36
|
+
text?: string;
|
|
35
37
|
keepOnFocus?: boolean;
|
|
36
38
|
}): void;
|
|
37
39
|
/**
|
|
@@ -83,3 +85,12 @@ export declare function hidePlaceholder(writer: DowncastWriter, element: Element
|
|
|
83
85
|
* @param keepOnFocus Focusing the element will keep the placeholder visible.
|
|
84
86
|
*/
|
|
85
87
|
export declare function needsPlaceholder(element: Element, keepOnFocus: boolean): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Element that could have a placeholder.
|
|
90
|
+
*/
|
|
91
|
+
export interface PlaceholderableElement extends Element {
|
|
92
|
+
/**
|
|
93
|
+
* The text of element's placeholder.
|
|
94
|
+
*/
|
|
95
|
+
placeholder?: string;
|
|
96
|
+
}
|
package/src/view/placeholder.js
CHANGED
|
@@ -6,24 +6,27 @@
|
|
|
6
6
|
* @module engine/view/placeholder
|
|
7
7
|
*/
|
|
8
8
|
import '../../theme/placeholder.css';
|
|
9
|
+
import { logWarning } from '@ckeditor/ckeditor5-utils';
|
|
9
10
|
// Each document stores information about its placeholder elements and check functions.
|
|
10
11
|
const documentPlaceholders = new WeakMap();
|
|
12
|
+
let hasDisplayedPlaceholderDeprecationWarning = false;
|
|
11
13
|
/**
|
|
12
14
|
* A helper that enables a placeholder on the provided view element (also updates its visibility).
|
|
13
15
|
* The placeholder is a CSS pseudo–element (with a text content) attached to the element.
|
|
14
16
|
*
|
|
15
|
-
* To change the placeholder text,
|
|
17
|
+
* To change the placeholder text, change value of the `placeholder` property in the provided `element`.
|
|
16
18
|
*
|
|
17
19
|
* To disable the placeholder, use {@link module:engine/view/placeholder~disablePlaceholder `disablePlaceholder()`} helper.
|
|
18
20
|
*
|
|
19
21
|
* @param options Configuration options of the placeholder.
|
|
20
22
|
* @param options.view Editing view instance.
|
|
21
23
|
* @param options.element Element that will gain a placeholder. See `options.isDirectHost` to learn more.
|
|
22
|
-
* @param options.text Placeholder text.
|
|
23
24
|
* @param options.isDirectHost If set `false`, the placeholder will not be enabled directly
|
|
24
25
|
* in the passed `element` but in one of its children (selected automatically, i.e. a first empty child element).
|
|
25
26
|
* Useful when attaching placeholders to elements that can host other elements (not just text), for instance,
|
|
26
27
|
* editable root elements.
|
|
28
|
+
* @param options.text Placeholder text. It's **deprecated** and will be removed soon. Use
|
|
29
|
+
* {@link module:engine/view/placeholder~PlaceholderableElement#placeholder `options.element.placeholder`} instead.
|
|
27
30
|
* @param options.keepOnFocus If set `true`, the placeholder stay visible when the host element is focused.
|
|
28
31
|
*/
|
|
29
32
|
export function enablePlaceholder({ view, element, text, isDirectHost = true, keepOnFocus = false }) {
|
|
@@ -39,15 +42,31 @@ export function enablePlaceholder({ view, element, text, isDirectHost = true, ke
|
|
|
39
42
|
view.change(writer => updateDocumentPlaceholders(doc, writer));
|
|
40
43
|
}, { priority: 'high' });
|
|
41
44
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
if (element.is('editableElement')) {
|
|
46
|
+
element.on('change:placeholder', (evtInfo, evt, text) => {
|
|
47
|
+
setPlaceholder(text);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (element.placeholder) {
|
|
51
|
+
setPlaceholder(element.placeholder);
|
|
52
|
+
}
|
|
53
|
+
else if (text) {
|
|
54
|
+
setPlaceholder(text);
|
|
55
|
+
}
|
|
56
|
+
if (text) {
|
|
57
|
+
showPlaceholderTextDeprecationWarning();
|
|
58
|
+
}
|
|
59
|
+
function setPlaceholder(text) {
|
|
60
|
+
// Store information about the element placeholder under its document.
|
|
61
|
+
documentPlaceholders.get(doc).set(element, {
|
|
62
|
+
text,
|
|
63
|
+
isDirectHost,
|
|
64
|
+
keepOnFocus,
|
|
65
|
+
hostElement: isDirectHost ? element : null
|
|
66
|
+
});
|
|
67
|
+
// Update the placeholders right away.
|
|
68
|
+
view.change(writer => updateDocumentPlaceholders(doc, writer));
|
|
69
|
+
}
|
|
51
70
|
}
|
|
52
71
|
/**
|
|
53
72
|
* Disables the placeholder functionality from a given element.
|
|
@@ -228,3 +247,21 @@ function getChildPlaceholderHostSubstitute(parent) {
|
|
|
228
247
|
}
|
|
229
248
|
return null;
|
|
230
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Displays a deprecation warning message in the console, but only once per page load.
|
|
252
|
+
*/
|
|
253
|
+
function showPlaceholderTextDeprecationWarning() {
|
|
254
|
+
if (!hasDisplayedPlaceholderDeprecationWarning) {
|
|
255
|
+
/**
|
|
256
|
+
* The "text" option in the {@link module:engine/view/placeholder~enablePlaceholder `enablePlaceholder()`}
|
|
257
|
+
* function is deprecated and will be removed soon.
|
|
258
|
+
*
|
|
259
|
+
* See the {@glink updating/guides/update-to-39#view-element-placeholder Migration to v39} guide for
|
|
260
|
+
* more information on how to apply this change.
|
|
261
|
+
*
|
|
262
|
+
* @error enableplaceholder-deprecated-text-option
|
|
263
|
+
*/
|
|
264
|
+
logWarning('enableplaceholder-deprecated-text-option');
|
|
265
|
+
}
|
|
266
|
+
hasDisplayedPlaceholderDeprecationWarning = true;
|
|
267
|
+
}
|
package/src/view/position.d.ts
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/position
|
|
7
7
|
*/
|
|
8
|
-
import TypeCheckable from './typecheckable
|
|
9
|
-
import EditableElement from './editableelement
|
|
10
|
-
import '@ckeditor/ckeditor5-utils/src/version
|
|
11
|
-
import type DocumentFragment from './documentfragment
|
|
12
|
-
import type Item from './item
|
|
13
|
-
import type Node from './node
|
|
14
|
-
import { default as TreeWalker, type TreeWalkerValue, type TreeWalkerOptions } from './treewalker
|
|
8
|
+
import TypeCheckable from './typecheckable';
|
|
9
|
+
import EditableElement from './editableelement';
|
|
10
|
+
import '@ckeditor/ckeditor5-utils/src/version';
|
|
11
|
+
import type DocumentFragment from './documentfragment';
|
|
12
|
+
import type Item from './item';
|
|
13
|
+
import type Node from './node';
|
|
14
|
+
import { default as TreeWalker, type TreeWalkerValue, type TreeWalkerOptions } from './treewalker';
|
|
15
15
|
/**
|
|
16
16
|
* Position in the view tree. Position is represented by its parent node and an offset in this parent.
|
|
17
17
|
*
|
package/src/view/position.js
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/position
|
|
7
7
|
*/
|
|
8
|
-
import TypeCheckable from './typecheckable
|
|
8
|
+
import TypeCheckable from './typecheckable';
|
|
9
9
|
import { CKEditorError, compareArrays } from '@ckeditor/ckeditor5-utils';
|
|
10
|
-
import EditableElement from './editableelement
|
|
10
|
+
import EditableElement from './editableelement';
|
|
11
11
|
// To check if component is loaded more than once.
|
|
12
|
-
import '@ckeditor/ckeditor5-utils/src/version
|
|
13
|
-
import { default as TreeWalker } from './treewalker
|
|
12
|
+
import '@ckeditor/ckeditor5-utils/src/version';
|
|
13
|
+
import { default as TreeWalker } from './treewalker';
|
|
14
14
|
/**
|
|
15
15
|
* Position in the view tree. Position is represented by its parent node and an offset in this parent.
|
|
16
16
|
*
|
package/src/view/range.d.ts
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/range
|
|
7
7
|
*/
|
|
8
|
-
import TypeCheckable from './typecheckable
|
|
9
|
-
import Position from './position
|
|
10
|
-
import type DocumentFragment from './documentfragment
|
|
11
|
-
import type Element from './element
|
|
12
|
-
import type Item from './item
|
|
13
|
-
import type Node from './node
|
|
14
|
-
import { default as TreeWalker, type TreeWalkerValue, type TreeWalkerOptions } from './treewalker
|
|
8
|
+
import TypeCheckable from './typecheckable';
|
|
9
|
+
import Position from './position';
|
|
10
|
+
import type DocumentFragment from './documentfragment';
|
|
11
|
+
import type Element from './element';
|
|
12
|
+
import type Item from './item';
|
|
13
|
+
import type Node from './node';
|
|
14
|
+
import { default as TreeWalker, type TreeWalkerValue, type TreeWalkerOptions } from './treewalker';
|
|
15
15
|
/**
|
|
16
16
|
* Range in the view tree. A range is represented by its start and end {@link module:engine/view/position~Position positions}.
|
|
17
17
|
*
|
package/src/view/range.js
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/range
|
|
7
7
|
*/
|
|
8
|
-
import TypeCheckable from './typecheckable
|
|
9
|
-
import Position from './position
|
|
10
|
-
import { default as TreeWalker } from './treewalker
|
|
8
|
+
import TypeCheckable from './typecheckable';
|
|
9
|
+
import Position from './position';
|
|
10
|
+
import { default as TreeWalker } from './treewalker';
|
|
11
11
|
/**
|
|
12
12
|
* Range in the view tree. A range is represented by its start and end {@link module:engine/view/position~Position positions}.
|
|
13
13
|
*
|
package/src/view/rawelement.d.ts
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module engine/view/rawelement
|
|
7
7
|
*/
|
|
8
|
-
import Element, { type ElementAttributes } from './element
|
|
9
|
-
import Node from './node
|
|
10
|
-
import type Document from './document
|
|
11
|
-
import type DomConverter from './domconverter
|
|
12
|
-
import type Item from './item
|
|
8
|
+
import Element, { type ElementAttributes } from './element';
|
|
9
|
+
import Node from './node';
|
|
10
|
+
import type Document from './document';
|
|
11
|
+
import type DomConverter from './domconverter';
|
|
12
|
+
import type Item from './item';
|
|
13
13
|
type DomElement = globalThis.HTMLElement;
|
|
14
14
|
/**
|
|
15
15
|
* The raw element class.
|
package/src/view/rawelement.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module engine/view/rawelement
|
|
8
8
|
*/
|
|
9
|
-
import Element from './element
|
|
10
|
-
import Node from './node
|
|
9
|
+
import Element from './element';
|
|
10
|
+
import Node from './node';
|
|
11
11
|
import { CKEditorError } from '@ckeditor/ckeditor5-utils';
|
|
12
12
|
/**
|
|
13
13
|
* The raw element class.
|
package/src/view/renderer.d.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2023, 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
|
-
import type { ChangeType } from './document
|
|
6
|
-
import type DocumentSelection from './documentselection
|
|
7
|
-
import type DomConverter from './domconverter
|
|
8
|
-
import type ViewElement from './element
|
|
9
|
-
import type ViewNode from './node
|
|
5
|
+
import type { ChangeType } from './document';
|
|
6
|
+
import type DocumentSelection from './documentselection';
|
|
7
|
+
import type DomConverter from './domconverter';
|
|
8
|
+
import type ViewElement from './element';
|
|
9
|
+
import type ViewNode from './node';
|
|
10
10
|
import '../../theme/renderer.css';
|
|
11
11
|
type DomDocument = globalThis.Document;
|
|
12
12
|
declare const Renderer_base: {
|