@ckeditor/ckeditor5-engine 29.2.0 → 32.0.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.
Files changed (118) hide show
  1. package/LICENSE.md +2 -2
  2. package/package.json +25 -23
  3. package/src/controller/datacontroller.js +60 -12
  4. package/src/controller/editingcontroller.js +1 -1
  5. package/src/conversion/conversion.js +1 -1
  6. package/src/conversion/conversionhelpers.js +1 -1
  7. package/src/conversion/downcastdispatcher.js +1 -1
  8. package/src/conversion/downcasthelpers.js +1 -1
  9. package/src/conversion/mapper.js +1 -1
  10. package/src/conversion/modelconsumable.js +1 -1
  11. package/src/conversion/upcastdispatcher.js +1 -1
  12. package/src/conversion/upcasthelpers.js +1 -1
  13. package/src/conversion/viewconsumable.js +1 -1
  14. package/src/dataprocessor/basichtmlwriter.js +1 -1
  15. package/src/dataprocessor/dataprocessor.jsdoc +1 -1
  16. package/src/dataprocessor/htmldataprocessor.js +18 -43
  17. package/src/dataprocessor/htmlwriter.js +1 -1
  18. package/src/dataprocessor/xmldataprocessor.js +13 -17
  19. package/src/dev-utils/model.js +3 -3
  20. package/src/dev-utils/operationreplayer.js +1 -1
  21. package/src/dev-utils/utils.js +1 -1
  22. package/src/dev-utils/view.js +22 -4
  23. package/src/index.js +1 -1
  24. package/src/model/batch.js +77 -10
  25. package/src/model/differ.js +1 -1
  26. package/src/model/document.js +1 -1
  27. package/src/model/documentfragment.js +1 -1
  28. package/src/model/documentselection.js +1 -1
  29. package/src/model/element.js +1 -1
  30. package/src/model/history.js +1 -1
  31. package/src/model/item.jsdoc +1 -1
  32. package/src/model/liveposition.js +1 -1
  33. package/src/model/liverange.js +1 -1
  34. package/src/model/markercollection.js +6 -5
  35. package/src/model/model.js +17 -9
  36. package/src/model/node.js +1 -1
  37. package/src/model/nodelist.js +1 -1
  38. package/src/model/operation/attributeoperation.js +1 -1
  39. package/src/model/operation/detachoperation.js +1 -1
  40. package/src/model/operation/insertoperation.js +1 -1
  41. package/src/model/operation/markeroperation.js +1 -1
  42. package/src/model/operation/mergeoperation.js +1 -1
  43. package/src/model/operation/moveoperation.js +1 -1
  44. package/src/model/operation/nooperation.js +1 -1
  45. package/src/model/operation/operation.js +1 -1
  46. package/src/model/operation/operationfactory.js +1 -1
  47. package/src/model/operation/renameoperation.js +1 -1
  48. package/src/model/operation/rootattributeoperation.js +1 -1
  49. package/src/model/operation/splitoperation.js +1 -1
  50. package/src/model/operation/transform.js +1 -1
  51. package/src/model/operation/utils.js +1 -1
  52. package/src/model/position.js +1 -1
  53. package/src/model/range.js +2 -2
  54. package/src/model/rootelement.js +1 -1
  55. package/src/model/schema.js +1 -1
  56. package/src/model/selection.js +1 -1
  57. package/src/model/text.js +1 -1
  58. package/src/model/textproxy.js +1 -1
  59. package/src/model/treewalker.js +1 -1
  60. package/src/model/utils/autoparagraphing.js +1 -1
  61. package/src/model/utils/deletecontent.js +1 -1
  62. package/src/model/utils/getselectedcontent.js +1 -1
  63. package/src/model/utils/insertcontent.js +1 -1
  64. package/src/model/utils/modifyselection.js +1 -1
  65. package/src/model/utils/selection-post-fixer.js +44 -29
  66. package/src/model/writer.js +1 -1
  67. package/src/view/attributeelement.js +1 -1
  68. package/src/view/containerelement.js +1 -1
  69. package/src/view/document.js +13 -1
  70. package/src/view/documentfragment.js +1 -1
  71. package/src/view/documentselection.js +1 -1
  72. package/src/view/domconverter.js +268 -24
  73. package/src/view/downcastwriter.js +33 -2
  74. package/src/view/editableelement.js +1 -1
  75. package/src/view/element.js +29 -1
  76. package/src/view/elementdefinition.jsdoc +1 -1
  77. package/src/view/emptyelement.js +1 -1
  78. package/src/view/filler.js +1 -1
  79. package/src/view/item.jsdoc +1 -1
  80. package/src/view/matcher.js +22 -17
  81. package/src/view/node.js +1 -1
  82. package/src/view/observer/arrowkeysobserver.js +1 -1
  83. package/src/view/observer/bubblingemittermixin.js +1 -1
  84. package/src/view/observer/bubblingeventinfo.js +1 -1
  85. package/src/view/observer/clickobserver.js +1 -1
  86. package/src/view/observer/compositionobserver.js +1 -1
  87. package/src/view/observer/domeventdata.js +1 -1
  88. package/src/view/observer/domeventobserver.js +1 -1
  89. package/src/view/observer/fakeselectionobserver.js +1 -1
  90. package/src/view/observer/focusobserver.js +1 -1
  91. package/src/view/observer/inputobserver.js +1 -1
  92. package/src/view/observer/keyobserver.js +1 -1
  93. package/src/view/observer/mouseobserver.js +1 -1
  94. package/src/view/observer/mutationobserver.js +1 -1
  95. package/src/view/observer/observer.js +1 -1
  96. package/src/view/observer/selectionobserver.js +49 -2
  97. package/src/view/placeholder.js +1 -1
  98. package/src/view/position.js +1 -1
  99. package/src/view/range.js +1 -1
  100. package/src/view/rawelement.js +4 -3
  101. package/src/view/renderer.js +94 -40
  102. package/src/view/rooteditableelement.js +1 -1
  103. package/src/view/selection.js +1 -1
  104. package/src/view/styles/background.js +1 -1
  105. package/src/view/styles/border.js +1 -1
  106. package/src/view/styles/margin.js +1 -1
  107. package/src/view/styles/padding.js +1 -1
  108. package/src/view/styles/utils.js +6 -1
  109. package/src/view/stylesmap.js +1 -1
  110. package/src/view/text.js +1 -1
  111. package/src/view/textproxy.js +1 -1
  112. package/src/view/treewalker.js +1 -1
  113. package/src/view/uielement.js +6 -3
  114. package/src/view/upcastwriter.js +1 -1
  115. package/src/view/view.js +2 -2
  116. package/theme/placeholder.css +1 -1
  117. package/theme/renderer.css +9 -0
  118. package/CHANGELOG.md +0 -823
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -20,10 +20,13 @@ import remove from '@ckeditor/ckeditor5-utils/src/dom/remove';
20
20
  import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
