@antdv-next/x 1.1.1 → 1.1.2-beta.1
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 +27 -1
- package/dist/package.js +1 -1
- package/dist/sender/components/SlotTextArea.js +26 -0
- package/es/antdv-next-x.esm.js +26 -16
- 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.1";
|
|
51
|
+
var version = "1.1.2-beta.1";
|
|
52
52
|
//#endregion
|
|
53
53
|
//#region components/x-provider/context.ts
|
|
54
54
|
var XProviderContextKey = Symbol("antdv-next-x-provider-context");
|
|
@@ -8710,8 +8710,34 @@
|
|
|
8710
8710
|
if (event.key === "Enter") keyLock.value = false;
|
|
8711
8711
|
senderCtx.value.onKeyUp?.(event);
|
|
8712
8712
|
};
|
|
8713
|
+
const normalizeSkillTextInput = () => {
|
|
8714
|
+
const editable = editableRef.value;
|
|
8715
|
+
const skillDom = skillDomRef.value;
|
|
8716
|
+
if (!editable || !skillDom) return;
|
|
8717
|
+
const selection = getSelection();
|
|
8718
|
+
const cursorNode = selection?.anchorNode && skillDom.contains(selection.anchorNode) ? selection.anchorNode : null;
|
|
8719
|
+
const cursorOffset = selection?.anchorOffset ?? 0;
|
|
8720
|
+
const wrapperCls = `${prefixCls.value}-skill-wrapper`;
|
|
8721
|
+
const textNodes = Array.from(skillDom.childNodes).filter((node) => {
|
|
8722
|
+
if (node instanceof HTMLElement && node.classList.contains(wrapperCls)) return false;
|
|
8723
|
+
return node.textContent;
|
|
8724
|
+
});
|
|
8725
|
+
const referenceNode = skillDom.nextSibling;
|
|
8726
|
+
textNodes.forEach((node) => {
|
|
8727
|
+
editable.insertBefore(node, referenceNode);
|
|
8728
|
+
});
|
|
8729
|
+
if (cursorNode && editable.contains(cursorNode)) {
|
|
8730
|
+
const range = document.createRange();
|
|
8731
|
+
const nextOffset = cursorNode.nodeType === Node.TEXT_NODE ? Math.min(cursorOffset, cursorNode.textContent?.length ?? 0) : Math.min(cursorOffset, cursorNode.childNodes.length);
|
|
8732
|
+
range.setStart(cursorNode, nextOffset);
|
|
8733
|
+
range.collapse(true);
|
|
8734
|
+
selection?.removeAllRanges();
|
|
8735
|
+
selection?.addRange(range);
|
|
8736
|
+
}
|
|
8737
|
+
};
|
|
8713
8738
|
const onInternalInput = (event) => {
|
|
8714
8739
|
removeSpecificBRs();
|
|
8740
|
+
normalizeSkillTextInput();
|
|
8715
8741
|
triggerValueChange(event);
|
|
8716
8742
|
};
|
|
8717
8743
|
const onInternalPaste = (event) => {
|
package/dist/package.js
CHANGED
|
@@ -542,8 +542,34 @@ var SlotTextArea_default = /* @__PURE__ */ defineComponent({
|
|
|
542
542
|
if (event.key === "Enter") keyLock.value = false;
|
|
543
543
|
senderCtx.value.onKeyUp?.(event);
|
|
544
544
|
};
|
|
545
|
+
const normalizeSkillTextInput = () => {
|
|
546
|
+
const editable = editableRef.value;
|
|
547
|
+
const skillDom = skillDomRef.value;
|
|
548
|
+
if (!editable || !skillDom) return;
|
|
549
|
+
const selection = getSelection();
|
|
550
|
+
const cursorNode = selection?.anchorNode && skillDom.contains(selection.anchorNode) ? selection.anchorNode : null;
|
|
551
|
+
const cursorOffset = selection?.anchorOffset ?? 0;
|
|
552
|
+
const wrapperCls = `${prefixCls.value}-skill-wrapper`;
|
|
553
|
+
const textNodes = Array.from(skillDom.childNodes).filter((node) => {
|
|
554
|
+
if (node instanceof HTMLElement && node.classList.contains(wrapperCls)) return false;
|
|
555
|
+
return node.textContent;
|
|
556
|
+
});
|
|
557
|
+
const referenceNode = skillDom.nextSibling;
|
|
558
|
+
textNodes.forEach((node) => {
|
|
559
|
+
editable.insertBefore(node, referenceNode);
|
|
560
|
+
});
|
|
561
|
+
if (cursorNode && editable.contains(cursorNode)) {
|
|
562
|
+
const range = document.createRange();
|
|
563
|
+
const nextOffset = cursorNode.nodeType === Node.TEXT_NODE ? Math.min(cursorOffset, cursorNode.textContent?.length ?? 0) : Math.min(cursorOffset, cursorNode.childNodes.length);
|
|
564
|
+
range.setStart(cursorNode, nextOffset);
|
|
565
|
+
range.collapse(true);
|
|
566
|
+
selection?.removeAllRanges();
|
|
567
|
+
selection?.addRange(range);
|
|
568
|
+
}
|
|
569
|
+
};
|
|
545
570
|
const onInternalInput = (event) => {
|
|
546
571
|
removeSpecificBRs();
|
|
572
|
+
normalizeSkillTextInput();
|
|
547
573
|
triggerValueChange(event);
|
|
548
574
|
};
|
|
549
575
|
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.1", we = "anticon", Te = {}, Ee = [
|
|
5
|
+
var Ce = "1.1.2-beta.1", we = "anticon", Te = {}, Ee = [
|
|
6
6
|
"outlined",
|
|
7
7
|
"borderless",
|
|
8
8
|
"filled",
|
|
@@ -59251,9 +59251,19 @@ var YW = /* @__PURE__ */ N({
|
|
|
59251
59251
|
}
|
|
59252
59252
|
}, fe = (e) => {
|
|
59253
59253
|
e.key === "Enter" && (p.value = !1), n.value.onKeyUp?.(e);
|
|
59254
|
-
}, pe = (
|
|
59255
|
-
|
|
59254
|
+
}, pe = () => {
|
|
59255
|
+
let e = r.value, t = c.value;
|
|
59256
|
+
if (!e || !t) return;
|
|
59257
|
+
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;
|
|
59258
|
+
if (s.forEach((t) => {
|
|
59259
|
+
e.insertBefore(t, l);
|
|
59260
|
+
}), i && e.contains(i)) {
|
|
59261
|
+
let e = document.createRange(), t = i.nodeType === Node.TEXT_NODE ? Math.min(a, i.textContent?.length ?? 0) : Math.min(a, i.childNodes.length);
|
|
59262
|
+
e.setStart(i, t), e.collapse(!0), n?.removeAllRanges(), n?.addRange(e);
|
|
59263
|
+
}
|
|
59256
59264
|
}, me = (e) => {
|
|
59265
|
+
se(), pe(), D(e);
|
|
59266
|
+
}, he = (e) => {
|
|
59257
59267
|
e.preventDefault();
|
|
59258
59268
|
let t = e.clipboardData?.files, r = e.clipboardData?.getData("text/plain") ?? "";
|
|
59259
59269
|
if (!r && t?.length && n.value.onPasteFile) {
|
|
@@ -59269,11 +59279,11 @@ var YW = /* @__PURE__ */ N({
|
|
|
59269
59279
|
t.insertNode(n), t.setStartAfter(n), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
|
|
59270
59280
|
}
|
|
59271
59281
|
}
|
|
59272
|
-
|
|
59273
|
-
},
|
|
59282
|
+
me(e), n.value.onPaste?.(e);
|
|
59283
|
+
}, ge = () => {
|
|
59274
59284
|
let e = L(), t = r.value;
|
|
59275
59285
|
!e || !t || e.focusNode === t && e.focusOffset === 0 && T().skill && ee(t, 1);
|
|
59276
|
-
},
|
|
59286
|
+
}, _e = (e = "cursor") => {
|
|
59277
59287
|
let t = r.value;
|
|
59278
59288
|
if (!t) return null;
|
|
59279
59289
|
let n = L(), i = document.createRange();
|
|
@@ -59329,25 +59339,25 @@ var YW = /* @__PURE__ */ N({
|
|
|
59329
59339
|
F(e);
|
|
59330
59340
|
let o = P(e);
|
|
59331
59341
|
if (!o.length) return;
|
|
59332
|
-
let s =
|
|
59342
|
+
let s = _e(t);
|
|
59333
59343
|
if (!s?.range) return;
|
|
59334
59344
|
let { range: c, selection: l } = s;
|
|
59335
59345
|
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
59346
|
c.insertNode(e), c.setStartAfter(e);
|
|
59337
|
-
}), c.collapse(!0), l && (l.removeAllRanges(), l.addRange(c)),
|
|
59347
|
+
}), c.collapse(!0), l && (l.removeAllRanges(), l.addRange(c)), me();
|
|
59338
59348
|
},
|
|
59339
59349
|
clear: () => {
|
|
59340
|
-
I(), ae(),
|
|
59350
|
+
I(), ae(), me();
|
|
59341
59351
|
},
|
|
59342
59352
|
getValue: T
|
|
59343
59353
|
});
|
|
59344
|
-
let
|
|
59354
|
+
let ve = (e, t = !1) => {
|
|
59345
59355
|
!t && e === u.value || (u.value = e, U(e));
|
|
59346
59356
|
};
|
|
59347
59357
|
return K(() => r.value, (e) => {
|
|
59348
|
-
e &&
|
|
59358
|
+
e && ve(n.value.slotConfig, !0);
|
|
59349
59359
|
}, { immediate: !0 }), K(() => n.value.slotConfig, (e) => {
|
|
59350
|
-
|
|
59360
|
+
ve(e);
|
|
59351
59361
|
}, { immediate: !0 }), K(() => n.value.skill, (e) => {
|
|
59352
59362
|
e === d.value && c.value || (d.value = e, ae(), V(() => {
|
|
59353
59363
|
D();
|
|
@@ -59373,12 +59383,12 @@ var YW = /* @__PURE__ */ N({
|
|
|
59373
59383
|
"data-placeholder": n.value.placeholder,
|
|
59374
59384
|
contenteditable: !n.value.readOnly,
|
|
59375
59385
|
spellcheck: !1,
|
|
59376
|
-
onInput:
|
|
59386
|
+
onInput: me,
|
|
59377
59387
|
onKeydown: de,
|
|
59378
59388
|
onKeyup: fe,
|
|
59379
|
-
onPaste:
|
|
59380
|
-
onCut:
|
|
59381
|
-
onSelect:
|
|
59389
|
+
onPaste: he,
|
|
59390
|
+
onCut: me,
|
|
59391
|
+
onSelect: ge,
|
|
59382
59392
|
onFocus: (e) => {
|
|
59383
59393
|
n.value.onFocus?.(e);
|
|
59384
59394
|
},
|