@sendbird/actionbook-core 0.10.14 → 0.10.16

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/dist/ui/index.js CHANGED
@@ -3293,9 +3293,10 @@ var joinListItemBackward = (state, dispatch) => {
3293
3293
  for (let i = 1; i < liNode.childCount; i++) {
3294
3294
  nestedContent.push(liNode.child(i));
3295
3295
  }
3296
- const insertPos = tr.mapping.map(listStart);
3296
+ let insertPos = tr.mapping.map(listStart);
3297
3297
  for (const node of nestedContent) {
3298
3298
  tr.insert(insertPos, node);
3299
+ insertPos += node.nodeSize;
3299
3300
  }
3300
3301
  }
3301
3302
  tr.setSelection(TextSelection2.near(tr.doc.resolve(prevBlockEnd)));
@@ -3391,11 +3392,11 @@ var shiftTabCommand = (state, dispatch) => {
3391
3392
  }
3392
3393
  return true;
3393
3394
  };
3394
- var blockExitEnterCount = 0;
3395
- var blockExitLastTime = 0;
3395
+ var blockExitState = /* @__PURE__ */ new WeakMap();
3396
3396
  var BLOCK_EXIT_TYPES = /* @__PURE__ */ new Set(["blockquote", "jinjaIfBranch"]);
3397
- var exitBlockOnDoubleEnter = (state, dispatch) => {
3397
+ var exitBlockOnDoubleEnter = (state, dispatch, view) => {
3398
3398
  const { $from } = state.selection;
3399
+ const es = view ? blockExitState.get(view) ?? { count: 0, time: 0 } : { count: 0, time: 0 };
3399
3400
  let blockDepth = -1;
3400
3401
  for (let d = $from.depth; d > 0; d--) {
3401
3402
  if (BLOCK_EXIT_TYPES.has($from.node(d).type.name)) {
@@ -3404,19 +3405,23 @@ var exitBlockOnDoubleEnter = (state, dispatch) => {
3404
3405
  }
3405
3406
  }
3406
3407
  if (blockDepth < 0) {
3407
- blockExitEnterCount = 0;
3408
+ es.count = 0;
3409
+ if (view) blockExitState.set(view, es);
3408
3410
  return false;
3409
3411
  }
3410
3412
  if ($from.parent.type.name !== "paragraph" || $from.parent.content.size !== 0) {
3411
- blockExitEnterCount = 0;
3413
+ es.count = 0;
3414
+ if (view) blockExitState.set(view, es);
3412
3415
  return false;
3413
3416
  }
3414
3417
  const now = Date.now();
3415
- if (now - blockExitLastTime > 2e3) blockExitEnterCount = 0;
3416
- blockExitLastTime = now;
3417
- blockExitEnterCount++;
3418
- if (blockExitEnterCount < 2) return false;
3419
- blockExitEnterCount = 0;
3418
+ if (now - es.time > 2e3) es.count = 0;
3419
+ es.time = now;
3420
+ es.count++;
3421
+ if (view) blockExitState.set(view, es);
3422
+ if (es.count < 2) return false;
3423
+ es.count = 0;
3424
+ if (view) blockExitState.set(view, es);
3420
3425
  if (!dispatch) return true;
3421
3426
  const paraStart = $from.before($from.depth);
3422
3427
  const paraEnd = $from.after($from.depth);
@@ -8830,13 +8835,20 @@ function normalizeLinkHref(href) {
8830
8835
  return trimmedHref.startsWith("#") || trimmedHref.startsWith("/") || /^https?:\/\//i.test(trimmedHref) ? trimmedHref : `https://${trimmedHref}`;
8831
8836
  }
8832
8837
  function getNonLinkMarksInRange(state, from, to) {
8833
- let marks = [];
8838
+ const seen = /* @__PURE__ */ new Set();
8839
+ const result = [];
8834
8840
  state.doc.nodesBetween(from, to, (node) => {
8835
8841
  if (!node.isText) return;
8836
- marks = node.marks.filter((mark) => mark.type !== linkMark);
8837
- return false;
8842
+ for (const mark of node.marks) {
8843
+ if (mark.type === linkMark) continue;
8844
+ const key2 = `${mark.type.name}:${JSON.stringify(mark.attrs)}`;
8845
+ if (!seen.has(key2)) {
8846
+ seen.add(key2);
8847
+ result.push(mark);
8848
+ }
8849
+ }
8838
8850
  });
8839
- return marks;
8851
+ return result;
8840
8852
  }
8841
8853
  function activeHeadingLevel(state) {
8842
8854
  const { $from } = state.selection;