21
21
  import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
22
22
  import isText from '@ckeditor/ckeditor5-utils/src/dom/istext';
23
+ import isComment from '@ckeditor/ckeditor5-utils/src/dom/iscomment';
23
24
  import isNode from '@ckeditor/ckeditor5-utils/src/dom/isnode';
24
25
  import fastDiff from '@ckeditor/ckeditor5-utils/src/fastdiff';
25
26
  import env from '@ckeditor/ckeditor5-utils/src/env';
26
27
 
28
+ import '../../theme/renderer.css';
29
+
27
30
  /**
28
31
  * Renderer is responsible for updating the DOM structure and the DOM selection based on
29
32
  * the {@link module:engine/view/renderer~Renderer#markToSync information about updated view nodes}.
@@ -98,8 +101,34 @@ export default class Renderer {
98
101
  * this is set to `false`.
99
102
  *
100
103
  * @member {Boolean}
104
+ * @observable
101
105
  */
102
- this.isFocused = false;
106
+ this.set( 'isFocused', false );
107
+
108
+ /**
109
+ * Indicates whether the user is making a selection in the document (e.g. holding the mouse button and moving the cursor).
110
+ * When they stop selecting, the property goes back to `false`.
111
+ *
112
+ * Note: In some browsers, the renderer will stop rendering the selection and inline fillers while the user is making
113
+ * a selection to avoid glitches in DOM selection
114
+ * (https://github.com/ckeditor/ckeditor5/issues/10562, https://github.com/ckeditor/ckeditor5/issues/10723).
115
+ *
116
+ * @member {Boolean}
117
+ * @observable
118
+ */
119
+ this.set( 'isSelecting', false );
120
+
121
+ // Rendering the selection and inline filler manipulation should be postponed in (non-Android) Blink until the user finishes
122
+ // creating the selection in DOM to avoid accidental selection collapsing
123
+ // (https://github.com/ckeditor/ckeditor5/issues/10562, https://github.com/ckeditor/ckeditor5/issues/10723).
124
+ // When the user stops selecting, all pending changes should be rendered ASAP, though.
125
+ if ( env.isBlink && !env.isAndroid ) {
126
+ this.on( 'change:isSelecting', () => {
127
+ if ( !this.isSelecting ) {
128
+ this.render();
129
+ }
130
+ } );
131
+ }
103
132
 
