avo 3.20.3 → 3.21.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.
@@ -138486,14 +138486,8 @@
138486
138486
  this.content = content || Fragment.empty;
138487
138487
  }
138488
138488
  /**
138489
- The array of this node's child nodes.
138490
- */
138491
- get children() {
138492
- return this.content.content;
138493
- }
138494
- /**
138495
138489
  The size of this node, as defined by the integer-based [indexing
138496
- scheme](https://prosemirror.net/docs/guide/#doc.indexing). For text nodes, this is the
138490
+ scheme](/docs/guide/#doc.indexing). For text nodes, this is the
138497
138491
  amount of characters. For other leaf nodes, it is one. For
138498
138492
  non-leaf nodes, it is the size of the content plus two (the
138499
138493
  start and end token).
@@ -139178,7 +139172,7 @@
139178
139172
  let result = [];
139179
139173
  for (let typeName in types) {
139180
139174
  let type2 = types[typeName];
139181
- if (type2.isInGroup(name))
139175
+ if (type2.groups.indexOf(name) > -1)
139182
139176
  result.push(type2);
139183
139177
  }
139184
139178
  if (result.length == 0)
@@ -139416,13 +139410,6 @@
139416
139410
  return this.isLeaf || !!this.spec.atom;
139417
139411
  }
139418
139412
  /**
139419
- Return true when this node type is part of the given
139420
- [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).
139421
- */
139422
- isInGroup(group) {
139423
- return this.groups.indexOf(group) > -1;
139424
- }
139425
- /**
139426
139413
  The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.
139427
139414
  */
