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