@antdv-next/x 1.1.1 → 1.1.2-beta.2
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/index.umd.js +36 -9
- package/dist/package.js +1 -1
- package/dist/sender/components/SlotTextArea.js +35 -8
- package/es/antdv-next-x.esm.js +38 -21
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
shiki_dist_themes_vitesse_dark_mjs = __toESM(shiki_dist_themes_vitesse_dark_mjs);
|
|
49
49
|
shiki_dist_themes_vitesse_light_mjs = __toESM(shiki_dist_themes_vitesse_light_mjs);
|
|
50
50
|
//#region package.json
|
|
51
|
-
var version = "1.1.
|
|
51
|
+
var version = "1.1.2-beta.2";
|
|
52
52
|
//#endregion
|
|
53
53
|
//#region components/x-provider/context.ts
|
|
54
54
|
var XProviderContextKey = Symbol("antdv-next-x-provider-context");
|
|
@@ -8668,16 +8668,17 @@
|
|
|
8668
8668
|
if (!selection || !selection.isCollapsed) return false;
|
|
8669
8669
|
const editable = editableRef.value;
|
|
8670
8670
|
if (!editable) return false;
|
|
8671
|
-
|
|
8672
|
-
|
|
8671
|
+
const anchorNode = selection.anchorNode;
|
|
8672
|
+
const offset = selection.anchorOffset;
|
|
8673
8673
|
if (!anchorNode || !editable.contains(anchorNode)) return false;
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
offset
|
|
8674
|
+
let previous;
|
|
8675
|
+
if (anchorNode === editable) {
|
|
8676
|
+
if (offset <= 0) return false;
|
|
8677
|
+
previous = editable.childNodes[offset - 1];
|
|
8678
|
+
} else {
|
|
8679
|
+
if (anchorNode.nodeType === Node.TEXT_NODE && offset > 0) return false;
|
|
8680
|
+
previous = (anchorNode.nodeType === Node.TEXT_NODE ? anchorNode.parentNode : anchorNode)?.previousSibling;
|
|
8677
8681
|
}
|
|
8678
|
-
if (anchorNode.nodeType === Node.TEXT_NODE && offset > 0) return false;
|
|
8679
|
-
const target = anchorNode.nodeType === Node.TEXT_NODE ? anchorNode.parentNode : anchorNode;
|
|
8680
|
-
const previous = target === editable ? editable.childNodes[Math.max(0, selection.anchorOffset - 1)] : target?.previousSibling;
|
|
8681
8682
|
if (!(previous instanceof HTMLElement)) return false;
|
|
8682
8683
|
const info = getNodeInfo(previous);
|
|
8683
8684
|
if (info?.slotKey) {
|
|
@@ -8710,8 +8711,34 @@
|
|
|
8710
8711
|
if (event.key === "Enter") keyLock.value = false;
|
|
8711
8712
|
senderCtx.value.onKeyUp?.(event);
|
|
8712
8713
|
};
|
|
8714
|
+
const normalizeSkillTextInput = () => {
|
|
8715
|
+
const editable = editableRef.value;
|
|
8716
|
+
const skillDom = skillDomRef.value;
|
|
8717
|
+
if (!editable || !skillDom) return;
|
|
8718
|
+
const selection = getSelection();
|
|
8719
|
+
const cursorNode = selection?.anchorNode && skillDom.contains(selection.anchorNode) ? selection.anchorNode : null;
|
|
8720
|
+
const cursorOffset = selection?.anchorOffset ?? 0;
|
|
8721
|
+
const wrapperCls = `${prefixCls.value}-skill-wrapper`;
|
|
8722
|
+
const textNodes = Array.from(skillDom.childNodes).filter((node) => {
|
|
8723
|
+
if (node instanceof HTMLElement && node.classList.contains(wrapperCls)) return false;
|
|
8724
|
+
return node.textContent;
|
|
8725
|
+
});
|
|
8726
|
+
const referenceNode = skillDom.nextSibling;
|
|
8727
|
+
textNodes.forEach((node) => {
|
|
8728
|
+
editable.insertBefore(node, referenceNode);
|
|
8729
|
+
});
|
|
8730
|
+
if (cursorNode && editable.contains(cursorNode)) {
|
|
8731
|
+
const range = document.createRange();
|
|
8732
|
+
const nextOffset = cursorNode.nodeType === Node.TEXT_NODE ? Math.min(cursorOffset, cursorNode.textContent?.length ?? 0) : Math.min(cursorOffset, cursorNode.childNodes.length);
|
|
8733
|
+
range.setStart(cursorNode, nextOffset);
|
|
8734
|
+
range.collapse(true);
|
|
8735
|
+
selection?.removeAllRanges();
|
|
8736
|
+
selection?.addRange(range);
|
|
8737
|
+
}
|
|
8738
|
+
};
|
|
8713
8739
|
const onInternalInput = (event) => {
|
|
8714
8740
|
removeSpecificBRs();
|
|
8741
|
+
normalizeSkillTextInput();
|
|
8715
8742
|
triggerValueChange(event);
|
|
8716
8743
|
};
|
|
8717
8744
|
const onInternalPaste = (event) => {
|
package/dist/package.js
CHANGED
|
@@ -500,16 +500,17 @@ var SlotTextArea_default = /* @__PURE__ */ defineComponent({
|
|
|
500
500
|
if (!selection || !selection.isCollapsed) return false;
|
|
501
501
|
const editable = editableRef.value;
|
|
502
502
|
if (!editable) return false;
|
|
503
|
-
|
|
504
|
-
|
|
503
|
+
const anchorNode = selection.anchorNode;
|
|
504
|
+
const offset = selection.anchorOffset;
|
|
505
505
|
if (!anchorNode || !editable.contains(anchorNode)) return false;
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
offset
|
|
506
|
+
let previous;
|
|
507
|
+
if (anchorNode === editable) {
|
|
508
|
+
if (offset <= 0) return false;
|
|
509
|
+
previous = editable.childNodes[offset - 1];
|
|
510
|
+
} else {
|
|
511
|
+
if (anchorNode.nodeType === Node.TEXT_NODE && offset > 0) return false;
|
|
512
|
+
previous = (anchorNode.nodeType === Node.TEXT_NODE ? anchorNode.parentNode : anchorNode)?.previousSibling;
|
|
509
513
|
}
|
|
510
|
-
if (anchorNode.nodeType === Node.TEXT_NODE && offset > 0) return false;
|
|
511
|
-
const target = anchorNode.nodeType === Node.TEXT_NODE ? anchorNode.parentNode : anchorNode;
|
|
512
|
-
const previous = target === editable ? editable.childNodes[Math.max(0, selection.anchorOffset - 1)] : target?.previousSibling;
|
|
513
514
|
if (!(previous instanceof HTMLElement)) return false;
|
|
514
515
|
const info = getNodeInfo(previous);
|
|
515
516
|
if (info?.slotKey) {
|
|
@@ -542,8 +543,34 @@ var SlotTextArea_default = /* @__PURE__ */ defineComponent({
|
|
|
542
543
|
if (event.key === "Enter") keyLock.value = false;
|
|
543
544
|
senderCtx.value.onKeyUp?.(event);
|
|
544
545
|
};
|
|
546
|
+
const normalizeSkillTextInput = () => {
|
|
547
|
+
const editable = editableRef.value;
|
|
548
|
+
const skillDom = skillDomRef.value;
|
|
549
|
+
if (!editable || !skillDom) return;
|
|
550
|
+
const selection = getSelection();
|
|
551
|
+
const cursorNode = selection?.anchorNode && skillDom.contains(selection.anchorNode) ? selection.anchorNode : null;
|
|
552
|
+
const cursorOffset = selection?.anchorOffset ?? 0;
|
|
553
|
+
const wrapperCls = `${prefixCls.value}-skill-wrapper`;
|
|
554
|
+
const textNodes = Array.from(skillDom.childNodes).filter((node) => {
|
|
555
|
+
if (node instanceof HTMLElement && node.classList.contains(wrapperCls)) return false;
|
|
556
|
+
return node.textContent;
|
|
557
|
+
});
|
|
558
|
+
const referenceNode = skillDom.nextSibling;
|
|
559
|
+
textNodes.forEach((node) => {
|
|
560
|
+
editable.insertBefore(node, referenceNode);
|
|
561
|
+
});
|
|
562
|
+
if (cursorNode && editable.contains(cursorNode)) {
|
|
563
|
+
const range = document.createRange();
|
|
564
|
+
const nextOffset = cursorNode.nodeType === Node.TEXT_NODE ? Math.min(cursorOffset, cursorNode.textContent?.length ?? 0) : Math.min(cursorOffset, cursorNode.childNodes.length);
|
|
565
|
+
range.setStart(cursorNode, nextOffset);
|
|
566
|
+
range.collapse(true);
|
|
567
|
+
selection?.removeAllRanges();
|
|
568
|
+
selection?.addRange(range);
|
|
569
|
+
}
|
|
570
|
+
};
|
|
545
571
|
const onInternalInput = (event) => {
|
|
546
572
|
removeSpecificBRs();
|
|
573
|
+
normalizeSkillTextInput();
|
|
547
574
|
triggerValueChange(event);
|
|
548
575
|
};
|
|
549
576
|
const onInternalPaste = (event) => {
|
package/es/antdv-next-x.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { r as e } from "./chunk-WQLz0Won.js";
|
|
|
2
2
|
import { S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, x, y as S } from "./Serializer-D1JYN1kI.js";
|
|
3
3
|
import { Comment as C, Fragment as w, Teleport as T, Text as E, Transition as D, TransitionGroup as O, cloneVNode as k, computed as A, createTextVNode as j, createVNode as M, defineComponent as N, getCurrentInstance as P, getCurrentScope as F, h as I, inject as L, isVNode as R, markRaw as ee, mergeDefaults as z, mergeProps as B, nextTick as V, onBeforeMount as te, onBeforeUnmount as H, onBeforeUpdate as ne, onMounted as re, onScopeDispose as ie, onUnmounted as ae, onUpdated as oe, provide as U, reactive as se, ref as W, render as ce, resolveDynamicComponent as le, shallowReactive as ue, shallowRef as G, toRaw as de, toRef as fe, toRefs as pe, toValue as me, triggerRef as he, unref as ge, useAttrs as _e, useId as ve, useSlots as ye, vShow as be, watch as K, watchEffect as xe, withDirectives as Se } from "vue";
|
|
4
4
|
//#region package.json
|
|
5
|
-
var Ce = "1.1.
|
|
5
|
+
var Ce = "1.1.2-beta.2", we = "anticon", Te = {}, Ee = [
|
|
6
6
|
"outlined",
|
|
7
7
|
"borderless",
|
|
8
8
|
"filled",
|
|
@@ -59236,11 +59236,18 @@ var YW = /* @__PURE__ */ N({
|
|
|
59236
59236
|
let n = r.value;
|
|
59237
59237
|
if (!n) return !1;
|
|
59238
59238
|
let i = t.anchorNode, a = t.anchorOffset;
|
|
59239
|
-
if (!i || !n.contains(i)
|
|
59240
|
-
let o
|
|
59241
|
-
if (
|
|
59242
|
-
|
|
59243
|
-
|
|
59239
|
+
if (!i || !n.contains(i)) return !1;
|
|
59240
|
+
let o;
|
|
59241
|
+
if (i === n) {
|
|
59242
|
+
if (a <= 0) return !1;
|
|
59243
|
+
o = n.childNodes[a - 1];
|
|
59244
|
+
} else {
|
|
59245
|
+
if (i.nodeType === Node.TEXT_NODE && a > 0) return !1;
|
|
59246
|
+
o = (i.nodeType === Node.TEXT_NODE ? i.parentNode : i)?.previousSibling;
|
|
59247
|
+
}
|
|
59248
|
+
if (!(o instanceof HTMLElement)) return !1;
|
|
59249
|
+
let s = _(o);
|
|
59250
|
+
return s?.slotKey ? (e.preventDefault(), re(s.slotKey, e), !0) : s?.skillKey ? (e.preventDefault(), ie(!0), !0) : !1;
|
|
59244
59251
|
}, de = (e) => {
|
|
59245
59252
|
if (!(n.value.onKeyDown?.(e) === !1 || p.value || f.value) && !(e.key === "Backspace" && G(e))) {
|
|
59246
59253
|
if (le(e)) {
|
|
@@ -59251,9 +59258,19 @@ var YW = /* @__PURE__ */ N({
|
|
|
59251
59258
|
}
|
|
59252
59259
|
}, fe = (e) => {
|
|
59253
59260
|
e.key === "Enter" && (p.value = !1), n.value.onKeyUp?.(e);
|
|
59254
|
-
}, pe = (
|
|
59255
|
-
|
|
59261
|
+
}, pe = () => {
|
|
59262
|
+
let e = r.value, t = c.value;
|
|
59263
|
+
if (!e || !t) return;
|
|
59264
|
+
let n = L(), i = n?.anchorNode && t.contains(n.anchorNode) ? n.anchorNode : null, a = n?.anchorOffset ?? 0, o = `${m.value}-skill-wrapper`, s = Array.from(t.childNodes).filter((e) => e instanceof HTMLElement && e.classList.contains(o) ? !1 : e.textContent), l = t.nextSibling;
|
|
59265
|
+
if (s.forEach((t) => {
|
|
59266
|
+
e.insertBefore(t, l);
|
|
59267
|
+
}), i && e.contains(i)) {
|
|
59268
|
+
let e = document.createRange(), t = i.nodeType === Node.TEXT_NODE ? Math.min(a, i.textContent?.length ?? 0) : Math.min(a, i.childNodes.length);
|
|
59269
|
+
e.setStart(i, t), e.collapse(!0), n?.removeAllRanges(), n?.addRange(e);
|
|
59270
|
+
}
|
|
59256
59271
|
}, me = (e) => {
|
|
59272
|
+
se(), pe(), D(e);
|
|
59273
|
+
}, he = (e) => {
|
|
59257
59274
|
e.preventDefault();
|
|
59258
59275
|
let t = e.clipboardData?.files, r = e.clipboardData?.getData("text/plain") ?? "";
|
|
59259
59276
|
if (!r && t?.length && n.value.onPasteFile) {
|
|
@@ -59269,11 +59286,11 @@ var YW = /* @__PURE__ */ N({
|
|
|
59269
59286
|
t.insertNode(n), t.setStartAfter(n), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
|
|
59270
59287
|
}
|
|
59271
59288
|
}
|
|
59272
|
-
|
|
59273
|
-
},
|
|
59289
|
+
me(e), n.value.onPaste?.(e);
|
|
59290
|
+
}, ge = () => {
|
|
59274
59291
|
let e = L(), t = r.value;
|
|
59275
59292
|
!e || !t || e.focusNode === t && e.focusOffset === 0 && T().skill && ee(t, 1);
|
|
59276
|
-
},
|
|
59293
|
+
}, _e = (e = "cursor") => {
|
|
59277
59294
|
let t = r.value;
|
|
59278
59295
|
if (!t) return null;
|
|
59279
59296
|
let n = L(), i = document.createRange();
|
|
@@ -59329,25 +59346,25 @@ var YW = /* @__PURE__ */ N({
|
|
|
59329
59346
|
F(e);
|
|
59330
59347
|
let o = P(e);
|
|
59331
59348
|
if (!o.length) return;
|
|
59332
|
-
let s =
|
|
59349
|
+
let s = _e(t);
|
|
59333
59350
|
if (!s?.range) return;
|
|
59334
59351
|
let { range: c, selection: l } = s;
|
|
59335
59352
|
a.focus({ preventScroll: i }), n && (L()?.toString() ?? "").endsWith(n) && c.setStart(c.startContainer, Math.max(0, c.startOffset - n.length)), c.deleteContents(), o.forEach((e) => {
|
|
59336
59353
|
c.insertNode(e), c.setStartAfter(e);
|
|
59337
|
-
}), c.collapse(!0), l && (l.removeAllRanges(), l.addRange(c)),
|
|
59354
|
+
}), c.collapse(!0), l && (l.removeAllRanges(), l.addRange(c)), me();
|
|
59338
59355
|
},
|
|
59339
59356
|
clear: () => {
|
|
59340
|
-
I(), ae(),
|
|
59357
|
+
I(), ae(), me();
|
|
59341
59358
|
},
|
|
59342
59359
|
getValue: T
|
|
59343
59360
|
});
|
|
59344
|
-
let
|
|
59361
|
+
let ve = (e, t = !1) => {
|
|
59345
59362
|
!t && e === u.value || (u.value = e, U(e));
|
|
59346
59363
|
};
|
|
59347
59364
|
return K(() => r.value, (e) => {
|
|
59348
|
-
e &&
|
|
59365
|
+
e && ve(n.value.slotConfig, !0);
|
|
59349
59366
|
}, { immediate: !0 }), K(() => n.value.slotConfig, (e) => {
|
|
59350
|
-
|
|
59367
|
+
ve(e);
|
|
59351
59368
|
}, { immediate: !0 }), K(() => n.value.skill, (e) => {
|
|
59352
59369
|
e === d.value && c.value || (d.value = e, ae(), V(() => {
|
|
59353
59370
|
D();
|
|
@@ -59373,12 +59390,12 @@ var YW = /* @__PURE__ */ N({
|
|
|
59373
59390
|
"data-placeholder": n.value.placeholder,
|
|
59374
59391
|
contenteditable: !n.value.readOnly,
|
|
59375
59392
|
spellcheck: !1,
|
|
59376
|
-
onInput:
|
|
59393
|
+
onInput: me,
|
|
59377
59394
|
onKeydown: de,
|
|
59378
59395
|
onKeyup: fe,
|
|
59379
|
-
onPaste:
|
|
59380
|
-
onCut:
|
|
59381
|
-
onSelect:
|
|
59396
|
+
onPaste: he,
|
|
59397
|
+
onCut: me,
|
|
59398
|
+
onSelect: ge,
|
|
59382
59399
|
onFocus: (e) => {
|
|
59383
59400
|
n.value.onFocus?.(e);
|
|
59384
59401
|
},
|