139428
139415
  get whitespace() {
@@ -139810,7 +139797,7 @@
139810
139797
  */
139811
139798
  parse(dom, options = {}) {
139812
139799
  let context = new ParseContext(this, options, false);
139813
- context.addAll(dom, Mark.none, options.from, options.to);
139800
+ context.addAll(dom, options.from, options.to);
139814
139801
  return context.finish();
139815
139802
  }
139816
139803
  /**
@@ -139823,7 +139810,7 @@
139823
139810
  */
139824
139811
  parseSlice(dom, options = {}) {
139825
139812
  let context = new ParseContext(this, options, true);
139826
- context.addAll(dom, Mark.none, options.from, options.to);
139813
+ context.addAll(dom, options.from, options.to);
139827
139814
  return Slice.maxOpen(context.finish());
139828
139815
  }
139829
139816
  /**
@@ -139958,14 +139945,16 @@
139958
139945
  return type && type.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base2 & ~OPT_OPEN_LEFT;
139959
139946
  }
139960
139947
  var NodeContext = class {
139961
- constructor(type, attrs, marks, solid, match3, options) {
139948
+ constructor(type, attrs, marks, pendingMarks, solid, match3, options) {
139962
139949
  this.type = type;
139963
139950
  this.attrs = attrs;
139964
139951
  this.marks = marks;
139952
+ this.pendingMarks = pendingMarks;
139965
139953
  this.solid = solid;
139966
139954
  this.options = options;
139967
139955
  this.content = [];
139968
139956
  this.activeMarks = Mark.none;
139957
+ this.stashMarks = [];
139969
139958
  this.match = match3 || (options & OPT_OPEN_LEFT ? null : type.contentMatch);
139970
139959
  }
139971
139960
  findWrapping(node) {
@@ -140003,6 +139992,20 @@
140003
139992
  content = content.append(this.match.fillBefore(Fragment.empty, true));
140004
139993
  return this.type ? this.type.create(this.attrs, content, this.marks) : content;
140005
139994
  }
139995
+ popFromStashMark(mark) {
139996
+ for (let i5 = this.stashMarks.length - 1; i5 >= 0; i5--)
139997
+ if (mark.eq(this.stashMarks[i5]))
139998
+ return this.stashMarks.splice(i5, 1)[0];
139999
+ }
140000
+ applyPending(nextType) {
140001
+ for (let i5 = 0, pending = this.pendingMarks; i5 < pending.length; i5++) {
140002
+ let mark = pending[i5];
140003
+ if ((this.type ? this.type.allowsMarkType(mark.type) : markMayApply(mark.type, nextType)) && !mark.isInSet(this.activeMarks)) {
140004
+ this.activeMarks = mark.addToSet(this.activeMarks);
140005
+ this.pendingMarks = mark.removeFromSet(this.pendingMarks);
140006
+ }
140007
+ }
140008
+ }
140006
140009
  inlineContext(node) {
140007
140010
  if (this.type)
140008
140011
  return this.type.inlineContent;
@@ -140017,15 +140020,14 @@
140017
140020
  this.options = options;
140018
140021
  this.isOpen = isOpen;
140019
140022
  this.open = 0;
140020
- this.localPreserveWS = false;
140021
140023
  let topNode = options.topNode, topContext;
140022
140024
  let topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0);
140023
140025
  if (topNode)
140024
- topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, true, options.topMatch || topNode.type.contentMatch, topOptions);
140026
+ topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, Mark.none, true, options.topMatch || topNode.type.contentMatch, topOptions);
140025
140027
  else if (isOpen)
140026
- topContext = new NodeContext(null, null, Mark.none, true, null, topOptions);
140028
+ topContext = new NodeContext(null, null, Mark.none, Mark.none, true, null, topOptions);
140027
140029
  else
140028
- topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, true, null, topOptions);
140030
+ topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, Mark.none, true, null, topOptions);
140029
140031
  this.nodes = [topContext];
140030
140032
  this.find = options.findPositions;
140031
140033
  this.needsBlock = false;
@@ -140036,17 +140038,35 @@
140036
140038
  // Add a DOM node to the content. Text is inserted as text node,
140037
140039
  // otherwise, the node is passed to `addElement` or, if it has a
140038
140040
  // `style` attribute, `addElementWithStyles`.
140039
- addDOM(dom, marks) {
140041
+ addDOM(dom) {
140040
140042
  if (dom.nodeType == 3)
140041
- this.addTextNode(dom, marks);
140043
+ this.addTextNode(dom);
140042
140044
  else if (dom.nodeType == 1)
140043
- this.addElement(dom, marks);
140044
- }
140045
- addTextNode(dom, marks) {
140045
+ this.addElement(dom);
140046
+ }
140047
+ withStyleRules(dom, f4) {
140048
+ let style2 = dom.style;
140049
+ if (!style2 || !style2.length)
140050
+ return f4();
140051
+ let marks = this.readStyles(dom.style);
140052
+ if (!marks)
140053
+ return;
140054
+ let [addMarks, removeMarks] = marks, top2 = this.top;
140055
+ for (let i5 = 0; i5 < removeMarks.length; i5++)
140056
+ this.removePendingMark(removeMarks[i5], top2);
140057
+ for (let i5 = 0; i5 < addMarks.length; i5++)
140058
+ this.addPendingMark(addMarks[i5]);
140059
+ f4();
140060
+ for (let i5 = 0; i5 < addMarks.length; i5++)
140061
+ this.removePendingMark(addMarks[i5], top2);
140062
+ for (let i5 = 0; i5 < removeMarks.length; i5++)
140063
+ this.addPendingMark(removeMarks[i5]);
140064
+ }
140065
+ addTextNode(dom) {
140046
140066
  let value = dom.nodeValue;
140047
- let top2 = this.top, preserveWS = top2.options & OPT_PRESERVE_WS_FULL ? "full" : this.localPreserveWS || (top2.options & OPT_PRESERVE_WS) > 0;
140048
- if (preserveWS === "full" || top2.inlineContext(dom) || /[^ \t\r\n\u000c]/.test(value)) {
140049
- if (!preserveWS) {
140067
+ let top2 = this.top;
140068
+ if (top2.options & OPT_PRESERVE_WS_FULL || top2.inlineContext(dom) || /[^ \t\r\n\u000c]/.test(value)) {
140069
+ if (!(top2.options & OPT_PRESERVE_WS)) {
140050
140070
  value = value.replace(/[ \t\r\n\u000c]+/g, " ");
140051
140071
  if (/^[ \t\r\n\u000c]/.test(value) && this.open == this.nodes.length - 1) {
140052
140072
  let nodeBefore = top2.content[top2.content.length - 1];
@@ -140054,13 +140074,13 @@
140054
140074
  if (!nodeBefore || domNodeBefore && domNodeBefore.nodeName == "BR" || nodeBefore.isText && /[ \t\r\n\u000c]$/.test(nodeBefore.text))
140055
140075
  value = value.slice(1);
140056
140076
  }
140057
- } else if (preserveWS !== "full") {
140077
+ } else if (!(top2.options & OPT_PRESERVE_WS_FULL)) {
140058
140078
  value = value.replace(/\r?\n|\r/g, " ");
140059
140079
  } else {
140060
140080
  value = value.replace(/\r\n?/g, "\n");
140061
140081
  }
140062
140082
  if (value)
140063
- this.insertNode(this.parser.schema.text(value), marks);
140083
+ this.insertNode(this.parser.schema.text(value));
140064
140084
  this.findInText(dom);
140065
140085
  } else {
140066
140086
  this.findInside(dom);
@@ -140068,23 +140088,20 @@
140068
140088
  }
140069
140089
  // Try to find a handler for the given tag and use that to parse. If
140070
140090
  // none is found, the element's content nodes are added directly.
140071
- addElement(dom, marks, matchAfter) {
140072
- let outerWS = this.localPreserveWS, top2 = this.top;
140073
- if (dom.tagName == "PRE" || /pre/.test(dom.style && dom.style.whiteSpace))
140074
- this.localPreserveWS = true;
140091
+ addElement(dom, matchAfter) {
140075
140092
  let name = dom.nodeName.toLowerCase(), ruleID;
140076
140093
  if (listTags.hasOwnProperty(name) && this.parser.normalizeLists)
140077
140094
  normalizeList(dom);
140078
140095
  let rule = this.options.ruleFromNode && this.options.ruleFromNode(dom) || (ruleID = this.parser.matchTag(dom, this, matchAfter));
140079
- out: if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {
140096
+ if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {
140080
140097
  this.findInside(dom);
140081
- this.ignoreFallback(dom, marks);
140098
+ this.ignoreFallback(dom);
140082
140099
  } else if (!rule || rule.skip || rule.closeParent) {
140083
140100
  if (rule && rule.closeParent)
140084
140101
  this.open = Math.max(0, this.open - 1);
140085
140102
  else if (rule && rule.skip.nodeType)
140086
140103
  dom = rule.skip;
140087
- let sync, oldNeedsBlock = this.needsBlock;
140104
+ let sync, top2 = this.top, oldNeedsBlock = this.needsBlock;
140088
140105
  if (blockTags.hasOwnProperty(name)) {
140089
140106
  if (top2.content.length && top2.content[0].isInline && this.open) {
140090
140107
  this.open--;
@@ -140094,38 +140111,38 @@
140094
140111
  if (!top2.type)
140095
140112
  this.needsBlock = true;
140096
140113
  } else if (!dom.firstChild) {
140097
- this.leafFallback(dom, marks);
140098
- break out;
140114
+ this.leafFallback(dom);
140115
+ return;
140099
140116
  }
140100
- let innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);
140101
- if (innerMarks)
140102
- this.addAll(dom, innerMarks);
140117
+ if (rule && rule.skip)
140118
+ this.addAll(dom);
140119
+ else
140120
+ this.withStyleRules(dom, () => this.addAll(dom));
140103
140121
  if (sync)
140104
140122
  this.sync(top2);
140105
140123
  this.needsBlock = oldNeedsBlock;
140106
140124
  } else {
140107
- let innerMarks = this.readStyles(dom, marks);
140108
- if (innerMarks)
140109
- this.addElementByRule(dom, rule, innerMarks, rule.consuming === false ? ruleID : void 0);
140125
+ this.withStyleRules(dom, () => {
140126
+ this.addElementByRule(dom, rule, rule.consuming === false ? ruleID : void 0);
140127
+ });
140110
140128
  }
140111
- this.localPreserveWS = outerWS;
140112
140129
  }
140113
140130
  // Called for leaf DOM nodes that would otherwise be ignored
140114
- leafFallback(dom, marks) {
140131
+ leafFallback(dom) {
140115
140132
  if (dom.nodeName == "BR" && this.top.type && this.top.type.inlineContent)
140116
- this.addTextNode(dom.ownerDocument.createTextNode("\n"), marks);
140133
+ this.addTextNode(dom.ownerDocument.createTextNode("\n"));
140117
140134
  }
140118
140135
  // Called for ignored nodes
140119
- ignoreFallback(dom, marks) {
140136
+ ignoreFallback(dom) {
140120
140137
  if (dom.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent))
140121
- this.findPlace(this.parser.schema.text("-"), marks);
140138
+ this.findPlace(this.parser.schema.text("-"));
140122
140139
  }
140123
140140
  // Run any style parser associated with the node's styles. Either
140124
- // return an updated array of marks, or null to indicate some of the
140125
- // styles had a rule with `ignore` set.
140126
- readStyles(dom, marks) {
140127
- let styles = dom.style;
140128
- if (styles && styles.length)
140141
+ // return an array of marks, or null to indicate some of the styles
140142
+ // had a rule with `ignore` set.
140143
+ readStyles(styles) {
140144
+ let add2 = Mark.none, remove = Mark.none;
140145
+ if (styles.length)
140129
140146
  for (let i5 = 0; i5 < this.parser.matchedStyles.length; i5++) {
140130
140147
  let name = this.parser.matchedStyles[i5], value = styles.getPropertyValue(name);
140131
140148
  if (value)
@@ -140135,46 +140152,47 @@
140135
140152
  break;
140136
140153
  if (rule.ignore)
140137
140154
  return null;
140138
- if (rule.clearMark)
140139
- marks = marks.filter((m4) => !rule.clearMark(m4));
140140
- else
140141
- marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));
140155
+ if (rule.clearMark) {
140156
+ this.top.pendingMarks.concat(this.top.activeMarks).forEach((m4) => {
140157
+ if (rule.clearMark(m4))
140158
+ remove = m4.addToSet(remove);
140159
+ });
140160
+ } else {
140161
+ add2 = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add2);
140162
+ }
140142
140163
  if (rule.consuming === false)
140143
140164
  after = rule;
140144
140165
  else
140145
140166
  break;
140146
140167
  }
140147
140168
  }
140148
- return marks;
140169
+ return [add2, remove];
140149
140170
  }
140150
140171
  // Look up a handler for the given node. If none are found, return
140151
140172
  // false. Otherwise, apply it, use its return value to drive the way
140152
140173
  // the node's content is wrapped, and return true.
140153
- addElementByRule(dom, rule, marks, continueAfter) {
140154
- let sync, nodeType;
140174
+ addElementByRule(dom, rule, continueAfter) {
140175
+ let sync, nodeType, mark;
140155
140176
  if (rule.node) {
140156
140177
  nodeType = this.parser.schema.nodes[rule.node];
140157
140178
  if (!nodeType.isLeaf) {
140158
- let inner = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);
140159
- if (inner) {
140160
- sync = true;
140161
- marks = inner;
140162
- }
140163
- } else if (!this.insertNode(nodeType.create(rule.attrs), marks)) {
140164
- this.leafFallback(dom, marks);
140179
+ sync = this.enter(nodeType, rule.attrs || null, rule.preserveWhitespace);
140180
+ } else if (!this.insertNode(nodeType.create(rule.attrs))) {
140181
+ this.leafFallback(dom);
140165
140182
  }
140166
140183
  } else {
140167
140184
  let markType = this.parser.schema.marks[rule.mark];
140168
- marks = marks.concat(markType.create(rule.attrs));
140185
+ mark = markType.create(rule.attrs);
140186
+ this.addPendingMark(mark);
140169
140187
  }
140170
140188
  let startIn = this.top;
140171
140189
  if (nodeType && nodeType.isLeaf) {
140172
140190
  this.findInside(dom);
140173
140191
  } else if (continueAfter) {
140174
- this.addElement(dom, marks, continueAfter);
140192
+ this.addElement(dom, continueAfter);
140175
140193
  } else if (rule.getContent) {
140176
140194
  this.findInside(dom);
140177
- rule.getContent(dom, this.parser.schema).forEach((node) => this.insertNode(node, marks));
140195
+ rule.getContent(dom, this.parser.schema).forEach((node) => this.insertNode(node));
140178
140196
  } else {
140179
140197
  let contentDOM = dom;
140180
140198
  if (typeof rule.contentElement == "string")
@@ -140184,27 +140202,28 @@
140184
140202
  else if (rule.contentElement)
140185
140203
  contentDOM = rule.contentElement;
140186
140204
  this.findAround(dom, contentDOM, true);
140187
- this.addAll(contentDOM, marks);
140188
- this.findAround(dom, contentDOM, false);
140205
+ this.addAll(contentDOM);
140189
140206
  }
140190
140207
  if (sync && this.sync(startIn))
140191
140208
  this.open--;
140209
+ if (mark)
140210
+ this.removePendingMark(mark, startIn);
140192
140211
  }
140193
140212
  // Add all child nodes between `startIndex` and `endIndex` (or the
140194
140213
  // whole node, if not given). If `sync` is passed, use it to
140195
140214
  // synchronize after every block element.
140196
- addAll(parent, marks, startIndex, endIndex) {
140215
+ addAll(parent, startIndex, endIndex) {
140197
140216
  let index3 = startIndex || 0;
140198
140217
  for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end2 = endIndex == null ? null : parent.childNodes[endIndex]; dom != end2; dom = dom.nextSibling, ++index3) {
140199
140218
  this.findAtPoint(parent, index3);
140200
- this.addDOM(dom, marks);
140219
+ this.addDOM(dom);
140201
140220
  }
140202
140221
  this.findAtPoint(parent, index3);
140203
140222
  }
140204
140223
  // Try to find a way to fit the given node type into the current
140205
140224
  // context. May add intermediate wrappers and/or leave non-solid
140206
140225
  // nodes that we're in.
140207
- findPlace(node, marks) {
140226
+ findPlace(node) {
140208
140227
  let route, sync;
140209
140228
  for (let depth = this.open; depth >= 0; depth--) {
140210
140229
  let cx = this.nodes[depth];
@@ -140219,61 +140238,53 @@
140219
140238
  break;
140220
140239
  }
140221
140240
  if (!route)
140222
- return null;
140241
+ return false;
140223
140242
  this.sync(sync);
140224
140243
  for (let i5 = 0; i5 < route.length; i5++)
140225
- marks = this.enterInner(route[i5], null, marks, false);
140226
- return marks;
140244
+ this.enterInner(route[i5], null, false);
140245
+ return true;
140227
140246
  }
140228
140247
  // Try to insert the given node, adjusting the context when needed.
140229
- insertNode(node, marks) {
140248
+ insertNode(node) {
140230
140249
  if (node.isInline && this.needsBlock && !this.top.type) {
140231
140250
  let block = this.textblockFromContext();
140232
140251
  if (block)
140233
- marks = this.enterInner(block, null, marks);
140252
+ this.enterInner(block);
140234
140253
  }
140235
- let innerMarks = this.findPlace(node, marks);
140236
- if (innerMarks) {
140254
+ if (this.findPlace(node)) {
140237
140255
  this.closeExtra();
140238
140256
  let top2 = this.top;
140257
+ top2.applyPending(node.type);
140239
140258
  if (top2.match)
140240
140259
  top2.match = top2.match.matchType(node.type);
140241
- let nodeMarks = Mark.none;
140242
- for (let m4 of innerMarks.concat(node.marks))
140243
- if (top2.type ? top2.type.allowsMarkType(m4.type) : markMayApply(m4.type, node.type))
140244
- nodeMarks = m4.addToSet(nodeMarks);
140245
- top2.content.push(node.mark(nodeMarks));
140260
+ let marks = top2.activeMarks;
140261
+ for (let i5 = 0; i5 < node.marks.length; i5++)
140262
+ if (!top2.type || top2.type.allowsMarkType(node.marks[i5].type))
140263
+ marks = node.marks[i5].addToSet(marks);
140264
+ top2.content.push(node.mark(marks));
140246
140265
  return true;
140247
140266
  }
140248
140267
  return false;
140249
140268
  }
140250
140269
  // Try to start a node of the given type, adjusting the context when
140251
140270
  // necessary.
140252
- enter(type, attrs, marks, preserveWS) {
140253
- let innerMarks = this.findPlace(type.create(attrs), marks);
140254
- if (innerMarks)
140255
- innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);
140256
- return innerMarks;
140271
+ enter(type, attrs, preserveWS) {
140272
+ let ok = this.findPlace(type.create(attrs));
140273
+ if (ok)
140274
+ this.enterInner(type, attrs, true, preserveWS);
140275
+ return ok;
140257
140276
  }
140258
140277
  // Open a node of the given type
140259
- enterInner(type, attrs, marks, solid = false, preserveWS) {
140278
+ enterInner(type, attrs = null, solid = false, preserveWS) {
140260
140279
  this.closeExtra();
140261
140280
  let top2 = this.top;
140281
+ top2.applyPending(type);
140262
140282
  top2.match = top2.match && top2.match.matchType(type);
140263
140283
  let options = wsOptionsFor(type, preserveWS, top2.options);
140264
140284
  if (top2.options & OPT_OPEN_LEFT && top2.content.length == 0)
140265
140285
  options |= OPT_OPEN_LEFT;
140266
- let applyMarks = Mark.none;
140267
- marks = marks.filter((m4) => {
140268
- if (top2.type ? top2.type.allowsMarkType(m4.type) : markMayApply(m4.type, type)) {
140269
- applyMarks = m4.addToSet(applyMarks);
140270
- return false;
140271
- }
140272
- return true;
140273
- });
140274
- this.nodes.push(new NodeContext(type, attrs, applyMarks, solid, null, options));
140286
+ this.nodes.push(new NodeContext(type, attrs, top2.activeMarks, top2.pendingMarks, solid, null, options));
140275
140287
  this.open++;
140276
- return marks;
140277
140288
  }
140278
140289
  // Make sure all nodes above this.open are finished and added to
140279
140290
  // their parents
@@ -140288,17 +140299,14 @@
140288
140299
  finish() {
140289
140300
  this.open = 0;
140290
140301
  this.closeExtra(this.isOpen);
140291
- return this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));
140302
+ return this.nodes[0].finish(this.isOpen || this.options.topOpen);
140292
140303
  }
140293
140304
  sync(to2) {
140294
- for (let i5 = this.open; i5 >= 0; i5--) {
140305
+ for (let i5 = this.open; i5 >= 0; i5--)
140295
140306
  if (this.nodes[i5] == to2) {
140296
140307
  this.open = i5;
140297
140308
  return true;
140298
- } else if (this.localPreserveWS) {
140299
- this.nodes[i5].options |= OPT_PRESERVE_WS;
140300
140309
  }
140301
- }
140302
140310
  return false;
140303
140311
  }
140304
140312
  get currentPos() {
@@ -140364,7 +140372,7 @@
140364
140372
  return false;
140365
140373
  } else {
140366
140374
  let next = depth > 0 || depth == 0 && useRoot ? this.nodes[depth].type : option2 && depth >= minDepth ? option2.node(depth - minDepth).type : null;
140367
- if (!next || next.name != part && !next.isInGroup(part))
140375
+ if (!next || next.name != part && next.groups.indexOf(part) == -1)
140368
140376
  return false;
140369
140377
  depth--;
140370
140378
  }
@@ -140387,6 +140395,28 @@
140387
140395
  return type;
140388
140396
  }
140389
140397
  }
140398
+ addPendingMark(mark) {
140399
+ let found2 = findSameMarkInSet(mark, this.top.pendingMarks);
140400
+ if (found2)
140401
+ this.top.stashMarks.push(found2);
140402
+ this.top.pendingMarks = mark.addToSet(this.top.pendingMarks);
140403
+ }
140404
+ removePendingMark(mark, upto) {
140405
+ for (let depth = this.open; depth >= 0; depth--) {
140406
+ let level = this.nodes[depth];
140407
+ let found2 = level.pendingMarks.lastIndexOf(mark);
140408
+ if (found2 > -1) {
140409
+ level.pendingMarks = mark.removeFromSet(level.pendingMarks);
140410
+ } else {
140411
+ level.activeMarks = mark.removeFromSet(level.activeMarks);
140412
+ let stashMark = level.popFromStashMark(mark);
140413
+ if (stashMark && level.type && level.type.allowsMarkType(stashMark.type))
140414
+ level.activeMarks = stashMark.addToSet(level.activeMarks);
140415
+ }
140416
+ if (level == upto)
140417
+ break;
140418
+ }
140419
+ }
140390
140420
  };
140391
140421
  function normalizeList(dom) {
140392
140422
  for (let child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {
@@ -140430,6 +140460,12 @@
140430
140460
  return true;
140431
140461
  }
140432
140462
  }
140463
+ function findSameMarkInSet(mark, set2) {
140464
+ for (let i5 = 0; i5 < set2.length; i5++) {
140465
+ if (mark.eq(set2[i5]))
140466
+ return set2[i5];
140467
+ }
140468
+ }
140433
140469
  var DOMSerializer = class _DOMSerializer {
140434
140470
  /**
140435
140471
  Create a serializer. `nodes` should map node names to functions