@ckeditor/ckeditor5-engine 34.1.0 → 34.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-engine",
3
- "version": "34.1.0",
3
+ "version": "34.2.0",
4
4
  "description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.",
5
5
  "keywords": [
6
6
  "wysiwyg",
@@ -23,30 +23,30 @@
23
23
  ],
24
24
  "main": "src/index.js",
25
25
  "dependencies": {
26
- "@ckeditor/ckeditor5-utils": "^34.1.0",
26
+ "@ckeditor/ckeditor5-utils": "^34.2.0",
27
27
  "lodash-es": "^4.17.15"
28
28
  },
29
29
  "devDependencies": {
30
- "@ckeditor/ckeditor5-basic-styles": "^34.1.0",
31
- "@ckeditor/ckeditor5-block-quote": "^34.1.0",
32
- "@ckeditor/ckeditor5-clipboard": "^34.1.0",
33
- "@ckeditor/ckeditor5-cloud-services": "^34.1.0",
34
- "@ckeditor/ckeditor5-core": "^34.1.0",
35
- "@ckeditor/ckeditor5-editor-classic": "^34.1.0",
36
- "@ckeditor/ckeditor5-enter": "^34.1.0",
37
- "@ckeditor/ckeditor5-essentials": "^34.1.0",
38
- "@ckeditor/ckeditor5-heading": "^34.1.0",
39
- "@ckeditor/ckeditor5-image": "^34.1.0",
40
- "@ckeditor/ckeditor5-link": "^34.1.0",
41
- "@ckeditor/ckeditor5-list": "^34.1.0",
42
- "@ckeditor/ckeditor5-mention": "^34.1.0",
43
- "@ckeditor/ckeditor5-paragraph": "^34.1.0",
44
- "@ckeditor/ckeditor5-table": "^34.1.0",
45
- "@ckeditor/ckeditor5-theme-lark": "^34.1.0",
46
- "@ckeditor/ckeditor5-typing": "^34.1.0",
47
- "@ckeditor/ckeditor5-ui": "^34.1.0",
48
- "@ckeditor/ckeditor5-undo": "^34.1.0",
49
- "@ckeditor/ckeditor5-widget": "^34.1.0",
30
+ "@ckeditor/ckeditor5-basic-styles": "^34.2.0",
31
+ "@ckeditor/ckeditor5-block-quote": "^34.2.0",
32
+ "@ckeditor/ckeditor5-clipboard": "^34.2.0",
33
+ "@ckeditor/ckeditor5-cloud-services": "^34.2.0",
34
+ "@ckeditor/ckeditor5-core": "^34.2.0",
35
+ "@ckeditor/ckeditor5-editor-classic": "^34.2.0",
36
+ "@ckeditor/ckeditor5-enter": "^34.2.0",
37
+ "@ckeditor/ckeditor5-essentials": "^34.2.0",
38
+ "@ckeditor/ckeditor5-heading": "^34.2.0",
39
+ "@ckeditor/ckeditor5-image": "^34.2.0",
40
+ "@ckeditor/ckeditor5-link": "^34.2.0",
41
+ "@ckeditor/ckeditor5-list": "^34.2.0",
42
+ "@ckeditor/ckeditor5-mention": "^34.2.0",
43
+ "@ckeditor/ckeditor5-paragraph": "^34.2.0",
44
+ "@ckeditor/ckeditor5-table": "^34.2.0",
45
+ "@ckeditor/ckeditor5-theme-lark": "^34.2.0",
46
+ "@ckeditor/ckeditor5-typing": "^34.2.0",
47
+ "@ckeditor/ckeditor5-ui": "^34.2.0",
48
+ "@ckeditor/ckeditor5-undo": "^34.2.0",
49
+ "@ckeditor/ckeditor5-widget": "^34.2.0",
50
50
  "webpack": "^5.58.1",
51
51
  "webpack-cli": "^4.9.0"
52
52
  },
@@ -465,6 +465,11 @@ export function convertText() {
465
465
  return;
466
466
  }
467
467
 
468
+ // Do not auto-paragraph whitespaces.
469
+ if ( data.viewItem.data.trim().length == 0 ) {
470
+ return;
471
+ }
472
+
468
473
  position = wrapInParagraph( position, writer );
