@limetech/lime-elements 39.44.2 → 39.44.4

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.
@@ -179,8 +179,11 @@ function findDiffStart(a, b, pos) {
179
179
  if (!childA.sameMarkup(childB))
180
180
  return pos;
181
181
  if (childA.isText && childA.text != childB.text) {
182
- for (let j = 0; childA.text[j] == childB.text[j]; j++)
182
+ let tA = childA.text, tB = childB.text, j = 0;
183
+ for (; tA[j] == tB[j]; j++)
183
184
  pos++;
185
+ if (j && j < tA.length && j < tB.length && surrogateHigh(tA.charCodeAt(j - 1)) && surrogateLow(tA.charCodeAt(j)))
186
+ pos--;
184
187
  return pos;
185
188
  }
186
189
  if (childA.content.size || childB.content.size) {
@@ -204,12 +207,17 @@ function findDiffEnd(a, b, posA, posB) {
204
207
  if (!childA.sameMarkup(childB))
205
208
  return { a: posA, b: posB };
206
209
  if (childA.isText && childA.text != childB.text) {
207
- let same = 0, minSize = Math.min(childA.text.length, childB.text.length);
208
- while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {
209
- same++;
210
+ let tA = childA.text, tB = childB.text, iA = tA.length, iB = tB.length;
211
+ while (iA > 0 && iB > 0 && tA[iA - 1] == tB[iB - 1]) {
212
+ iA--;
213
+ iB--;
210
214
  posA--;
211
215
  posB--;
212
216
  }
217
+ if (iA && iB && iA < tA.length && surrogateHigh(tA.charCodeAt(iA - 1)) && surrogateLow(tA.charCodeAt(iA))) {
218
+ posA++;
219
+ posB++;
220
+ }
213
221
  return { a: posA, b: posB };
214
222
  }
215
223
  if (childA.content.size || childB.content.size) {
@@ -221,6 +229,8 @@ function findDiffEnd(a, b, posA, posB) {
221
229
  posB -= size;
222
230
  }
223
231
  }
232
+ function surrogateLow(ch) { return ch >= 0xDC00 && ch < 0xE000; }
233
+ function surrogateHigh(ch) { return ch >= 0xD800 && ch < 0xDC00; }
224
234
 
225
235
  /**
226
236
  A fragment represents a node's collection of child nodes.
@@ -901,7 +911,8 @@ function addRange($start, $end, depth, target) {
901
911
  addNode($end.nodeBefore, target);
902
912
  }
903
913
  function close(node, content) {
904
- node.type.checkContent(content);
914
+ if (!node.type.validContent(content))
915
+ throw new ReplaceError("Invalid content for node " + node.type.name);
905
916
  return node.copy(content);
906
917
  }
907
918
  function replaceThreeWay($from, $start, $end, $to, depth) {
@@ -2212,13 +2223,12 @@ function computeAttrs(attrs, value) {
2212
2223
  return built;
2213
2224
  }
2214
2225
  function checkAttrs(attrs, values, type, name) {
2215
- for (let name in values)
2216
- if (!(name in attrs))
2217
- throw new RangeError(`Unsupported attribute ${name} for ${type} of type ${name}`);
2218
- for (let name in attrs) {
2219
- let attr = attrs[name];
2220
- if (attr.validate)
2221
- attr.validate(values[name]);
2226
+ for (let attr in values)
2227
+ if (!(attr in attrs))
2228
+ throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
2229
+ for (let attr in attrs) {
2230
+ if (attrs[attr].validate)
2231
+ attrs[attr].validate(values[attr]);
2222
2232
  }
2223
2233
  }
2224
2234
  function initAttrs(typeName, attrs) {
@@ -2395,7 +2405,7 @@ let NodeType$1 = class NodeType {
2395
2405
  @internal
2396
2406
  */
2397
2407
  checkAttrs(attrs) {
2398
- checkAttrs(this.attrs, attrs, "node");
2408
+ checkAttrs(this.attrs, attrs, "node", this.name);
2399
2409
  }
2400
2410
  /**
2401
2411
  Check whether the given mark type is allowed in this node.
@@ -2546,7 +2556,7 @@ class MarkType {
2546
2556
  @internal
2547
2557
  */
2548
2558
  checkAttrs(attrs) {
2549
- checkAttrs(this.attrs, attrs, "mark");
2559
+ checkAttrs(this.attrs, attrs, "mark", this.name);
2550
2560
  }
2551
2561
  /**
2552
2562
  Queries whether a given mark type is
@@ -2838,7 +2848,7 @@ class DOMParser {
2838
2848
  }
2839
2849
  }
2840
2850
  const blockTags = {
2841
- address: true, article: true, aside: true, blockquote: true, canvas: true,
2851
+ address: true, article: true, aside: true, blockquote: true, body: true, canvas: true,
2842
2852
  dd: true, div: true, dl: true, fieldset: true, figcaption: true, figure: true,
2843
2853
  footer: true, form: true, h1: true, h2: true, h3: true, h4: true, h5: true,
2844
2854
  h6: true, header: true, hgroup: true, hr: true, li: true, noscript: true, ol: true,
@@ -22458,7 +22468,8 @@ const defaultMarkdownSerializer = new MarkdownSerializer({
22458
22468
  state.renderList(node, " ", () => (node.attrs.bullet || "*") + " ");
22459
22469
  },
22460
22470
  ordered_list(state, node) {
22461
- let start = node.attrs.order || 1;
22471
+ var _a;
22472
+ let start = (_a = node.attrs.order) !== null && _a !== void 0 ? _a : 1;
22462
22473
  let maxW = String(start + node.childCount - 1).length;
22463
22474
  let space = state.repeat(" ", maxW + 2);
22464
22475
  state.renderList(node, space, i => {