@sendbird/actionbook-core 0.10.15 → 0.10.17
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 +67 -30
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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 -
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
if (
|
|
3419
|
-
|
|
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);
|
|
@@ -7691,10 +7696,15 @@ var DragHandleController = class {
|
|
|
7691
7696
|
this.activeMenuCleanup = null;
|
|
7692
7697
|
}
|
|
7693
7698
|
}
|
|
7694
|
-
|
|
7699
|
+
/** Show the context menu at a fixed screen position (pointer coordinates). */
|
|
7700
|
+
showMenuAt(blockIndex, x, y) {
|
|
7695
7701
|
this.dismissMenu();
|
|
7696
7702
|
const menu = document.createElement("div");
|
|
7697
7703
|
menu.className = "ab-dh-menu";
|
|
7704
|
+
menu.style.position = "fixed";
|
|
7705
|
+
menu.style.left = `${x}px`;
|
|
7706
|
+
menu.style.top = `${y + 4}px`;
|
|
7707
|
+
menu.style.zIndex = "9999";
|
|
7698
7708
|
const deleteBtn = document.createElement("button");
|
|
7699
7709
|
deleteBtn.className = "ab-dh-menu-item";
|
|
7700
7710
|
deleteBtn.textContent = "Delete";
|
|
@@ -7705,7 +7715,7 @@ var DragHandleController = class {
|
|
|
7705
7715
|
this.dismissMenu();
|
|
7706
7716
|
});
|
|
7707
7717
|
menu.appendChild(deleteBtn);
|
|
7708
|
-
|
|
7718
|
+
document.body.appendChild(menu);
|
|
7709
7719
|
this.activeMenu = menu;
|
|
7710
7720
|
const onOutside = (e) => {
|
|
7711
7721
|
if (!menu.contains(e.target)) {
|
|
@@ -7730,36 +7740,56 @@ var DragHandleController = class {
|
|
|
7730
7740
|
let currentIndex = index;
|
|
7731
7741
|
let downX = 0;
|
|
7732
7742
|
let downY = 0;
|
|
7733
|
-
let
|
|
7743
|
+
let dragStarted = false;
|
|
7744
|
+
let pointerId = -1;
|
|
7734
7745
|
let menuWasOpen = false;
|
|
7746
|
+
const DRAG_THRESHOLD2 = 4;
|
|
7735
7747
|
const onPointerDown = (e) => {
|
|
7736
7748
|
if (this.activeMenu && this.activeMenu.contains(e.target)) return;
|
|
7737
7749
|
e.preventDefault();
|
|
7750
|
+
e.stopPropagation();
|
|
7738
7751
|
if (!this.view.editable) return;
|
|
7739
7752
|
menuWasOpen = !!this.activeMenu;
|
|
7740
7753
|
this.dismissMenu();
|
|
7741
7754
|
downX = e.clientX;
|
|
7742
7755
|
downY = e.clientY;
|
|
7743
|
-
|
|
7756
|
+
dragStarted = false;
|
|
7757
|
+
pointerId = e.pointerId;
|
|
7744
7758
|
el.setPointerCapture(e.pointerId);
|
|
7745
|
-
this.prevBlocks = this.collectBlocks();
|
|
7746
|
-
this.syncHandlePositions();
|
|
7747
|
-
this.startDrag(currentIndex, el, e);
|
|
7748
7759
|
};
|
|
7749
7760
|
const onPointerMove = (e) => {
|
|
7750
|
-
if (
|
|
7751
|
-
|
|
7761
|
+
if (e.pointerId !== pointerId) return;
|
|
7762
|
+
const dx = Math.abs(e.clientX - downX);
|
|
7763
|
+
const dy = Math.abs(e.clientY - downY);
|
|
7764
|
+
if (!dragStarted && (dx > DRAG_THRESHOLD2 || dy > DRAG_THRESHOLD2)) {
|
|
7765
|
+
dragStarted = true;
|
|
7766
|
+
this.prevBlocks = this.collectBlocks();
|
|
7767
|
+
this.syncHandlePositions();
|
|
7768
|
+
this.startDrag(currentIndex, el, e);
|
|
7769
|
+
}
|
|
7770
|
+
if (dragStarted) {
|
|
7771
|
+
this.onPointerMove(e);
|
|
7752
7772
|
}
|
|
7753
|
-
this.onPointerMove(e);
|
|
7754
7773
|
};
|
|
7755
7774
|
const onPointerUp = (e) => {
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7775
|
+
if (e.pointerId !== pointerId) return;
|
|
7776
|
+
e.preventDefault();
|
|
7777
|
+
e.stopPropagation();
|
|
7778
|
+
if (dragStarted) {
|
|
7779
|
+
this.onPointerUp(e);
|
|
7780
|
+
} else if (!menuWasOpen) {
|
|
7781
|
+
this.showMenuAt(currentIndex, downX, downY);
|
|
7759
7782
|
}
|
|
7783
|
+
pointerId = -1;
|
|
7784
|
+
};
|
|
7785
|
+
const onLostCapture = () => {
|
|
7786
|
+
if (dragStarted) this.cancelDrag();
|
|
7787
|
+
pointerId = -1;
|
|
7788
|
+
};
|
|
7789
|
+
const onPointerCancel = () => {
|
|
7790
|
+
if (dragStarted) this.cancelDrag();
|
|
7791
|
+
pointerId = -1;
|
|
7760
7792
|
};
|
|
7761
|
-
const onLostCapture = () => this.cancelDrag();
|
|
7762
|
-
const onPointerCancel = () => this.cancelDrag();
|
|
7763
7793
|
el.addEventListener("pointerdown", onPointerDown);
|
|
7764
7794
|
el.addEventListener("pointermove", onPointerMove);
|
|
7765
7795
|
el.addEventListener("pointerup", onPointerUp);
|
|
@@ -8830,13 +8860,20 @@ function normalizeLinkHref(href) {
|
|
|
8830
8860
|
return trimmedHref.startsWith("#") || trimmedHref.startsWith("/") || /^https?:\/\//i.test(trimmedHref) ? trimmedHref : `https://${trimmedHref}`;
|
|
8831
8861
|
}
|
|
8832
8862
|
function getNonLinkMarksInRange(state, from, to) {
|
|
8833
|
-
|
|
8863
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8864
|
+
const result = [];
|
|
8834
8865
|
state.doc.nodesBetween(from, to, (node) => {
|
|
8835
8866
|
if (!node.isText) return;
|
|
8836
|
-
|
|
8837
|
-
|
|
8867
|
+
for (const mark of node.marks) {
|
|
8868
|
+
if (mark.type === linkMark) continue;
|
|
8869
|
+
const key2 = `${mark.type.name}:${JSON.stringify(mark.attrs)}`;
|
|
8870
|
+
if (!seen.has(key2)) {
|
|
8871
|
+
seen.add(key2);
|
|
8872
|
+
result.push(mark);
|
|
8873
|
+
}
|
|
8874
|
+
}
|
|
8838
8875
|
});
|
|
8839
|
-
return
|
|
8876
|
+
return result;
|
|
8840
8877
|
}
|
|
8841
8878
|
function activeHeadingLevel(state) {
|
|
8842
8879
|
const { $from } = state.selection;
|