@ckeditor/ckeditor5-engine 43.0.0-alpha.6 → 43.1.0-alpha.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": "43.0.0-alpha.6",
3
+ "version": "43.1.0-alpha.0",
4
4
  "description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.",
5
5
  "keywords": [
6
6
  "wysiwyg",
@@ -24,7 +24,7 @@
24
24
  "type": "module",
25
25
  "main": "src/index.js",
26
26
  "dependencies": {
27
- "@ckeditor/ckeditor5-utils": "43.0.0-alpha.6",
27
+ "@ckeditor/ckeditor5-utils": "43.1.0-alpha.0",
28
28
  "lodash-es": "4.17.21"
29
29
  },
30
30
  "author": "CKSource (http://cksource.com/)",
@@ -1248,7 +1248,18 @@ function _generateDiffInstructionsFromChanges(oldChildrenLength, changes) {
1248
1248
  oldChildrenHandled += change.howMany;
1249
1249
  }
1250
1250
  else {
1251
- diff.push(...'a'.repeat(change.howMany).split(''));
1251
+ // Total maximum amount of arguments that can be passed to `Array.prototype.push` may be limited so we need to
1252
+ // add them manually one by one to avoid this limit. However loop might be a bit slower than `push` method on
1253
+ // smaller changesets so we need to decide which method to use based on the size of the change.
1254
+ // See: https://github.com/ckeditor/ckeditor5/issues/16819
1255
+ if (change.howMany > 1500) {
1256
+ for (let i = 0; i < change.howMany; i++) {
1257
+ diff.push('a');
1258
+ }
1259
+ }
1260
+ else {
1261
+ diff.push(...'a'.repeat(change.howMany).split(''));
1262
+ }
1252
1263
  // The last handled offset is at the position after the changed range.
1253
1264
  offset = change.offset + change.howMany;
1254
1265
  // We changed `howMany` old nodes, update `oldChildrenHandled`.
package/src/view/view.js CHANGED
@@ -189,7 +189,12 @@ export default class View extends /* #__PURE__ */ ObservableMixin() {
189
189
  this._writer.addClass(value.split(' '), viewRoot);
190
190
  }
191
191
  else {
192
- this._writer.setAttribute(name, value, viewRoot);
192
+ // There is a chance that some attributes have already been set on the view root before attaching
193
+ // the DOM root and should be preserved. This is a similar case to the "class" attribute except
194
+ // this time there is no workaround using a some low-level API.
195
+ if (!viewRoot.hasAttribute(name)) {
196
+ this._writer.setAttribute(name, value, viewRoot);
197
+ }
193
198
  }
194
199
  }
195
200
  this._initialDomRootAttributes.set(domRoot, initialDomRootAttributes);