469
474
  }
470
475
 
@@ -35,7 +35,6 @@ const NBSP_FILLER_REF = NBSP_FILLER( document ); // eslint-disable-line new-cap
35
35
  const MARKED_NBSP_FILLER_REF = MARKED_NBSP_FILLER( document ); // eslint-disable-line new-cap
36
36
  const UNSAFE_ATTRIBUTE_NAME_PREFIX = 'data-ck-unsafe-attribute-';
37
37
  const UNSAFE_ELEMENT_REPLACEMENT_ATTRIBUTE = 'data-ck-unsafe-element';
38
- const UNSAFE_ELEMENTS = [ 'script', 'style' ];
39
38
 
40
39
  /**
41
40
  * `DomConverter` is a set of tools to do transformations between DOM nodes and view nodes. It also handles
@@ -127,6 +126,15 @@ export default class DomConverter {
127
126
  'object', 'iframe', 'input', 'button', 'textarea', 'select', 'option', 'video', 'embed', 'audio', 'img', 'canvas'
128
127
  ];
129
128
 
129
+ /**
130
+ * A list of elements which may affect the editing experience. To avoid this, those elements are replaced with
131
+ * `<span data-ck-unsafe-element="[element name]"></span>` while rendering in the editing mode.
132
+ *
133
+ * @readonly
134
+ * @member {Array.<String>} module:engine/view/domconverter~DomConverter#unsafeElements
135
+ */
136
+ this.unsafeElements = [ 'script', 'style' ];
137
+
130
138
  /**
131
139
  * The DOM-to-view mapping.
132
140
  *
@@ -672,7 +680,7 @@ export default class DomConverter {
672
680
  const attrs = domNode.attributes;
673
681
 
674
682
  if ( attrs ) {
675
- for ( let i = attrs.length - 1; i >= 0; i-- ) {
683
+ for ( let l = attrs.length, i = 0; i < l; i++ ) {
676
684
  viewElement._setAttribute( attrs[ i ].name, attrs[ i ].value );
677
685
  }
678
686
  }
@@ -1564,7 +1572,7 @@ export default class DomConverter {
1564
1572
  _shouldRenameElement( elementName ) {
1565
1573
  const name = elementName.toLowerCase();
1566
1574
 
1567
- return this.renderingMode === 'editing' && UNSAFE_ELEMENTS.includes( name );
1575
+ return this.renderingMode === 'editing' && this.unsafeElements.includes( name );
1568
1576
  }
1569
1577
 
1570
1578
  /**
@@ -608,6 +608,9 @@ export default class Element extends Node {
608
608
  // is changed by e.g. toWidget() function from ckeditor5-widget. Perhaps this should be one of custom props.
609
609
  cloned.getFillerOffset = this.getFillerOffset;
610
610
 
611
+ // Clone unsafe attributes list.
612
+ cloned._unsafeAttributesToRender = this._unsafeAttributesToRender;
613
+
611
614
  return cloned;
612
615
  }
613
616
 
@@ -56,7 +56,7 @@ export const NBSP_FILLER = domDocument => domDocument.createTextNode( '\u00A0' )
56
56
  export const MARKED_NBSP_FILLER = domDocument => {
57
57
  const span = domDocument.createElement( 'span' );
58
58
  span.dataset.ckeFiller = true;
59
- span.innerHTML = '\u00A0';
59
+ span.innerText = '\u00A0';
60
60
 
61
61
  return span;
62
62
  };
@@ -234,6 +234,10 @@ export default class Renderer {
234
234
  else if ( this._inlineFiller && this._inlineFiller.parentNode ) {
235
235
  // While the user is making selection, preserve the inline filler at its original position.
236
236
  inlineFillerPosition = this.domConverter.domPositionToView( this._inlineFiller );
237
+
238
+ if ( inlineFillerPosition.parent.is( '$text' ) ) {
239
+ inlineFillerPosition = ViewPosition._createBefore( inlineFillerPosition.parent );
240
+ }
237
241
  }
238
242
 
239
243
  for ( const element of this.markedAttributes ) {