104
133
  /**
105
134
  * The text node in which the inline filler was rendered.
@@ -170,29 +199,41 @@ export default class Renderer {
170
199
  */
171
200
  render() {
172
201
  let inlineFillerPosition;
202
+ const isInlineFillerRenderingPossible = env.isBlink && !env.isAndroid ? !this.isSelecting : true;
173
203
 
174
204
  // Refresh mappings.
175
205
  for ( const element of this.markedChildren ) {
176
206
  this._updateChildrenMappings( element );
177
207
  }
178
208
 
179
- // There was inline filler rendered in the DOM but it's not
180
- // at the selection position any more, so we can remove it
181
- // (cause even if it's needed, it must be placed in another location).
182
- if ( this._inlineFiller && !this._isSelectionInInlineFiller() ) {
183
- this._removeInlineFiller();
184
- }
209
+ // Don't manipulate inline fillers while the selection is being made in (non-Android) Blink to prevent accidental
210
+ // DOM selection collapsing
211
+ // (https://github.com/ckeditor/ckeditor5/issues/10562, https://github.com/ckeditor/ckeditor5/issues/10723).
212
+ if ( isInlineFillerRenderingPossible ) {
213
+ // There was inline filler rendered in the DOM but it's not
214
+ // at the selection position any more, so we can remove it
215
+ // (cause even if it's needed, it must be placed in another location).
216
+ if ( this._inlineFiller && !this._isSelectionInInlineFiller() ) {
217
+ this._removeInlineFiller();
218
+ }
185
219
 
186
- // If we've got the filler, let's try to guess its position in the view.
187
- if ( this._inlineFiller ) {
188
- inlineFillerPosition = this._getInlineFillerPosition();
189
- }
190
- // Otherwise, if it's needed, create it at the selection position.
191
- else if ( this._needsInlineFillerAtSelection() ) {
192
- inlineFillerPosition = this.selection.getFirstPosition();
220
+ // If we've got the filler, let's try to guess its position in the view.
221
+ if ( this._inlineFiller ) {
222
+ inlineFillerPosition = this._getInlineFillerPosition();
223
+ }
224
+ // Otherwise, if it's needed, create it at the selection position.
225
+ else if ( this._needsInlineFillerAtSelection() ) {
226
+ inlineFillerPosition = this.selection.getFirstPosition();
193
227
 
194
- // Do not use `markToSync` so it will be added even if the parent is already added.
195
- this.markedChildren.add( inlineFillerPosition.parent );
228
+ // Do not use `markToSync` so it will be added even if the parent is already added.
229
+ this.markedChildren.add( inlineFillerPosition.parent );
230
+ }
231
+ }
232
+ // Paranoid check: we make sure the inline filler has any parent so it can be mapped to view position
233
+ // by DomConverter.
234
+ else if ( this._inlineFiller && this._inlineFiller.parentNode ) {
235
+ // While the user is making selection, preserve the inline filler at its original position.
236
+ inlineFillerPosition = this.domConverter.domPositionToView( this._inlineFiller );
196
237
  }
197
238
 
198
239
  for ( const element of this.markedAttributes ) {
@@ -209,26 +250,30 @@ export default class Renderer {
209
250
  }
210
251
  }
211
252
 
212
- // Check whether the inline filler is required and where it really is in the DOM.
213
- // At this point in most cases it will be in the DOM, but there are exceptions.
214
- // For example, if the inline filler was deep in the created DOM structure, it will not be created.
215
- // Similarly, if it was removed at the beginning of this function and then neither text nor children were updated,
216
- // it will not be present.
217
- // Fix those and similar scenarios.
218
- if ( inlineFillerPosition ) {
219
- const fillerDomPosition = this.domConverter.viewPositionToDom( inlineFillerPosition );
220
- const domDocument = fillerDomPosition.parent.ownerDocument;
221
-
222
- if ( !startsWithFiller( fillerDomPosition.parent ) ) {
223
- // Filler has not been created at filler position. Create it now.
224
- this._inlineFiller = addInlineFiller( domDocument, fillerDomPosition.parent, fillerDomPosition.offset );
253
+ // * Check whether the inline filler is required and where it really is in the DOM.
254
+ // At this point in most cases it will be in the DOM, but there are exceptions.
255
+ // For example, if the inline filler was deep in the created DOM structure, it will not be created.
256
+ // Similarly, if it was removed at the beginning of this function and then neither text nor children were updated,
257
+ // it will not be present. Fix those and similar scenarios.
258
+ // * Don't manipulate inline fillers while the selection is being made in (non-Android) Blink to prevent accidental
259
+ // DOM selection collapsing
260
+ // (https://github.com/ckeditor/ckeditor5/issues/10562, https://github.com/ckeditor/ckeditor5/issues/10723).
261
+ if ( isInlineFillerRenderingPossible ) {
262
+ if ( inlineFillerPosition ) {
263
+ const fillerDomPosition = this.domConverter.viewPositionToDom( inlineFillerPosition );
264
+ const domDocument = fillerDomPosition.parent.ownerDocument;
265
+
266
+ if ( !startsWithFiller( fillerDomPosition.parent ) ) {
267
+ // Filler has not been created at filler position. Create it now.
268
+ this._inlineFiller = addInlineFiller( domDocument, fillerDomPosition.parent, fillerDomPosition.offset );
269
+ } else {
270
+ // Filler has been found, save it.
271
+ this._inlineFiller = fillerDomPosition.parent;
272
+ }
225
273
  } else {
226
- // Filler has been found, save it.
227
- this._inlineFiller = fillerDomPosition.parent;
274
+ // There is no filler needed.
275
+ this._inlineFiller = null;
228
276
  }
229
- } else {
230
- // There is no filler needed.
231
- this._inlineFiller = null;
232
277
  }
233
278
 
234
279
  // First focus the new editing host, then update the selection.
@@ -401,7 +446,7 @@ export default class Renderer {
401
446
  }
402
447
 
403
448
  if ( isInlineFiller( domFillerNode ) ) {
404
- domFillerNode.parentNode.removeChild( domFillerNode );
449
+ domFillerNode.remove();
405
450
  } else {
406
451
  domFillerNode.data = domFillerNode.data.substr( INLINE_FILLER_LENGTH );
407
452
  }
@@ -511,13 +556,14 @@ export default class Renderer {
511
556
 
512
557
  // Add or overwrite attributes.
513
558
  for ( const key of viewAttrKeys ) {
514
- domElement.setAttribute( key, viewElement.getAttribute( key ) );
559
+ this.domConverter.setDomElementAttribute( domElement, key, viewElement.getAttribute( key ), viewElement );
515
560
  }
516
561
 
517
562
  // Remove from DOM attributes which do not exists in the view.
518
563
  for ( const key of domAttrKeys ) {
564
+ // All other attributes not present in the DOM should be removed.
519
565
  if ( !viewElement.hasAttribute( key ) ) {
520
- domElement.removeAttribute( key );
566
+ this.domConverter.removeDomElementAttribute( domElement, key );
521
567
  }
522
568
  }
523
569
  }
@@ -543,7 +589,7 @@ export default class Renderer {
543
589
  const inlineFillerPosition = options.inlineFillerPosition;
544
590
  const actualDomChildren = this.domConverter.mapViewToDom( viewElement ).childNodes;
545
591
  const expectedDomChildren = Array.from(
546
- this.domConverter.viewChildrenToDom( viewElement, domElement.ownerDocument, { bind: true, inlineFillerPosition } )
592
+ this.domConverter.viewChildrenToDom( viewElement, domElement.ownerDocument, { bind: true } )
547
593
  );
548
594
 
549
595
  // Inline filler element has to be created as it is present in the DOM, but not in the view. It is required
@@ -684,6 +730,14 @@ export default class Renderer {
684
730
  * @private
685
731
  */
686
732
  _updateSelection() {
733
+ // Block updating DOM selection in (non-Android) Blink while the user is selecting to prevent accidental selection collapsing.
734
+ // Note: Structural changes in DOM must trigger selection rendering, though. Nodes the selection was anchored
735
+ // to, may disappear in DOM which would break the selection (e.g. in real-time collaboration scenarios).
736
+ // https://github.com/ckeditor/ckeditor5/issues/10562, https://github.com/ckeditor/ckeditor5/issues/10723
737
+ if ( env.isBlink && !env.isAndroid && this.isSelecting && !this.markedChildren.size ) {
738
+ return;
739
+ }
740
+
687
741
  // If there is no selection - remove DOM and fake selections.
688
742
  if ( this.selection.rangeCount === 0 ) {
689
743
  this._removeDomSelection();
@@ -936,7 +990,7 @@ function addInlineFiller( domDocument, domParentOrArray, offset ) {
936
990
  function areSimilar( node1, node2 ) {
937
991
  return isNode( node1 ) && isNode( node2 ) &&
938
992
  !isText( node1 ) && !isText( node2 ) &&
939
- node1.nodeType !== Node.COMMENT_NODE && node2.nodeType !== Node.COMMENT_NODE &&
993
+ !isComment( node1 ) && !isComment( node2 ) &&
940
994
  node1.tagName.toLowerCase() === node2.tagName.toLowerCase();
941
995
  }
942
996
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -36,6 +36,11 @@ const COLOR_NAMES = new Set( [
36
36
  'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon',
37
37
  'sandybrown', 'seagreen', 'seashell', 'sienna', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow',
38
38
  'springgreen', 'steelblue', 'tan', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'whitesmoke', 'yellowgreen',
39
+ // CSS Color Module Level 3 (System Colors)
40
+ 'activeborder', 'activecaption', 'appworkspace', 'background', 'buttonface', 'buttonhighlight', 'buttonshadow',
41
+ 'buttontext', 'captiontext', 'graytext', 'highlight', 'highlighttext', 'inactiveborder', 'inactivecaption',
42
+ 'inactivecaptiontext', 'infobackground', 'infotext', 'menu', 'menutext', 'scrollbar', 'threeddarkshadow',
43
+ 'threedface', 'threedhighlight', 'threedlightshadow', 'threedshadow', 'window', 'windowframe', 'windowtext',
39
44
  // CSS Color Module Level 4
40
45
  'rebeccapurple',
41
46
  // Keywords
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
package/src/view/text.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -126,9 +126,10 @@ export default class UIElement extends Element {
126
126
  * Do not use inheritance to create custom rendering method, replace `render()` method instead:
127
127
  *
128
128
  * const myUIElement = downcastWriter.createUIElement( 'span' );
129
- * myUIElement.render = function( domDocument ) {
129
+ * myUIElement.render = function( domDocument, domConverter ) {
130
130
  * const domElement = this.toDomElement( domDocument );
131
- * domElement.innerHTML = '<b>this is ui element</b>';
131
+ *
132
+ * domConverter.setContentOf( domElement, '<b>this is ui element</b>' );
132
133
  *
133
134
  * return domElement;
134
135
  * };
@@ -138,9 +139,11 @@ export default class UIElement extends Element {
138
139
  * after rendering your UI element.
139
140
  *
140
141
  * @param {Document} domDocument
142
+ * @param {module:engine/view/domconverter~DomConverter} domConverter Instance of the DomConverter used to optimize the output.
141
143
  * @returns {HTMLElement}
142
144
  */
143
145
  render( domDocument ) {
146
+ // Provide basic, default output.
144
147
  return this.toDomElement( domDocument );
145
148
  }
146
149
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
package/src/view/view.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
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
5
 
@@ -116,7 +116,7 @@ export default class View {
116
116
  * @type {module:engine/view/renderer~Renderer}
117
117
  */
118
118
  this._renderer = new Renderer( this.domConverter, this.document.selection );
119
- this._renderer.bind( 'isFocused' ).to( this.document );
119
+ this._renderer.bind( 'isFocused', 'isSelecting' ).to( this.document );
120
120
 
121
121
  /**
122
122
  * A DOM root attributes cache. It saves the initial values of DOM root attributes before the DOM element
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
2
+ * 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
5
 
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /* Elements marked by the Renderer as hidden should be invisible in the editor. */
7
+ .ck.ck-editor__editable span[data-ck-unsafe-element] {
8
+ display: none;
9
+ }