@opentiny/tiny-robot 0.5.1-alpha.2 → 0.5.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/attachments/index.js +261 -258
- package/dist/index.d.ts +5533 -51
- package/dist/index.js +30 -28
- package/dist/sender/index.js +1114 -1077
- package/dist/style.css +1 -1
- package/dist/theme-provider/index.js +41 -32
- package/dist/useSenderContentRegistration.js +8 -0
- package/package.json +3 -22
- package/dist/action-group/ActionGroup.vue.d.ts +0 -26
- package/dist/action-group/ActionGroupItem.vue.d.ts +0 -18
- package/dist/action-group/index.d.ts +0 -12
- package/dist/action-group/index.type.d.ts +0 -17
- package/dist/anchor/components/AnchorItem.vue.d.ts +0 -24
- package/dist/anchor/components/AnchorList.vue.d.ts +0 -20
- package/dist/anchor/components/AnchorOverlay.vue.d.ts +0 -33
- package/dist/anchor/components/AnchorSearch.vue.d.ts +0 -7
- package/dist/anchor/composables/index.d.ts +0 -5
- package/dist/anchor/composables/useActiveSync.d.ts +0 -10
- package/dist/anchor/composables/useFloatingOffset.d.ts +0 -6
- package/dist/anchor/composables/useNavController.d.ts +0 -12
- package/dist/anchor/composables/useOverlayInteractions.d.ts +0 -6
- package/dist/anchor/composables/useTargetFeedback.d.ts +0 -5
- package/dist/anchor/defaults.d.ts +0 -16
- package/dist/anchor/index.d.ts +0 -7
- package/dist/anchor/index.type.d.ts +0 -60
- package/dist/anchor/index.vue.d.ts +0 -159
- package/dist/anchor/internal.type.d.ts +0 -103
- package/dist/anchor/utils/scroll.d.ts +0 -7
- package/dist/anchor/utils/target.d.ts +0 -6
- package/dist/attachments/components/FileCard.vue.d.ts +0 -18
- package/dist/attachments/components/ImagePreview.vue.d.ts +0 -17
- package/dist/attachments/components/index.d.ts +0 -2
- package/dist/attachments/composables/index.d.ts +0 -5
- package/dist/attachments/composables/useFileCard.d.ts +0 -15
- package/dist/attachments/composables/useFileType.d.ts +0 -20
- package/dist/attachments/composables/useImagePreview.d.ts +0 -18
- package/dist/attachments/composables/useListType.d.ts +0 -11
- package/dist/attachments/index.d.ts +0 -7
- package/dist/attachments/index.type.d.ts +0 -70
- package/dist/attachments/index.vue.d.ts +0 -27
- package/dist/attachments/utils.d.ts +0 -3
- package/dist/base-popper/components/Popper.vue.d.ts +0 -28
- package/dist/base-popper/index.d.ts +0 -2
- package/dist/base-popper/index.vue.d.ts +0 -41
- package/dist/bubble/Bubble.vue.d.ts +0 -47
- package/dist/bubble/BubbleBoxWrapper.vue.d.ts +0 -22
- package/dist/bubble/BubbleContentWrapper.vue.d.ts +0 -22
- package/dist/bubble/BubbleItem.vue.d.ts +0 -44
- package/dist/bubble/BubbleList.vue.d.ts +0 -43
- package/dist/bubble/BubbleProvider.vue.d.ts +0 -18
- package/dist/bubble/composables/index.d.ts +0 -11
- package/dist/bubble/composables/useBubbleBoxRenderer.d.ts +0 -18
- package/dist/bubble/composables/useBubbleContentRenderer.d.ts +0 -18
- package/dist/bubble/composables/useBubbleEvent.d.ts +0 -3
- package/dist/bubble/composables/useBubbleStateChange.d.ts +0 -1
- package/dist/bubble/composables/useBubbleStore.d.ts +0 -16
- package/dist/bubble/composables/useContentResolver.d.ts +0 -5
- package/dist/bubble/composables/useCopyCleanup.d.ts +0 -6
- package/dist/bubble/composables/useMessageContent.d.ts +0 -5
- package/dist/bubble/composables/useMessageGroup.d.ts +0 -4
- package/dist/bubble/composables/useOmitMessageFields.d.ts +0 -12
- package/dist/bubble/composables/useToolCall.d.ts +0 -25
- package/dist/bubble/constants.d.ts +0 -42
- package/dist/bubble/index.d.ts +0 -19
- package/dist/bubble/index.type.d.ts +0 -185
- package/dist/bubble/renderers/Box.vue.d.ts +0 -18
- package/dist/bubble/renderers/Image.vue.d.ts +0 -4
- package/dist/bubble/renderers/Loading.vue.d.ts +0 -4
- package/dist/bubble/renderers/Markdown.vue.d.ts +0 -4
- package/dist/bubble/renderers/Reasoning.vue.d.ts +0 -9
- package/dist/bubble/renderers/Text.vue.d.ts +0 -4
- package/dist/bubble/renderers/Tool.vue.d.ts +0 -14
- package/dist/bubble/renderers/ToolRole.vue.d.ts +0 -4
- package/dist/bubble/renderers/Tools.vue.d.ts +0 -4
- package/dist/bubble/renderers/allRenderers.d.ts +0 -93
- package/dist/bubble/renderers/defaultRenderers.d.ts +0 -27
- package/dist/bubble/utils.d.ts +0 -7
- package/dist/chat/components/ChatConversation.vue.d.ts +0 -305
- package/dist/chat/components/ChatLauncherButton.vue.d.ts +0 -12
- package/dist/chat/components/ChatMcpTrigger.vue.d.ts +0 -30
- package/dist/chat/components/ChatThemeToggleButton.vue.d.ts +0 -6
- package/dist/chat/components/ChatWelcome.vue.d.ts +0 -14
- package/dist/chat/components/icons/IconModelAliyunBailian.vue.d.ts +0 -7
- package/dist/chat/components/icons/IconModelDeepseek.vue.d.ts +0 -7
- package/dist/chat/components/icons/index.d.ts +0 -5
- package/dist/chat/composables/useChatConversation.d.ts +0 -37
- package/dist/chat/composables/useChatMcp.d.ts +0 -29
- package/dist/chat/composables/useChatModel.d.ts +0 -27
- package/dist/chat/index.d.ts +0 -9
- package/dist/chat/index.js +0 -13904
- package/dist/chat/index.type.d.ts +0 -92
- package/dist/chat/index.vue.d.ts +0 -51
- package/dist/chat/locale.d.ts +0 -12
- package/dist/chat/mcpServers.d.ts +0 -3
- package/dist/container/index.d.ts +0 -7
- package/dist/container/index.type.d.ts +0 -20
- package/dist/container/index.vue.d.ts +0 -32
- package/dist/conversations/index.d.ts +0 -7
- package/dist/conversations/index.vue.d.ts +0 -2
- package/dist/drag-overlay/constants.d.ts +0 -17
- package/dist/drag-overlay/directives/vDropzone.d.ts +0 -14
- package/dist/drag-overlay/index.d.ts +0 -7
- package/dist/drag-overlay/index.type.d.ts +0 -105
- package/dist/drag-overlay/index.vue.d.ts +0 -20
- package/dist/dropdown-menu/composables/usePopperHover.d.ts +0 -6
- package/dist/dropdown-menu/index.d.ts +0 -7
- package/dist/dropdown-menu/index.type.d.ts +0 -42
- package/dist/dropdown-menu/index.vue.d.ts +0 -217
- package/dist/feedback/components/SourceList.vue.d.ts +0 -11
- package/dist/feedback/components/index.d.ts +0 -1
- package/dist/feedback/index.d.ts +0 -7
- package/dist/feedback/index.type.d.ts +0 -25
- package/dist/feedback/index.vue.d.ts +0 -13
- package/dist/flow-layout-buttons/index.d.ts +0 -7
- package/dist/flow-layout-buttons/index.type.d.ts +0 -35
- package/dist/flow-layout-buttons/index.vue.d.ts +0 -22
- package/dist/history/components/Empty.vue.d.ts +0 -7
- package/dist/history/components/MenuList.vue.d.ts +0 -24
- package/dist/history/composables/useRenameEditor.d.ts +0 -22
- package/dist/history/constants.d.ts +0 -1
- package/dist/history/index.d.ts +0 -7
- package/dist/history/index.type.d.ts +0 -33
- package/dist/history/index.vue.d.ts +0 -18
- package/dist/icon-button/index.d.ts +0 -7
- package/dist/icon-button/index.type.d.ts +0 -7
- package/dist/icon-button/index.vue.d.ts +0 -6
- package/dist/layout/Layout.vue.d.ts +0 -246
- package/dist/layout/LayoutAsideToggle.vue.d.ts +0 -20
- package/dist/layout/LayoutProxyScrollbar.vue.d.ts +0 -6
- package/dist/layout/components/AsideContent.vue.d.ts +0 -35
- package/dist/layout/components/AsideResizeTrigger.vue.d.ts +0 -20
- package/dist/layout/components/FloatingDragBar.vue.d.ts +0 -18
- package/dist/layout/components/FloatingResizeTrigger.vue.d.ts +0 -17
- package/dist/layout/components/FloatingResizeTriggers.vue.d.ts +0 -14
- package/dist/layout/components/LayoutSurface.vue.d.ts +0 -41
- package/dist/layout/composables/useLayoutAsideStates.d.ts +0 -21
- package/dist/layout/composables/useLayoutContext.d.ts +0 -4
- package/dist/layout/composables/usePointerDrag.d.ts +0 -19
- package/dist/layout/index.d.ts +0 -22
- package/dist/layout/index.type.d.ts +0 -111
- package/dist/layout/internal.type.d.ts +0 -43
- package/dist/layout/utils/asideEventEmitters.d.ts +0 -6
- package/dist/layout/utils/asidePresets.d.ts +0 -5
- package/dist/layout/utils/cssLength.d.ts +0 -2
- package/dist/layout/utils/domInteraction.d.ts +0 -1
- package/dist/layout/utils/number.d.ts +0 -1
- package/dist/layout/utils/surfaceGeometry.d.ts +0 -87
- package/dist/layout/utils/surfaceResize.d.ts +0 -10
- package/dist/mcp-add-form/components/CodeEditor.vue.d.ts +0 -9
- package/dist/mcp-add-form/components/FormEditor.vue.d.ts +0 -10
- package/dist/mcp-add-form/components/index.d.ts +0 -2
- package/dist/mcp-add-form/index.d.ts +0 -7
- package/dist/mcp-add-form/index.type.d.ts +0 -19
- package/dist/mcp-add-form/index.vue.d.ts +0 -13
- package/dist/mcp-server-picker/components/NoData.vue.d.ts +0 -7
- package/dist/mcp-server-picker/components/PluginCard.vue.d.ts +0 -40
- package/dist/mcp-server-picker/components/PluginModal.vue.d.ts +0 -15
- package/dist/mcp-server-picker/components/index.d.ts +0 -3
- package/dist/mcp-server-picker/index.d.ts +0 -7
- package/dist/mcp-server-picker/index.type.d.ts +0 -99
- package/dist/mcp-server-picker/index.vue.d.ts +0 -71
- package/dist/prompts/index.d.ts +0 -12
- package/dist/prompts/index.type.d.ts +0 -59
- package/dist/prompts/prompt.vue.d.ts +0 -5
- package/dist/prompts/prompts.vue.d.ts +0 -20
- package/dist/sender/components/editor-content/index.vue.d.ts +0 -4
- package/dist/sender/components/footer/index.vue.d.ts +0 -38
- package/dist/sender/components/layouts/MultiLineLayout.vue.d.ts +0 -43
- package/dist/sender/components/layouts/SingleLineLayout.vue.d.ts +0 -32
- package/dist/sender/composables/index.d.ts +0 -7
- package/dist/sender/composables/useAutoSize.d.ts +0 -5
- package/dist/sender/composables/useEditor.d.ts +0 -13
- package/dist/sender/composables/useKeyboardShortcuts.d.ts +0 -7
- package/dist/sender/composables/useModeSwitch.d.ts +0 -4
- package/dist/sender/composables/useSenderCore.d.ts +0 -31
- package/dist/sender/composables/useSlotScope.d.ts +0 -10
- package/dist/sender/context/index.d.ts +0 -6
- package/dist/sender/context/types.d.ts +0 -7
- package/dist/sender/extensions/constants.d.ts +0 -94
- package/dist/sender/extensions/index.d.ts +0 -12
- package/dist/sender/extensions/mention/commands.d.ts +0 -20
- package/dist/sender/extensions/mention/components/mention-list.vue.d.ts +0 -18
- package/dist/sender/extensions/mention/components/mention-view.vue.d.ts +0 -19
- package/dist/sender/extensions/mention/extension.d.ts +0 -6
- package/dist/sender/extensions/mention/index.d.ts +0 -22
- package/dist/sender/extensions/mention/plugin.d.ts +0 -16
- package/dist/sender/extensions/mention/types.d.ts +0 -126
- package/dist/sender/extensions/mention/utils.d.ts +0 -34
- package/dist/sender/extensions/suggestion/extension.d.ts +0 -8
- package/dist/sender/extensions/suggestion/index.d.ts +0 -20
- package/dist/sender/extensions/suggestion/plugin.d.ts +0 -21
- package/dist/sender/extensions/suggestion/suggestion-list.vue.d.ts +0 -46
- package/dist/sender/extensions/suggestion/types.d.ts +0 -254
- package/dist/sender/extensions/suggestion/utils/filter.d.ts +0 -29
- package/dist/sender/extensions/suggestion/utils/highlight.d.ts +0 -73
- package/dist/sender/extensions/template/block/extension.d.ts +0 -6
- package/dist/sender/extensions/template/block/plugins.d.ts +0 -13
- package/dist/sender/extensions/template/block/template-block-view.vue.d.ts +0 -14
- package/dist/sender/extensions/template/commands.d.ts +0 -31
- package/dist/sender/extensions/template/extension.d.ts +0 -6
- package/dist/sender/extensions/template/index.d.ts +0 -21
- package/dist/sender/extensions/template/select/dropdown-manager.d.ts +0 -23
- package/dist/sender/extensions/template/select/extension.d.ts +0 -5
- package/dist/sender/extensions/template/select/plugins.d.ts +0 -34
- package/dist/sender/extensions/template/select/template-select-view.vue.d.ts +0 -20
- package/dist/sender/extensions/template/types.d.ts +0 -100
- package/dist/sender/extensions/template/utils.d.ts +0 -20
- package/dist/sender/extensions/utils/id-generator.d.ts +0 -16
- package/dist/sender/extensions/utils/index.d.ts +0 -7
- package/dist/sender/extensions/utils/keyboard.d.ts +0 -49
- package/dist/sender/extensions/utils/position.d.ts +0 -25
- package/dist/sender/index.d.ts +0 -139
- package/dist/sender/index.type.d.ts +0 -311
- package/dist/sender/index.vue.d.ts +0 -93
- package/dist/sender/types/base.d.ts +0 -239
- package/dist/sender/types/components.d.ts +0 -68
- package/dist/sender/types/composables.d.ts +0 -122
- package/dist/sender/types/context.d.ts +0 -138
- package/dist/sender/types/slots.d.ts +0 -67
- package/dist/sender/utils/countGraphemes.d.ts +0 -1
- package/dist/sender-actions/action-button/index.vue.d.ts +0 -23
- package/dist/sender-actions/clear-button/index.vue.d.ts +0 -2
- package/dist/sender-actions/clear-button/useClearButtonState.d.ts +0 -6
- package/dist/sender-actions/default-actions/index.vue.d.ts +0 -17
- package/dist/sender-actions/index.d.ts +0 -21
- package/dist/sender-actions/index.type.d.ts +0 -7
- package/dist/sender-actions/submit-button/index.vue.d.ts +0 -2
- package/dist/sender-actions/types/common.d.ts +0 -40
- package/dist/sender-actions/types/index.d.ts +0 -5
- package/dist/sender-actions/types/tooltip.d.ts +0 -7
- package/dist/sender-actions/upload-button/index.type.d.ts +0 -57
- package/dist/sender-actions/upload-button/index.vue.d.ts +0 -16
- package/dist/sender-actions/utils/tooltip.d.ts +0 -8
- package/dist/sender-actions/voice-button/index.type.d.ts +0 -78
- package/dist/sender-actions/voice-button/index.vue.d.ts +0 -43
- package/dist/sender-actions/voice-button/speech.types.d.ts +0 -40
- package/dist/sender-actions/voice-button/useSpeechHandler.d.ts +0 -10
- package/dist/sender-actions/voice-button/webSpeechHandler.d.ts +0 -40
- package/dist/sender-actions/word-counter/index.vue.d.ts +0 -2
- package/dist/sender-compat/index.d.ts +0 -7
- package/dist/sender-compat/index.type.d.ts +0 -91
- package/dist/sender-compat/index.vue.d.ts +0 -538
- package/dist/shared/composables/createTeleport.d.ts +0 -2
- package/dist/shared/composables/index.d.ts +0 -6
- package/dist/shared/composables/useAutoScroll.d.ts +0 -25
- package/dist/shared/composables/useControllableState.d.ts +0 -20
- package/dist/shared/composables/useSlotRefs.d.ts +0 -12
- package/dist/shared/composables/useTeleportTarget.d.ts +0 -11
- package/dist/shared/composables/useTouchDevice.d.ts +0 -3
- package/dist/shared/utils.d.ts +0 -7
- package/dist/suggestion-pills/components/PillButton.vue.d.ts +0 -16
- package/dist/suggestion-pills/components/index.d.ts +0 -1
- package/dist/suggestion-pills/index.d.ts +0 -13
- package/dist/suggestion-pills/index.type.d.ts +0 -45
- package/dist/suggestion-pills/index.vue.d.ts +0 -44
- package/dist/suggestion-popover/components/Backdrop.vue.d.ts +0 -5
- package/dist/suggestion-popover/components/Header.vue.d.ts +0 -4
- package/dist/suggestion-popover/components/Loading.vue.d.ts +0 -17
- package/dist/suggestion-popover/components/NoData.vue.d.ts +0 -17
- package/dist/suggestion-popover/components/Tooltip.vue.d.ts +0 -19
- package/dist/suggestion-popover/index.d.ts +0 -7
- package/dist/suggestion-popover/index.type.d.ts +0 -80
- package/dist/suggestion-popover/index.vue.d.ts +0 -262
- package/dist/theme-provider/constants.d.ts +0 -6
- package/dist/theme-provider/index.d.ts +0 -9
- package/dist/theme-provider/index.type.d.ts +0 -18
- package/dist/theme-provider/index.vue.d.ts +0 -32
- package/dist/theme-provider/useTheme.d.ts +0 -11
- package/dist/useTheme.js +0 -22
- package/dist/welcome/index.d.ts +0 -7
- package/dist/welcome/index.type.d.ts +0 -10
- package/dist/welcome/index.vue.d.ts +0 -18
package/dist/sender/index.js
CHANGED
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { a as
|
|
3
|
-
import { NodeViewWrapper as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { h as
|
|
11
|
-
import { PluginKey as
|
|
12
|
-
import { DecorationSet as
|
|
13
|
-
import { _ as
|
|
14
|
-
import { IconAssociate as
|
|
15
|
-
import {
|
|
16
|
-
|
|
1
|
+
import { defineComponent as Z, openBlock as M, createBlock as U, unref as k, withCtx as j, createTextVNode as ln, toDisplayString as pe, ref as F, watch as K, createElementBlock as P, Fragment as Ie, renderList as Be, withModifiers as nt, normalizeClass as Q, createCommentVNode as q, createElementVNode as B, nextTick as me, isRef as ke, Transition as an, normalizeStyle as cn, createVNode as se, toRaw as un, computed as R, onMounted as dn, onUnmounted as fn, Teleport as pn, toRef as De, onBeforeUnmount as mn, shallowReactive as hn, toValue as gn, provide as xn, renderSlot as D, createSlots as $e, normalizeProps as he, guardReactiveProps as ge } from "vue";
|
|
2
|
+
import { a as yn, u as Pe, W as Rt, D as Pt } from "../index2.js";
|
|
3
|
+
import { NodeViewWrapper as lt, VueRenderer as Ot, VueNodeViewRenderer as at, NodeViewContent as bn, useEditor as vn, EditorContent as Tn } from "@tiptap/vue-3";
|
|
4
|
+
import En from "@tiptap/extension-document";
|
|
5
|
+
import wn from "@tiptap/extension-paragraph";
|
|
6
|
+
import Cn from "@tiptap/extension-text";
|
|
7
|
+
import An from "@tiptap/extension-history";
|
|
8
|
+
import Sn from "@tiptap/extension-placeholder";
|
|
9
|
+
import _n from "@tiptap/extension-character-count";
|
|
10
|
+
import { h as Ln, j as kn, p as Mn } from "../index4.js";
|
|
11
|
+
import { PluginKey as re, Plugin as ie, TextSelection as O } from "@tiptap/pm/state";
|
|
12
|
+
import { DecorationSet as Le, Decoration as Dt } from "@tiptap/pm/view";
|
|
13
|
+
import { _ as J } from "../_plugin-vue_export-helper.js";
|
|
14
|
+
import { IconAssociate as Rn, IconArrowDown as Pn } from "@opentiny/tiny-robot-svgs";
|
|
15
|
+
import { s as On } from "../useSenderContentRegistration.js";
|
|
16
|
+
import { Node as ct, mergeAttributes as ut, Extension as It } from "@tiptap/core";
|
|
17
|
+
const Dn = /* @__PURE__ */ Z({
|
|
17
18
|
__name: "mention-view",
|
|
18
19
|
props: {
|
|
19
20
|
node: {},
|
|
20
21
|
extension: {}
|
|
21
22
|
},
|
|
22
23
|
setup(e) {
|
|
23
|
-
return (t, n) => (
|
|
24
|
+
return (t, n) => (M(), U(k(lt), {
|
|
24
25
|
as: "span",
|
|
25
26
|
class: "mention",
|
|
26
27
|
"data-id": e.node.attrs.id,
|
|
27
28
|
"data-value": e.node.attrs.value
|
|
28
29
|
}, {
|
|
29
|
-
default:
|
|
30
|
-
ln(
|
|
30
|
+
default: j(() => [
|
|
31
|
+
ln(pe(e.extension.options.char) + pe(e.node.attrs.label), 1)
|
|
31
32
|
]),
|
|
32
33
|
_: 1
|
|
33
34
|
}, 8, ["data-id", "data-value"]));
|
|
34
35
|
}
|
|
35
|
-
}),
|
|
36
|
+
}), In = /* @__PURE__ */ J(Dn, [["__scopeId", "data-v-b42c4fae"]]), je = Math.min, fe = Math.max, Ne = Math.round, Oe = Math.floor, ee = (e) => ({
|
|
36
37
|
x: e,
|
|
37
38
|
y: e
|
|
38
|
-
}),
|
|
39
|
+
}), Bn = {
|
|
39
40
|
left: "right",
|
|
40
41
|
right: "left",
|
|
41
42
|
bottom: "top",
|
|
42
43
|
top: "bottom"
|
|
43
44
|
};
|
|
44
|
-
function
|
|
45
|
-
return
|
|
45
|
+
function $n(e, t, n) {
|
|
46
|
+
return fe(e, je(t, n));
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function Fe(e, t) {
|
|
48
49
|
return typeof e == "function" ? e(t) : e;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function Ee(e) {
|
|
51
52
|
return e.split("-")[0];
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function Ve(e) {
|
|
54
55
|
return e.split("-")[1];
|
|
55
56
|
}
|
|
56
57
|
function Bt(e) {
|
|
@@ -59,49 +60,49 @@ function Bt(e) {
|
|
|
59
60
|
function $t(e) {
|
|
60
61
|
return e === "y" ? "height" : "width";
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function oe(e) {
|
|
63
64
|
const t = e[0];
|
|
64
65
|
return t === "t" || t === "b" ? "y" : "x";
|
|
65
66
|
}
|
|
66
67
|
function jt(e) {
|
|
67
|
-
return Bt(
|
|
68
|
+
return Bt(oe(e));
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function jn(e, t, n) {
|
|
70
71
|
n === void 0 && (n = !1);
|
|
71
|
-
const s =
|
|
72
|
+
const s = Ve(e), r = jt(e), o = $t(r);
|
|
72
73
|
let l = r === "x" ? s === (n ? "end" : "start") ? "right" : "left" : s === "start" ? "bottom" : "top";
|
|
73
|
-
return t.reference[o] > t.floating[o] && (l =
|
|
74
|
+
return t.reference[o] > t.floating[o] && (l = We(l)), [l, We(l)];
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
-
const t =
|
|
77
|
-
return [
|
|
76
|
+
function Nn(e) {
|
|
77
|
+
const t = We(e);
|
|
78
|
+
return [ot(e), t, ot(t)];
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
+
function ot(e) {
|
|
80
81
|
return e.includes("start") ? e.replace("start", "end") : e.replace("end", "start");
|
|
81
82
|
}
|
|
82
|
-
const vt = ["left", "right"], Tt = ["right", "left"],
|
|
83
|
-
function
|
|
83
|
+
const vt = ["left", "right"], Tt = ["right", "left"], Wn = ["top", "bottom"], Kn = ["bottom", "top"];
|
|
84
|
+
function qn(e, t, n) {
|
|
84
85
|
switch (e) {
|
|
85
86
|
case "top":
|
|
86
87
|
case "bottom":
|
|
87
88
|
return n ? t ? Tt : vt : t ? vt : Tt;
|
|
88
89
|
case "left":
|
|
89
90
|
case "right":
|
|
90
|
-
return t ?
|
|
91
|
+
return t ? Wn : Kn;
|
|
91
92
|
default:
|
|
92
93
|
return [];
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
|
-
function
|
|
96
|
-
const r =
|
|
97
|
-
let o =
|
|
98
|
-
return r && (o = o.map((l) => l + "-" + r), t && (o = o.concat(o.map(
|
|
96
|
+
function Hn(e, t, n, s) {
|
|
97
|
+
const r = Ve(e);
|
|
98
|
+
let o = qn(Ee(e), n === "start", s);
|
|
99
|
+
return r && (o = o.map((l) => l + "-" + r), t && (o = o.concat(o.map(ot)))), o;
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
-
const t =
|
|
102
|
-
return
|
|
101
|
+
function We(e) {
|
|
102
|
+
const t = Ee(e);
|
|
103
|
+
return Bn[t] + e.slice(t.length);
|
|
103
104
|
}
|
|
104
|
-
function
|
|
105
|
+
function zn(e) {
|
|
105
106
|
var t, n, s, r;
|
|
106
107
|
return {
|
|
107
108
|
top: (t = e.top) != null ? t : 0,
|
|
@@ -110,15 +111,15 @@ function Kn(e) {
|
|
|
110
111
|
left: (r = e.left) != null ? r : 0
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
|
-
function
|
|
114
|
-
return typeof e != "number" ?
|
|
114
|
+
function Fn(e) {
|
|
115
|
+
return typeof e != "number" ? zn(e) : {
|
|
115
116
|
top: e,
|
|
116
117
|
right: e,
|
|
117
118
|
bottom: e,
|
|
118
119
|
left: e
|
|
119
120
|
};
|
|
120
121
|
}
|
|
121
|
-
function
|
|
122
|
+
function Ke(e) {
|
|
122
123
|
const {
|
|
123
124
|
x: t,
|
|
124
125
|
y: n,
|
|
@@ -141,43 +142,43 @@ function Et(e, t, n) {
|
|
|
141
142
|
reference: s,
|
|
142
143
|
floating: r
|
|
143
144
|
} = e;
|
|
144
|
-
const o =
|
|
145
|
-
let
|
|
145
|
+
const o = oe(t), l = jt(t), i = $t(l), a = Ee(t), c = o === "y", d = s.x + s.width / 2 - r.width / 2, u = s.y + s.height / 2 - r.height / 2, g = s[i] / 2 - r[i] / 2;
|
|
146
|
+
let h;
|
|
146
147
|
switch (a) {
|
|
147
148
|
case "top":
|
|
148
|
-
|
|
149
|
+
h = {
|
|
149
150
|
x: d,
|
|
150
151
|
y: s.y - r.height
|
|
151
152
|
};
|
|
152
153
|
break;
|
|
153
154
|
case "bottom":
|
|
154
|
-
|
|
155
|
+
h = {
|
|
155
156
|
x: d,
|
|
156
157
|
y: s.y + s.height
|
|
157
158
|
};
|
|
158
159
|
break;
|
|
159
160
|
case "right":
|
|
160
|
-
|
|
161
|
+
h = {
|
|
161
162
|
x: s.x + s.width,
|
|
162
163
|
y: u
|
|
163
164
|
};
|
|
164
165
|
break;
|
|
165
166
|
case "left":
|
|
166
|
-
|
|
167
|
+
h = {
|
|
167
168
|
x: s.x - r.width,
|
|
168
169
|
y: u
|
|
169
170
|
};
|
|
170
171
|
break;
|
|
171
172
|
default:
|
|
172
|
-
|
|
173
|
+
h = {
|
|
173
174
|
x: s.x,
|
|
174
175
|
y: s.y
|
|
175
176
|
};
|
|
176
177
|
}
|
|
177
|
-
const E =
|
|
178
|
-
return E && (
|
|
178
|
+
const E = Ve(t);
|
|
179
|
+
return E && (h[l] += g * (E === "end" ? 1 : -1) * (n && c ? -1 : 1)), h;
|
|
179
180
|
}
|
|
180
|
-
async function
|
|
181
|
+
async function Vn(e, t) {
|
|
181
182
|
var n;
|
|
182
183
|
t === void 0 && (t = {});
|
|
183
184
|
const {
|
|
@@ -191,14 +192,14 @@ async function Hn(e, t) {
|
|
|
191
192
|
boundary: c = "clippingAncestors",
|
|
192
193
|
rootBoundary: d = "viewport",
|
|
193
194
|
elementContext: u = "floating",
|
|
194
|
-
altBoundary:
|
|
195
|
-
padding:
|
|
196
|
-
} =
|
|
197
|
-
element: (n = await (o.isElement == null ? void 0 : o.isElement(
|
|
195
|
+
altBoundary: g = !1,
|
|
196
|
+
padding: h = 0
|
|
197
|
+
} = Fe(t, e), E = Fn(h), T = i[g ? u === "floating" ? "reference" : "floating" : u], m = Ke(await o.getClippingRect({
|
|
198
|
+
element: (n = await (o.isElement == null ? void 0 : o.isElement(T))) == null || n ? T : T.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(i.floating)),
|
|
198
199
|
boundary: c,
|
|
199
200
|
rootBoundary: d,
|
|
200
201
|
strategy: a
|
|
201
|
-
})),
|
|
202
|
+
})), y = u === "floating" ? {
|
|
202
203
|
x: s,
|
|
203
204
|
y: r,
|
|
204
205
|
width: l.floating.width,
|
|
@@ -206,20 +207,20 @@ async function Hn(e, t) {
|
|
|
206
207
|
} : l.reference, p = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(i.floating)), f = await (o.isElement == null ? void 0 : o.isElement(p)) && await (o.getScale == null ? void 0 : o.getScale(p)) || {
|
|
207
208
|
x: 1,
|
|
208
209
|
y: 1
|
|
209
|
-
},
|
|
210
|
+
}, x = Ke(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
210
211
|
elements: i,
|
|
211
|
-
rect:
|
|
212
|
+
rect: y,
|
|
212
213
|
offsetParent: p,
|
|
213
214
|
strategy: a
|
|
214
|
-
}) :
|
|
215
|
+
}) : y);
|
|
215
216
|
return {
|
|
216
|
-
top: (
|
|
217
|
-
bottom: (
|
|
218
|
-
left: (
|
|
219
|
-
right: (
|
|
217
|
+
top: (m.top - x.top + E.top) / f.y,
|
|
218
|
+
bottom: (x.bottom - m.bottom + E.bottom) / f.y,
|
|
219
|
+
left: (m.left - x.left + E.left) / f.x,
|
|
220
|
+
right: (x.right - m.right + E.right) / f.x
|
|
220
221
|
};
|
|
221
222
|
}
|
|
222
|
-
const
|
|
223
|
+
const Gn = 50, Un = async (e, t, n) => {
|
|
223
224
|
const {
|
|
224
225
|
placement: s = "bottom",
|
|
225
226
|
strategy: r = "absolute",
|
|
@@ -227,7 +228,7 @@ const zn = 50, Fn = async (e, t, n) => {
|
|
|
227
228
|
platform: l
|
|
228
229
|
} = n, i = l.detectOverflow ? l : {
|
|
229
230
|
...l,
|
|
230
|
-
detectOverflow:
|
|
231
|
+
detectOverflow: Vn
|
|
231
232
|
}, a = await (l.isRTL == null ? void 0 : l.isRTL(t));
|
|
232
233
|
let c = await l.getElementRects({
|
|
233
234
|
reference: e,
|
|
@@ -236,25 +237,25 @@ const zn = 50, Fn = async (e, t, n) => {
|
|
|
236
237
|
}), {
|
|
237
238
|
x: d,
|
|
238
239
|
y: u
|
|
239
|
-
} = Et(c, s, a),
|
|
240
|
+
} = Et(c, s, a), g = s, h = 0;
|
|
240
241
|
const E = {};
|
|
241
|
-
for (let
|
|
242
|
-
const
|
|
243
|
-
if (!
|
|
242
|
+
for (let w = 0; w < o.length; w++) {
|
|
243
|
+
const T = o[w];
|
|
244
|
+
if (!T)
|
|
244
245
|
continue;
|
|
245
246
|
const {
|
|
246
|
-
name:
|
|
247
|
-
fn:
|
|
248
|
-
} =
|
|
247
|
+
name: m,
|
|
248
|
+
fn: y
|
|
249
|
+
} = T, {
|
|
249
250
|
x: p,
|
|
250
251
|
y: f,
|
|
251
|
-
data:
|
|
252
|
-
reset:
|
|
253
|
-
} = await
|
|
252
|
+
data: x,
|
|
253
|
+
reset: v
|
|
254
|
+
} = await y({
|
|
254
255
|
x: d,
|
|
255
256
|
y: u,
|
|
256
257
|
initialPlacement: s,
|
|
257
|
-
placement:
|
|
258
|
+
placement: g,
|
|
258
259
|
strategy: r,
|
|
259
260
|
middlewareData: E,
|
|
260
261
|
rects: c,
|
|
@@ -264,26 +265,26 @@ const zn = 50, Fn = async (e, t, n) => {
|
|
|
264
265
|
floating: t
|
|
265
266
|
}
|
|
266
267
|
});
|
|
267
|
-
d = p ?? d, u = f ?? u, E[
|
|
268
|
-
...E[
|
|
269
|
-
...
|
|
270
|
-
},
|
|
268
|
+
d = p ?? d, u = f ?? u, E[m] = {
|
|
269
|
+
...E[m],
|
|
270
|
+
...x
|
|
271
|
+
}, v && h < Gn && (h++, typeof v == "object" && (v.placement && (g = v.placement), v.rects && (c = v.rects === !0 ? await l.getElementRects({
|
|
271
272
|
reference: e,
|
|
272
273
|
floating: t,
|
|
273
274
|
strategy: r
|
|
274
|
-
}) :
|
|
275
|
+
}) : v.rects), {
|
|
275
276
|
x: d,
|
|
276
277
|
y: u
|
|
277
|
-
} = Et(c,
|
|
278
|
+
} = Et(c, g, a)), w = -1);
|
|
278
279
|
}
|
|
279
280
|
return {
|
|
280
281
|
x: d,
|
|
281
282
|
y: u,
|
|
282
|
-
placement:
|
|
283
|
+
placement: g,
|
|
283
284
|
strategy: r,
|
|
284
285
|
middlewareData: E
|
|
285
286
|
};
|
|
286
|
-
},
|
|
287
|
+
}, Xn = function(e) {
|
|
287
288
|
return e === void 0 && (e = {}), {
|
|
288
289
|
name: "flip",
|
|
289
290
|
options: e,
|
|
@@ -299,81 +300,81 @@ const zn = 50, Fn = async (e, t, n) => {
|
|
|
299
300
|
} = t, {
|
|
300
301
|
mainAxis: d = !0,
|
|
301
302
|
crossAxis: u = !0,
|
|
302
|
-
fallbackPlacements:
|
|
303
|
-
fallbackStrategy:
|
|
303
|
+
fallbackPlacements: g,
|
|
304
|
+
fallbackStrategy: h = "bestFit",
|
|
304
305
|
fallbackAxisSideDirection: E = "none",
|
|
305
|
-
flipAlignment:
|
|
306
|
-
...
|
|
307
|
-
} =
|
|
306
|
+
flipAlignment: w = !0,
|
|
307
|
+
...T
|
|
308
|
+
} = Fe(e, t);
|
|
308
309
|
if ((n = o.arrow) != null && n.alignmentOffset)
|
|
309
310
|
return {};
|
|
310
|
-
const
|
|
311
|
-
!
|
|
312
|
-
const
|
|
313
|
-
let
|
|
314
|
-
if (d &&
|
|
315
|
-
const
|
|
316
|
-
|
|
311
|
+
const m = Ee(r), y = oe(i), p = Ee(i) === i, f = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), x = g || (p || !w ? [We(i)] : Nn(i)), v = E !== "none";
|
|
312
|
+
!g && v && x.push(...Hn(i, w, E, f));
|
|
313
|
+
const S = [i, ...x], _ = await a.detectOverflow(t, T), b = [];
|
|
314
|
+
let L = ((s = o.flip) == null ? void 0 : s.overflows) || [];
|
|
315
|
+
if (d && b.push(_[m]), u) {
|
|
316
|
+
const V = jn(r, l, f);
|
|
317
|
+
b.push(_[V[0]], _[V[1]]);
|
|
317
318
|
}
|
|
318
|
-
if (
|
|
319
|
+
if (L = [...L, {
|
|
319
320
|
placement: r,
|
|
320
|
-
overflows:
|
|
321
|
-
}], !
|
|
322
|
-
var
|
|
323
|
-
const
|
|
324
|
-
if (
|
|
321
|
+
overflows: b
|
|
322
|
+
}], !b.every((V) => V <= 0)) {
|
|
323
|
+
var $, N;
|
|
324
|
+
const V = ((($ = o.flip) == null ? void 0 : $.index) || 0) + 1, Je = S[V];
|
|
325
|
+
if (Je && (!(u === "alignment" ? y !== oe(Je) : !1) || // We leave the current main axis only if every placement on that axis
|
|
325
326
|
// overflows the main axis.
|
|
326
|
-
|
|
327
|
+
L.every((H) => oe(H.placement) === y ? H.overflows[0] > 0 : !0)))
|
|
327
328
|
return {
|
|
328
329
|
data: {
|
|
329
|
-
index:
|
|
330
|
-
overflows:
|
|
330
|
+
index: V,
|
|
331
|
+
overflows: L
|
|
331
332
|
},
|
|
332
333
|
reset: {
|
|
333
|
-
placement:
|
|
334
|
+
placement: Je
|
|
334
335
|
}
|
|
335
336
|
};
|
|
336
|
-
let
|
|
337
|
-
if (!
|
|
338
|
-
switch (
|
|
337
|
+
let _e = (N = L.filter((ce) => ce.overflows[0] <= 0).sort((ce, H) => ce.overflows[1] - H.overflows[1])[0]) == null ? void 0 : N.placement;
|
|
338
|
+
if (!_e)
|
|
339
|
+
switch (h) {
|
|
339
340
|
case "bestFit": {
|
|
340
|
-
var
|
|
341
|
-
const
|
|
342
|
-
if (
|
|
343
|
-
const
|
|
344
|
-
return
|
|
341
|
+
var Se;
|
|
342
|
+
const ce = (Se = L.filter((H) => {
|
|
343
|
+
if (v) {
|
|
344
|
+
const ne = oe(H.placement);
|
|
345
|
+
return ne === y || // Create a bias to the `y` side axis due to horizontal
|
|
345
346
|
// reading directions favoring greater width.
|
|
346
|
-
|
|
347
|
+
ne === "y";
|
|
347
348
|
}
|
|
348
349
|
return !0;
|
|
349
|
-
}).map((
|
|
350
|
-
|
|
350
|
+
}).map((H) => [H.placement, H.overflows.filter((ne) => ne > 0).reduce((ne, rn) => ne + rn, 0)]).sort((H, ne) => H[1] - ne[1])[0]) == null ? void 0 : Se[0];
|
|
351
|
+
ce && (_e = ce);
|
|
351
352
|
break;
|
|
352
353
|
}
|
|
353
354
|
case "initialPlacement":
|
|
354
|
-
|
|
355
|
+
_e = i;
|
|
355
356
|
break;
|
|
356
357
|
}
|
|
357
|
-
if (r !==
|
|
358
|
+
if (r !== _e)
|
|
358
359
|
return {
|
|
359
360
|
reset: {
|
|
360
|
-
placement:
|
|
361
|
+
placement: _e
|
|
361
362
|
}
|
|
362
363
|
};
|
|
363
364
|
}
|
|
364
365
|
return {};
|
|
365
366
|
}
|
|
366
367
|
};
|
|
367
|
-
},
|
|
368
|
-
async function
|
|
368
|
+
}, Yn = /* @__PURE__ */ new Set(["left", "top"]);
|
|
369
|
+
async function Zn(e, t) {
|
|
369
370
|
const {
|
|
370
371
|
placement: n,
|
|
371
372
|
platform: s,
|
|
372
373
|
elements: r
|
|
373
|
-
} = e, o = await (s.isRTL == null ? void 0 : s.isRTL(r.floating)), l =
|
|
374
|
+
} = e, o = await (s.isRTL == null ? void 0 : s.isRTL(r.floating)), l = Ee(n), i = Ve(n), a = oe(n) === "y", c = Yn.has(l) ? -1 : 1, d = o && a ? -1 : 1, u = Fe(t, e);
|
|
374
375
|
let {
|
|
375
|
-
mainAxis:
|
|
376
|
-
crossAxis:
|
|
376
|
+
mainAxis: g,
|
|
377
|
+
crossAxis: h,
|
|
377
378
|
alignmentAxis: E
|
|
378
379
|
} = typeof u == "number" ? {
|
|
379
380
|
mainAxis: u,
|
|
@@ -384,15 +385,15 @@ async function Un(e, t) {
|
|
|
384
385
|
crossAxis: u.crossAxis || 0,
|
|
385
386
|
alignmentAxis: u.alignmentAxis
|
|
386
387
|
};
|
|
387
|
-
return i && typeof E == "number" && (
|
|
388
|
-
x:
|
|
389
|
-
y:
|
|
388
|
+
return i && typeof E == "number" && (h = i === "end" ? E * -1 : E), a ? {
|
|
389
|
+
x: h * d,
|
|
390
|
+
y: g * c
|
|
390
391
|
} : {
|
|
391
|
-
x:
|
|
392
|
-
y:
|
|
392
|
+
x: g * c,
|
|
393
|
+
y: h * d
|
|
393
394
|
};
|
|
394
395
|
}
|
|
395
|
-
const
|
|
396
|
+
const Jn = function(e) {
|
|
396
397
|
return e === void 0 && (e = 0), {
|
|
397
398
|
name: "offset",
|
|
398
399
|
options: e,
|
|
@@ -403,7 +404,7 @@ const Xn = function(e) {
|
|
|
403
404
|
y: o,
|
|
404
405
|
placement: l,
|
|
405
406
|
middlewareData: i
|
|
406
|
-
} = t, a = await
|
|
407
|
+
} = t, a = await Zn(t, e);
|
|
407
408
|
return l === ((n = i.offset) == null ? void 0 : n.placement) && (s = i.arrow) != null && s.alignmentOffset ? {} : {
|
|
408
409
|
x: r + a.x,
|
|
409
410
|
y: o + a.y,
|
|
@@ -414,7 +415,7 @@ const Xn = function(e) {
|
|
|
414
415
|
};
|
|
415
416
|
}
|
|
416
417
|
};
|
|
417
|
-
},
|
|
418
|
+
}, Qn = function(e) {
|
|
418
419
|
return e === void 0 && (e = {}), {
|
|
419
420
|
name: "shift",
|
|
420
421
|
options: e,
|
|
@@ -428,11 +429,11 @@ const Xn = function(e) {
|
|
|
428
429
|
mainAxis: l = !0,
|
|
429
430
|
crossAxis: i = !1,
|
|
430
431
|
limiter: a = {
|
|
431
|
-
fn: (
|
|
432
|
+
fn: (y) => {
|
|
432
433
|
let {
|
|
433
434
|
x: p,
|
|
434
435
|
y: f
|
|
435
|
-
} =
|
|
436
|
+
} = y;
|
|
436
437
|
return {
|
|
437
438
|
x: p,
|
|
438
439
|
y: f
|
|
@@ -440,71 +441,71 @@ const Xn = function(e) {
|
|
|
440
441
|
}
|
|
441
442
|
},
|
|
442
443
|
...c
|
|
443
|
-
} =
|
|
444
|
+
} = Fe(e, t), d = {
|
|
444
445
|
x: n,
|
|
445
446
|
y: s
|
|
446
|
-
}, u = await o.detectOverflow(t, c),
|
|
447
|
-
let E = d[
|
|
448
|
-
const
|
|
449
|
-
l && (E =
|
|
450
|
-
const
|
|
447
|
+
}, u = await o.detectOverflow(t, c), g = oe(r), h = Bt(g);
|
|
448
|
+
let E = d[h], w = d[g];
|
|
449
|
+
const T = (y, p) => $n(p + u[y === "y" ? "top" : "left"], p, p - u[y === "y" ? "bottom" : "right"]);
|
|
450
|
+
l && (E = T(h, E)), i && (w = T(g, w));
|
|
451
|
+
const m = a.fn({
|
|
451
452
|
...t,
|
|
452
|
-
[
|
|
453
|
-
[
|
|
453
|
+
[h]: E,
|
|
454
|
+
[g]: w
|
|
454
455
|
});
|
|
455
456
|
return {
|
|
456
|
-
...
|
|
457
|
+
...m,
|
|
457
458
|
data: {
|
|
458
|
-
x:
|
|
459
|
-
y:
|
|
459
|
+
x: m.x - n,
|
|
460
|
+
y: m.y - s,
|
|
460
461
|
enabled: {
|
|
461
|
-
[
|
|
462
|
-
[
|
|
462
|
+
[h]: l,
|
|
463
|
+
[g]: i
|
|
463
464
|
}
|
|
464
465
|
}
|
|
465
466
|
};
|
|
466
467
|
}
|
|
467
468
|
};
|
|
468
469
|
};
|
|
469
|
-
function
|
|
470
|
+
function Ge() {
|
|
470
471
|
return typeof window < "u";
|
|
471
472
|
}
|
|
472
473
|
function Ae(e) {
|
|
473
474
|
return Nt(e) ? (e.nodeName || "").toLowerCase() : "#document";
|
|
474
475
|
}
|
|
475
|
-
function
|
|
476
|
+
function W(e) {
|
|
476
477
|
var t;
|
|
477
478
|
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
478
479
|
}
|
|
479
|
-
function
|
|
480
|
+
function te(e) {
|
|
480
481
|
var t;
|
|
481
482
|
return (t = (Nt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
|
|
482
483
|
}
|
|
483
484
|
function Nt(e) {
|
|
484
|
-
return
|
|
485
|
+
return Ge() ? e instanceof Node || e instanceof W(e).Node : !1;
|
|
485
486
|
}
|
|
486
|
-
function
|
|
487
|
-
return
|
|
487
|
+
function X(e) {
|
|
488
|
+
return Ge() ? e instanceof Element || e instanceof W(e).Element : !1;
|
|
488
489
|
}
|
|
489
|
-
function
|
|
490
|
-
return
|
|
490
|
+
function le(e) {
|
|
491
|
+
return Ge() ? e instanceof HTMLElement || e instanceof W(e).HTMLElement : !1;
|
|
491
492
|
}
|
|
492
493
|
function wt(e) {
|
|
493
|
-
return !
|
|
494
|
+
return !Ge() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof W(e).ShadowRoot;
|
|
494
495
|
}
|
|
495
|
-
function
|
|
496
|
+
function Ue(e) {
|
|
496
497
|
const {
|
|
497
498
|
overflow: t,
|
|
498
499
|
overflowX: n,
|
|
499
500
|
overflowY: s,
|
|
500
501
|
display: r
|
|
501
|
-
} =
|
|
502
|
+
} = Y(e);
|
|
502
503
|
return /auto|scroll|overlay|hidden|clip/.test(t + s + n) && r !== "inline" && r !== "contents";
|
|
503
504
|
}
|
|
504
|
-
function
|
|
505
|
+
function eo(e) {
|
|
505
506
|
return /^(table|td|th)$/.test(Ae(e));
|
|
506
507
|
}
|
|
507
|
-
function
|
|
508
|
+
function Xe(e) {
|
|
508
509
|
try {
|
|
509
510
|
if (e.matches(":popover-open"))
|
|
510
511
|
return !0;
|
|
@@ -516,34 +517,34 @@ function Ge(e) {
|
|
|
516
517
|
return !1;
|
|
517
518
|
}
|
|
518
519
|
}
|
|
519
|
-
const
|
|
520
|
-
let
|
|
521
|
-
function
|
|
522
|
-
const t =
|
|
523
|
-
return
|
|
520
|
+
const to = /transform|translate|scale|rotate|perspective|filter/, no = /paint|layout|strict|content/, ue = (e) => !!e && e !== "none";
|
|
521
|
+
let Qe;
|
|
522
|
+
function dt(e) {
|
|
523
|
+
const t = X(e) ? Y(e) : e;
|
|
524
|
+
return ue(t.transform) || ue(t.translate) || ue(t.scale) || ue(t.rotate) || ue(t.perspective) || !ft() && (ue(t.backdropFilter) || ue(t.filter)) || to.test(t.willChange || "") || no.test(t.contain || "");
|
|
524
525
|
}
|
|
525
|
-
function
|
|
526
|
-
let t =
|
|
527
|
-
for (;
|
|
528
|
-
if (
|
|
526
|
+
function oo(e) {
|
|
527
|
+
let t = xe(e);
|
|
528
|
+
for (; le(t) && !Me(t); ) {
|
|
529
|
+
if (dt(t))
|
|
529
530
|
return t;
|
|
530
|
-
if (
|
|
531
|
+
if (Xe(t))
|
|
531
532
|
return null;
|
|
532
|
-
t =
|
|
533
|
+
t = xe(t);
|
|
533
534
|
}
|
|
534
535
|
return null;
|
|
535
536
|
}
|
|
536
|
-
function
|
|
537
|
-
return
|
|
537
|
+
function ft() {
|
|
538
|
+
return Qe == null && (Qe = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), Qe;
|
|
538
539
|
}
|
|
539
|
-
function
|
|
540
|
+
function Me(e) {
|
|
540
541
|
return /^(html|body|#document)$/.test(Ae(e));
|
|
541
542
|
}
|
|
542
|
-
function
|
|
543
|
-
return
|
|
543
|
+
function Y(e) {
|
|
544
|
+
return W(e).getComputedStyle(e);
|
|
544
545
|
}
|
|
545
|
-
function
|
|
546
|
-
return
|
|
546
|
+
function Ye(e) {
|
|
547
|
+
return X(e) ? {
|
|
547
548
|
scrollLeft: e.scrollLeft,
|
|
548
549
|
scrollTop: e.scrollTop
|
|
549
550
|
} : {
|
|
@@ -551,7 +552,7 @@ function Ue(e) {
|
|
|
551
552
|
scrollTop: e.scrollY
|
|
552
553
|
};
|
|
553
554
|
}
|
|
554
|
-
function
|
|
555
|
+
function xe(e) {
|
|
555
556
|
if (Ae(e) === "html")
|
|
556
557
|
return e;
|
|
557
558
|
const t = (
|
|
@@ -559,152 +560,152 @@ function ge(e) {
|
|
|
559
560
|
e.assignedSlot || // DOM Element detected.
|
|
560
561
|
e.parentNode || // ShadowRoot detected.
|
|
561
562
|
wt(e) && e.host || // Fallback.
|
|
562
|
-
|
|
563
|
+
te(e)
|
|
563
564
|
);
|
|
564
565
|
return wt(t) ? t.host : t;
|
|
565
566
|
}
|
|
566
567
|
function Wt(e) {
|
|
567
|
-
const t =
|
|
568
|
-
return
|
|
568
|
+
const t = xe(e);
|
|
569
|
+
return Me(t) ? (e.ownerDocument || e).body : le(t) && Ue(t) ? t : Wt(t);
|
|
569
570
|
}
|
|
570
|
-
function
|
|
571
|
+
function Re(e, t, n) {
|
|
571
572
|
var s;
|
|
572
573
|
t === void 0 && (t = []), n === void 0 && (n = !0);
|
|
573
|
-
const r = Wt(e), o = r === ((s = e.ownerDocument) == null ? void 0 : s.body), l =
|
|
574
|
+
const r = Wt(e), o = r === ((s = e.ownerDocument) == null ? void 0 : s.body), l = W(r);
|
|
574
575
|
if (o) {
|
|
575
|
-
const i =
|
|
576
|
-
return t.concat(l, l.visualViewport || [],
|
|
576
|
+
const i = st(l);
|
|
577
|
+
return t.concat(l, l.visualViewport || [], Ue(r) ? r : [], i && n ? Re(i) : []);
|
|
577
578
|
} else
|
|
578
|
-
return t.concat(r,
|
|
579
|
+
return t.concat(r, Re(r, [], n));
|
|
579
580
|
}
|
|
580
|
-
function
|
|
581
|
+
function st(e) {
|
|
581
582
|
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
|
|
582
583
|
}
|
|
583
584
|
function Kt(e) {
|
|
584
|
-
const t =
|
|
585
|
+
const t = Y(e);
|
|
585
586
|
let n = parseFloat(t.width) || 0, s = parseFloat(t.height) || 0;
|
|
586
|
-
const r =
|
|
587
|
+
const r = le(e), o = r ? e.offsetWidth : n, l = r ? e.offsetHeight : s, i = Ne(n) !== o || Ne(s) !== l;
|
|
587
588
|
return i && (n = o, s = l), {
|
|
588
589
|
width: n,
|
|
589
590
|
height: s,
|
|
590
591
|
$: i
|
|
591
592
|
};
|
|
592
593
|
}
|
|
593
|
-
function
|
|
594
|
-
return
|
|
594
|
+
function pt(e) {
|
|
595
|
+
return X(e) ? e : e.contextElement;
|
|
595
596
|
}
|
|
596
|
-
function
|
|
597
|
-
const t =
|
|
598
|
-
if (!
|
|
599
|
-
return
|
|
597
|
+
function Te(e) {
|
|
598
|
+
const t = pt(e);
|
|
599
|
+
if (!le(t))
|
|
600
|
+
return ee(1);
|
|
600
601
|
const n = t.getBoundingClientRect(), {
|
|
601
602
|
width: s,
|
|
602
603
|
height: r,
|
|
603
604
|
$: o
|
|
604
605
|
} = Kt(t);
|
|
605
|
-
let l = (o ?
|
|
606
|
+
let l = (o ? Ne(n.width) : n.width) / s, i = (o ? Ne(n.height) : n.height) / r;
|
|
606
607
|
return (!l || !Number.isFinite(l)) && (l = 1), (!i || !Number.isFinite(i)) && (i = 1), {
|
|
607
608
|
x: l,
|
|
608
609
|
y: i
|
|
609
610
|
};
|
|
610
611
|
}
|
|
611
|
-
const
|
|
612
|
+
const so = /* @__PURE__ */ ee(0);
|
|
612
613
|
function qt(e) {
|
|
613
|
-
const t =
|
|
614
|
-
return !
|
|
614
|
+
const t = W(e);
|
|
615
|
+
return !ft() || !t.visualViewport ? so : {
|
|
615
616
|
x: t.visualViewport.offsetLeft,
|
|
616
617
|
y: t.visualViewport.offsetTop
|
|
617
618
|
};
|
|
618
619
|
}
|
|
619
|
-
function
|
|
620
|
-
return t === void 0 && (t = !1), !!n && t && n ===
|
|
620
|
+
function ro(e, t, n) {
|
|
621
|
+
return t === void 0 && (t = !1), !!n && t && n === W(e);
|
|
621
622
|
}
|
|
622
|
-
function
|
|
623
|
+
function ye(e, t, n, s) {
|
|
623
624
|
t === void 0 && (t = !1), n === void 0 && (n = !1);
|
|
624
|
-
const r = e.getBoundingClientRect(), o =
|
|
625
|
-
let l =
|
|
626
|
-
t && (s ?
|
|
627
|
-
const i =
|
|
625
|
+
const r = e.getBoundingClientRect(), o = pt(e);
|
|
626
|
+
let l = ee(1);
|
|
627
|
+
t && (s ? X(s) && (l = Te(s)) : l = Te(e));
|
|
628
|
+
const i = ro(o, n, s) ? qt(o) : ee(0);
|
|
628
629
|
let a = (r.left + i.x) / l.x, c = (r.top + i.y) / l.y, d = r.width / l.x, u = r.height / l.y;
|
|
629
630
|
if (o && s) {
|
|
630
|
-
const
|
|
631
|
-
let E =
|
|
632
|
-
for (;
|
|
633
|
-
const
|
|
634
|
-
a *=
|
|
631
|
+
const g = W(o), h = X(s) ? W(s) : s;
|
|
632
|
+
let E = g, w = st(E);
|
|
633
|
+
for (; w && h !== E; ) {
|
|
634
|
+
const T = Te(w), m = w.getBoundingClientRect(), y = Y(w), p = m.left + (w.clientLeft + parseFloat(y.paddingLeft)) * T.x, f = m.top + (w.clientTop + parseFloat(y.paddingTop)) * T.y;
|
|
635
|
+
a *= T.x, c *= T.y, d *= T.x, u *= T.y, a += p, c += f, E = W(w), w = st(E);
|
|
635
636
|
}
|
|
636
637
|
}
|
|
637
|
-
return
|
|
638
|
+
return Ke({
|
|
638
639
|
width: d,
|
|
639
640
|
height: u,
|
|
640
641
|
x: a,
|
|
641
642
|
y: c
|
|
642
643
|
});
|
|
643
644
|
}
|
|
644
|
-
function
|
|
645
|
-
const n =
|
|
646
|
-
return t ? t.left + n :
|
|
645
|
+
function Ze(e, t) {
|
|
646
|
+
const n = Ye(e).scrollLeft;
|
|
647
|
+
return t ? t.left + n : ye(te(e)).left + n;
|
|
647
648
|
}
|
|
648
649
|
function Ht(e, t) {
|
|
649
|
-
const n = e.getBoundingClientRect(), s = n.left + t.scrollLeft -
|
|
650
|
+
const n = e.getBoundingClientRect(), s = n.left + t.scrollLeft - Ze(e, n), r = n.top + t.scrollTop;
|
|
650
651
|
return {
|
|
651
652
|
x: s,
|
|
652
653
|
y: r
|
|
653
654
|
};
|
|
654
655
|
}
|
|
655
|
-
function
|
|
656
|
+
function io(e) {
|
|
656
657
|
let {
|
|
657
658
|
elements: t,
|
|
658
659
|
rect: n,
|
|
659
660
|
offsetParent: s,
|
|
660
661
|
strategy: r
|
|
661
662
|
} = e;
|
|
662
|
-
const o = r === "fixed", l =
|
|
663
|
+
const o = r === "fixed", l = te(s), i = t ? Xe(t.floating) : !1;
|
|
663
664
|
if (s === l || i && o)
|
|
664
665
|
return n;
|
|
665
666
|
let a = {
|
|
666
667
|
scrollLeft: 0,
|
|
667
668
|
scrollTop: 0
|
|
668
|
-
}, c =
|
|
669
|
-
const d =
|
|
670
|
-
if ((u || !o) && ((Ae(s) !== "body" ||
|
|
671
|
-
const
|
|
672
|
-
c =
|
|
669
|
+
}, c = ee(1);
|
|
670
|
+
const d = ee(0), u = le(s);
|
|
671
|
+
if ((u || !o) && ((Ae(s) !== "body" || Ue(l)) && (a = Ye(s)), u)) {
|
|
672
|
+
const h = ye(s);
|
|
673
|
+
c = Te(s), d.x = h.x + s.clientLeft, d.y = h.y + s.clientTop;
|
|
673
674
|
}
|
|
674
|
-
const
|
|
675
|
+
const g = l && !u && !o ? Ht(l, a) : ee(0);
|
|
675
676
|
return {
|
|
676
677
|
width: n.width * c.x,
|
|
677
678
|
height: n.height * c.y,
|
|
678
|
-
x: n.x * c.x - a.scrollLeft * c.x + d.x +
|
|
679
|
-
y: n.y * c.y - a.scrollTop * c.y + d.y +
|
|
679
|
+
x: n.x * c.x - a.scrollLeft * c.x + d.x + g.x,
|
|
680
|
+
y: n.y * c.y - a.scrollTop * c.y + d.y + g.y
|
|
680
681
|
};
|
|
681
682
|
}
|
|
682
|
-
function
|
|
683
|
+
function lo(e) {
|
|
683
684
|
return e.getClientRects ? Array.from(e.getClientRects()) : [];
|
|
684
685
|
}
|
|
685
|
-
function
|
|
686
|
-
const t =
|
|
687
|
-
let o = -t.scrollLeft +
|
|
686
|
+
function ao(e) {
|
|
687
|
+
const t = Ye(e), n = e.ownerDocument.body, s = fe(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), r = fe(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
|
|
688
|
+
let o = -t.scrollLeft + Ze(e);
|
|
688
689
|
const l = -t.scrollTop;
|
|
689
|
-
return
|
|
690
|
+
return Y(n).direction === "rtl" && (o += fe(e.clientWidth, n.clientWidth) - s), {
|
|
690
691
|
width: s,
|
|
691
692
|
height: r,
|
|
692
693
|
x: o,
|
|
693
694
|
y: l
|
|
694
695
|
};
|
|
695
696
|
}
|
|
696
|
-
const
|
|
697
|
-
function
|
|
697
|
+
const co = 25;
|
|
698
|
+
function uo(e, t, n) {
|
|
698
699
|
n === void 0 && (n = "viewport");
|
|
699
|
-
const s = n === "layoutViewport", r =
|
|
700
|
+
const s = n === "layoutViewport", r = W(e), o = te(e), l = r.visualViewport;
|
|
700
701
|
let i = o.clientWidth, a = o.clientHeight, c = 0, d = 0;
|
|
701
702
|
if (l) {
|
|
702
|
-
const
|
|
703
|
-
s ?
|
|
703
|
+
const g = !ft() || t === "fixed";
|
|
704
|
+
s ? g || (c = -l.offsetLeft, d = -l.offsetTop) : (i = l.width, a = l.height, g && (c = l.offsetLeft, d = l.offsetTop));
|
|
704
705
|
}
|
|
705
|
-
if (
|
|
706
|
-
const
|
|
707
|
-
|
|
706
|
+
if (Ze(o) <= 0) {
|
|
707
|
+
const g = o.ownerDocument, h = g.body, E = getComputedStyle(h), w = g.compatMode === "CSS1Compat" && parseFloat(E.marginLeft) + parseFloat(E.marginRight) || 0, T = Math.abs(o.clientWidth - h.clientWidth - w), m = getComputedStyle(o).scrollbarGutter === "stable both-edges" ? T / 2 : T;
|
|
708
|
+
m <= co && (i -= m);
|
|
708
709
|
}
|
|
709
710
|
return {
|
|
710
711
|
width: i,
|
|
@@ -713,8 +714,8 @@ function lo(e, t, n) {
|
|
|
713
714
|
y: d
|
|
714
715
|
};
|
|
715
716
|
}
|
|
716
|
-
function
|
|
717
|
-
const n =
|
|
717
|
+
function fo(e, t) {
|
|
718
|
+
const n = ye(e, !0, t === "fixed"), s = n.top + e.clientTop, r = n.left + e.clientLeft, o = Te(e), l = e.clientWidth * o.x, i = e.clientHeight * o.y, a = r * o.x, c = s * o.y;
|
|
718
719
|
return {
|
|
719
720
|
width: l,
|
|
720
721
|
height: i,
|
|
@@ -722,14 +723,14 @@ function ao(e, t) {
|
|
|
722
723
|
y: c
|
|
723
724
|
};
|
|
724
725
|
}
|
|
725
|
-
function
|
|
726
|
+
function Ct(e, t, n) {
|
|
726
727
|
let s;
|
|
727
728
|
if (t === "viewport" || t === "layoutViewport")
|
|
728
|
-
s =
|
|
729
|
+
s = uo(e, n, t);
|
|
729
730
|
else if (t === "document")
|
|
730
|
-
s =
|
|
731
|
-
else if (
|
|
732
|
-
s =
|
|
731
|
+
s = ao(te(e));
|
|
732
|
+
else if (X(t))
|
|
733
|
+
s = fo(t, n);
|
|
733
734
|
else {
|
|
734
735
|
const r = qt(e);
|
|
735
736
|
s = {
|
|
@@ -739,33 +740,33 @@ function At(e, t, n) {
|
|
|
739
740
|
height: t.height
|
|
740
741
|
};
|
|
741
742
|
}
|
|
742
|
-
return
|
|
743
|
+
return Ke(s);
|
|
743
744
|
}
|
|
744
|
-
function
|
|
745
|
+
function po(e, t) {
|
|
745
746
|
const n = t.get(e);
|
|
746
747
|
if (n)
|
|
747
748
|
return n;
|
|
748
|
-
let s =
|
|
749
|
-
const o =
|
|
750
|
-
let l = o ?
|
|
751
|
-
for (;
|
|
752
|
-
const i =
|
|
753
|
-
!a && (c === "fixed" || c === "absolute" && i.position === "static") ? s = s.filter((u) => u !== l) : r = i, l =
|
|
749
|
+
let s = Re(e, [], !1).filter((i) => X(i) && Ae(i) !== "body"), r = null;
|
|
750
|
+
const o = Y(e).position === "fixed";
|
|
751
|
+
let l = o ? xe(e) : e;
|
|
752
|
+
for (; X(l) && !Me(l); ) {
|
|
753
|
+
const i = Y(l), a = dt(l), c = r ? r.position : o ? "fixed" : "";
|
|
754
|
+
!a && (c === "fixed" || c === "absolute" && i.position === "static") ? s = s.filter((u) => u !== l) : r = i, l = xe(l);
|
|
754
755
|
}
|
|
755
756
|
return t.set(e, s), s;
|
|
756
757
|
}
|
|
757
|
-
function
|
|
758
|
+
function mo(e) {
|
|
758
759
|
let {
|
|
759
760
|
element: t,
|
|
760
761
|
boundary: n,
|
|
761
762
|
rootBoundary: s,
|
|
762
763
|
strategy: r
|
|
763
764
|
} = e;
|
|
764
|
-
const l = [...n === "clippingAncestors" ?
|
|
765
|
+
const l = [...n === "clippingAncestors" ? Xe(t) ? [] : po(t, this._c) : [].concat(n), s], i = Ct(t, l[0], r);
|
|
765
766
|
let a = i.top, c = i.right, d = i.bottom, u = i.left;
|
|
766
|
-
for (let
|
|
767
|
-
const
|
|
768
|
-
a =
|
|
767
|
+
for (let g = 1; g < l.length; g++) {
|
|
768
|
+
const h = Ct(t, l[g], r);
|
|
769
|
+
a = fe(h.top, a), c = je(h.right, c), d = je(h.bottom, d), u = fe(h.left, u);
|
|
769
770
|
}
|
|
770
771
|
return {
|
|
771
772
|
width: c - u,
|
|
@@ -774,7 +775,7 @@ function uo(e) {
|
|
|
774
775
|
y: a
|
|
775
776
|
};
|
|
776
777
|
}
|
|
777
|
-
function
|
|
778
|
+
function ho(e) {
|
|
778
779
|
const {
|
|
779
780
|
width: t,
|
|
780
781
|
height: n
|
|
@@ -784,19 +785,19 @@ function fo(e) {
|
|
|
784
785
|
height: n
|
|
785
786
|
};
|
|
786
787
|
}
|
|
787
|
-
function
|
|
788
|
-
const s =
|
|
788
|
+
function go(e, t, n) {
|
|
789
|
+
const s = le(t), r = te(t), o = n === "fixed", l = ye(e, !0, o, t);
|
|
789
790
|
let i = {
|
|
790
791
|
scrollLeft: 0,
|
|
791
792
|
scrollTop: 0
|
|
792
793
|
};
|
|
793
|
-
const a =
|
|
794
|
-
if ((s || !o) && ((Ae(t) !== "body" ||
|
|
795
|
-
const
|
|
796
|
-
a.x =
|
|
794
|
+
const a = ee(0);
|
|
795
|
+
if ((s || !o) && ((Ae(t) !== "body" || Ue(r)) && (i = Ye(t)), s)) {
|
|
796
|
+
const g = ye(t, !0, o, t);
|
|
797
|
+
a.x = g.x + t.clientLeft, a.y = g.y + t.clientTop;
|
|
797
798
|
}
|
|
798
|
-
!s && r && (a.x =
|
|
799
|
-
const c = r && !s && !o ? Ht(r, i) :
|
|
799
|
+
!s && r && (a.x = Ze(r));
|
|
800
|
+
const c = r && !s && !o ? Ht(r, i) : ee(0), d = l.left + i.scrollLeft - a.x - c.x, u = l.top + i.scrollTop - a.y - c.y;
|
|
800
801
|
return {
|
|
801
802
|
x: d,
|
|
802
803
|
y: u,
|
|
@@ -804,39 +805,39 @@ function po(e, t, n) {
|
|
|
804
805
|
height: l.height
|
|
805
806
|
};
|
|
806
807
|
}
|
|
807
|
-
function
|
|
808
|
-
return
|
|
808
|
+
function et(e) {
|
|
809
|
+
return Y(e).position === "static";
|
|
809
810
|
}
|
|
810
|
-
function
|
|
811
|
-
if (!
|
|
811
|
+
function At(e, t) {
|
|
812
|
+
if (!le(e) || Y(e).position === "fixed")
|
|
812
813
|
return null;
|
|
813
814
|
if (t)
|
|
814
815
|
return t(e);
|
|
815
816
|
let n = e.offsetParent;
|
|
816
|
-
return
|
|
817
|
+
return te(e) === n && (n = n.ownerDocument.body), n;
|
|
817
818
|
}
|
|
818
819
|
function zt(e, t) {
|
|
819
|
-
const n =
|
|
820
|
-
if (
|
|
820
|
+
const n = W(e);
|
|
821
|
+
if (Xe(e))
|
|
821
822
|
return n;
|
|
822
|
-
if (!
|
|
823
|
-
let r =
|
|
824
|
-
for (; r && !
|
|
825
|
-
if (
|
|
823
|
+
if (!le(e)) {
|
|
824
|
+
let r = xe(e);
|
|
825
|
+
for (; r && !Me(r); ) {
|
|
826
|
+
if (X(r) && !et(r))
|
|
826
827
|
return r;
|
|
827
|
-
r =
|
|
828
|
+
r = xe(r);
|
|
828
829
|
}
|
|
829
830
|
return n;
|
|
830
831
|
}
|
|
831
|
-
let s =
|
|
832
|
-
for (; s &&
|
|
833
|
-
s =
|
|
834
|
-
return s &&
|
|
832
|
+
let s = At(e, t);
|
|
833
|
+
for (; s && eo(s) && et(s); )
|
|
834
|
+
s = At(s, t);
|
|
835
|
+
return s && Me(s) && et(s) && !dt(s) ? n : s || oo(e) || n;
|
|
835
836
|
}
|
|
836
|
-
const
|
|
837
|
+
const xo = async function(e) {
|
|
837
838
|
const t = this.getOffsetParent || zt, n = this.getDimensions, s = await n(e.floating);
|
|
838
839
|
return {
|
|
839
|
-
reference:
|
|
840
|
+
reference: go(e.reference, await t(e.floating), e.strategy),
|
|
840
841
|
floating: {
|
|
841
842
|
x: 0,
|
|
842
843
|
y: 0,
|
|
@@ -845,76 +846,76 @@ const mo = async function(e) {
|
|
|
845
846
|
}
|
|
846
847
|
};
|
|
847
848
|
};
|
|
848
|
-
function
|
|
849
|
-
return
|
|
849
|
+
function yo(e) {
|
|
850
|
+
return Y(e).direction === "rtl";
|
|
850
851
|
}
|
|
851
|
-
const
|
|
852
|
-
convertOffsetParentRelativeRectToViewportRelativeRect:
|
|
853
|
-
getDocumentElement:
|
|
854
|
-
getClippingRect:
|
|
852
|
+
const bo = {
|
|
853
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: io,
|
|
854
|
+
getDocumentElement: te,
|
|
855
|
+
getClippingRect: mo,
|
|
855
856
|
getOffsetParent: zt,
|
|
856
|
-
getElementRects:
|
|
857
|
-
getClientRects:
|
|
858
|
-
getDimensions:
|
|
859
|
-
getScale:
|
|
860
|
-
isElement:
|
|
861
|
-
isRTL:
|
|
857
|
+
getElementRects: xo,
|
|
858
|
+
getClientRects: lo,
|
|
859
|
+
getDimensions: ho,
|
|
860
|
+
getScale: Te,
|
|
861
|
+
isElement: X,
|
|
862
|
+
isRTL: yo
|
|
862
863
|
};
|
|
863
864
|
function Ft(e, t) {
|
|
864
865
|
return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
|
|
865
866
|
}
|
|
866
|
-
function
|
|
867
|
+
function vo(e, t, n) {
|
|
867
868
|
let s = null, r;
|
|
868
|
-
const o =
|
|
869
|
+
const o = te(e);
|
|
869
870
|
function l() {
|
|
870
871
|
var d;
|
|
871
872
|
clearTimeout(r), (d = s) == null || d.disconnect(), s = null;
|
|
872
873
|
}
|
|
873
874
|
function i(d, u) {
|
|
874
875
|
d === void 0 && (d = !1), u === void 0 && (u = 1), l();
|
|
875
|
-
const
|
|
876
|
-
left:
|
|
876
|
+
const g = e.getBoundingClientRect(), {
|
|
877
|
+
left: h,
|
|
877
878
|
top: E,
|
|
878
|
-
width:
|
|
879
|
-
height:
|
|
880
|
-
} =
|
|
881
|
-
if (d || t(), !
|
|
879
|
+
width: w,
|
|
880
|
+
height: T
|
|
881
|
+
} = g;
|
|
882
|
+
if (d || t(), !w || !T)
|
|
882
883
|
return;
|
|
883
|
-
const
|
|
884
|
-
rootMargin: -
|
|
885
|
-
threshold:
|
|
884
|
+
const m = Oe(E), y = Oe(o.clientWidth - (h + w)), p = Oe(o.clientHeight - (E + T)), f = Oe(h), v = {
|
|
885
|
+
rootMargin: -m + "px " + -y + "px " + -p + "px " + -f + "px",
|
|
886
|
+
threshold: fe(0, je(1, u)) || 1
|
|
886
887
|
};
|
|
887
|
-
let
|
|
888
|
-
function
|
|
889
|
-
const
|
|
890
|
-
if (!Ft(
|
|
888
|
+
let S = !0;
|
|
889
|
+
function _(b) {
|
|
890
|
+
const L = b[0].intersectionRatio;
|
|
891
|
+
if (!Ft(g, e.getBoundingClientRect()))
|
|
891
892
|
return i();
|
|
892
|
-
if (
|
|
893
|
-
if (!
|
|
893
|
+
if (L !== u) {
|
|
894
|
+
if (!S)
|
|
894
895
|
return i();
|
|
895
|
-
|
|
896
|
+
L ? i(!1, L) : r = setTimeout(() => {
|
|
896
897
|
i(!1, 1e-7);
|
|
897
898
|
}, 1e3);
|
|
898
899
|
}
|
|
899
|
-
|
|
900
|
+
S = !1;
|
|
900
901
|
}
|
|
901
902
|
try {
|
|
902
|
-
s = new IntersectionObserver(
|
|
903
|
-
...
|
|
903
|
+
s = new IntersectionObserver(_, {
|
|
904
|
+
...v,
|
|
904
905
|
// Handle <iframe>s
|
|
905
906
|
root: o.ownerDocument
|
|
906
907
|
});
|
|
907
908
|
} catch {
|
|
908
|
-
s = new IntersectionObserver(
|
|
909
|
+
s = new IntersectionObserver(_, v);
|
|
909
910
|
}
|
|
910
911
|
s.observe(e);
|
|
911
912
|
}
|
|
912
|
-
const a =
|
|
913
|
+
const a = W(e), c = () => i(n);
|
|
913
914
|
return a.addEventListener("resize", c), i(!0), () => {
|
|
914
915
|
a.removeEventListener("resize", c), l();
|
|
915
916
|
};
|
|
916
917
|
}
|
|
917
|
-
function
|
|
918
|
+
function mt(e, t, n, s) {
|
|
918
919
|
s === void 0 && (s = {});
|
|
919
920
|
const {
|
|
920
921
|
ancestorScroll: r = !0,
|
|
@@ -922,47 +923,47 @@ function ft(e, t, n, s) {
|
|
|
922
923
|
elementResize: l = typeof ResizeObserver == "function",
|
|
923
924
|
layoutShift: i = typeof IntersectionObserver == "function",
|
|
924
925
|
animationFrame: a = !1
|
|
925
|
-
} = s, c =
|
|
926
|
-
d.forEach((
|
|
927
|
-
r &&
|
|
926
|
+
} = s, c = pt(e), d = r || o ? [...c ? Re(c) : [], ...t ? Re(t) : []] : [];
|
|
927
|
+
d.forEach((m) => {
|
|
928
|
+
r && m.addEventListener("scroll", n), o && m.addEventListener("resize", n);
|
|
928
929
|
});
|
|
929
|
-
const u = c && i ?
|
|
930
|
-
let
|
|
931
|
-
l && (
|
|
932
|
-
let [
|
|
933
|
-
|
|
930
|
+
const u = c && i ? vo(c, n, o) : null;
|
|
931
|
+
let g = -1, h = null;
|
|
932
|
+
l && (h = new ResizeObserver((m) => {
|
|
933
|
+
let [y] = m;
|
|
934
|
+
y && y.target === c && h && t && (h.unobserve(t), cancelAnimationFrame(g), g = requestAnimationFrame(() => {
|
|
934
935
|
var p;
|
|
935
|
-
(p =
|
|
936
|
+
(p = h) == null || p.observe(t);
|
|
936
937
|
})), n();
|
|
937
|
-
}), c && !a &&
|
|
938
|
-
let E,
|
|
939
|
-
a &&
|
|
940
|
-
function
|
|
941
|
-
const
|
|
942
|
-
|
|
938
|
+
}), c && !a && h.observe(c), t && h.observe(t));
|
|
939
|
+
let E, w = a ? ye(e) : null;
|
|
940
|
+
a && T();
|
|
941
|
+
function T() {
|
|
942
|
+
const m = ye(e);
|
|
943
|
+
w && !Ft(w, m) && n(), w = m, E = requestAnimationFrame(T);
|
|
943
944
|
}
|
|
944
945
|
return n(), () => {
|
|
945
|
-
var
|
|
946
|
-
d.forEach((
|
|
947
|
-
r &&
|
|
948
|
-
}), u == null || u(), (
|
|
946
|
+
var m;
|
|
947
|
+
d.forEach((y) => {
|
|
948
|
+
r && y.removeEventListener("scroll", n), o && y.removeEventListener("resize", n);
|
|
949
|
+
}), u == null || u(), (m = h) == null || m.disconnect(), h = null, a && cancelAnimationFrame(E);
|
|
949
950
|
};
|
|
950
951
|
}
|
|
951
|
-
const
|
|
952
|
+
const ht = Jn, gt = Qn, xt = Xn, yt = (e, t, n) => {
|
|
952
953
|
const s = /* @__PURE__ */ new Map(), r = n ?? {}, o = {
|
|
953
|
-
...
|
|
954
|
+
...bo,
|
|
954
955
|
...r.platform,
|
|
955
956
|
_c: s
|
|
956
957
|
};
|
|
957
|
-
return
|
|
958
|
+
return Un(e, t, {
|
|
958
959
|
...r,
|
|
959
960
|
platform: o
|
|
960
961
|
});
|
|
961
962
|
};
|
|
962
|
-
function
|
|
963
|
+
function ve(e) {
|
|
963
964
|
return `${e}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
|
|
964
965
|
}
|
|
965
|
-
function
|
|
966
|
+
function To(e, t, n = !1) {
|
|
966
967
|
const { $from: s } = e;
|
|
967
968
|
if (!e.empty || !s.parent.isTextblock)
|
|
968
969
|
return null;
|
|
@@ -978,14 +979,14 @@ function yo(e, t, n = !1) {
|
|
|
978
979
|
query: l
|
|
979
980
|
};
|
|
980
981
|
}
|
|
981
|
-
const
|
|
982
|
+
const be = {
|
|
982
983
|
/** Template 扩展(包含 TemplateBlock 和 TemplateSelect 子扩展) */
|
|
983
984
|
TEMPLATE: "template",
|
|
984
985
|
/** Mention 扩展 */
|
|
985
986
|
MENTION: "mention",
|
|
986
987
|
/** Suggestion 扩展 */
|
|
987
988
|
SUGGESTION: "suggestion"
|
|
988
|
-
},
|
|
989
|
+
}, A = {
|
|
989
990
|
/** TemplateBlock 节点类型(可编辑块) */
|
|
990
991
|
TEMPLATE_BLOCK: "templateBlock",
|
|
991
992
|
/** TemplateSelect 节点类型(下拉选择) */
|
|
@@ -996,7 +997,7 @@ const ye = {
|
|
|
996
997
|
PARAGRAPH: "paragraph",
|
|
997
998
|
/** Text 节点类型(ProseMirror 内置) */
|
|
998
999
|
TEXT: "text"
|
|
999
|
-
},
|
|
1000
|
+
}, ae = {
|
|
1000
1001
|
/** Mention 插件 */
|
|
1001
1002
|
MENTION: "mention",
|
|
1002
1003
|
/** Suggestion 插件 */
|
|
@@ -1013,7 +1014,7 @@ const ye = {
|
|
|
1013
1014
|
TEMPLATE_BLOCK_KEYBOARD: "templateBlockKeyboard",
|
|
1014
1015
|
/** Template Block 粘贴处理插件 */
|
|
1015
1016
|
TEMPLATE_BLOCK_PASTE: "templateBlockPaste"
|
|
1016
|
-
},
|
|
1017
|
+
}, G = {
|
|
1017
1018
|
/** 文本类型 */
|
|
1018
1019
|
TEXT: "text",
|
|
1019
1020
|
/** 模板块类型(对应内部的 TemplateBlock 节点) */
|
|
@@ -1043,31 +1044,31 @@ const ye = {
|
|
|
1043
1044
|
ARROW_RIGHT: "ArrowRight",
|
|
1044
1045
|
/** 空格键 */
|
|
1045
1046
|
SPACE: " "
|
|
1046
|
-
},
|
|
1047
|
+
}, I = (e, t) => e.key === Vt[t], we = (e, t) => t.some((n) => e.key === Vt[n]), Eo = ["onMousedown", "onMouseenter"], wo = {
|
|
1047
1048
|
key: 0,
|
|
1048
1049
|
class: "mention-icon"
|
|
1049
|
-
},
|
|
1050
|
+
}, Co = { class: "mention-label" }, Ao = {
|
|
1050
1051
|
key: 0,
|
|
1051
1052
|
class: "mention-empty"
|
|
1052
|
-
},
|
|
1053
|
+
}, So = /* @__PURE__ */ Z({
|
|
1053
1054
|
__name: "mention-list",
|
|
1054
1055
|
props: {
|
|
1055
1056
|
items: {},
|
|
1056
1057
|
command: { type: Function }
|
|
1057
1058
|
},
|
|
1058
1059
|
setup(e, { expose: t }) {
|
|
1059
|
-
const n = e, s =
|
|
1060
|
-
|
|
1060
|
+
const n = e, s = F(0), r = F(null);
|
|
1061
|
+
K(
|
|
1061
1062
|
() => n.items,
|
|
1062
1063
|
() => {
|
|
1063
1064
|
s.value = 0;
|
|
1064
1065
|
}
|
|
1065
1066
|
);
|
|
1066
1067
|
function o({ event: c }) {
|
|
1067
|
-
return
|
|
1068
|
+
return I(c, "ARROW_UP") ? (s.value = Math.max(0, s.value - 1), l(), !0) : I(c, "ARROW_DOWN") ? (s.value = Math.min(n.items.length - 1, s.value + 1), l(), !0) : we(c, ["ENTER", "TAB"]) ? (i(s.value), !0) : !1;
|
|
1068
1069
|
}
|
|
1069
1070
|
function l() {
|
|
1070
|
-
|
|
1071
|
+
me(() => {
|
|
1071
1072
|
var d;
|
|
1072
1073
|
const c = (d = r.value) == null ? void 0 : d.querySelector(".mention-item.is-selected");
|
|
1073
1074
|
c && c.scrollIntoView({
|
|
@@ -1089,28 +1090,28 @@ const ye = {
|
|
|
1089
1090
|
}
|
|
1090
1091
|
return t({
|
|
1091
1092
|
onKeyDown: o
|
|
1092
|
-
}), (c, d) => (
|
|
1093
|
+
}), (c, d) => (M(), P("div", {
|
|
1093
1094
|
ref_key: "listRef",
|
|
1094
1095
|
ref: r,
|
|
1095
1096
|
class: "mention-list"
|
|
1096
1097
|
}, [
|
|
1097
|
-
(
|
|
1098
|
+
(M(!0), P(Ie, null, Be(e.items, (u, g) => (M(), P("button", {
|
|
1098
1099
|
key: u.id,
|
|
1099
1100
|
type: "button",
|
|
1100
|
-
class:
|
|
1101
|
-
onMousedown:
|
|
1102
|
-
onMouseenter: (
|
|
1101
|
+
class: Q(["mention-item", { "is-selected": g === s.value }]),
|
|
1102
|
+
onMousedown: nt((h) => i(g), ["prevent"]),
|
|
1103
|
+
onMouseenter: (h) => a(g)
|
|
1103
1104
|
}, [
|
|
1104
|
-
u.icon ? (
|
|
1105
|
-
B("span",
|
|
1106
|
-
], 42,
|
|
1107
|
-
e.items.length === 0 ? (
|
|
1105
|
+
u.icon ? (M(), P("span", wo, pe(u.icon), 1)) : q("", !0),
|
|
1106
|
+
B("span", Co, pe(u.label), 1)
|
|
1107
|
+
], 42, Eo))), 128)),
|
|
1108
|
+
e.items.length === 0 ? (M(), P("div", Ao, [...d[0] || (d[0] = [
|
|
1108
1109
|
B("span", null, "未找到匹配的提及项", -1)
|
|
1109
|
-
])])) :
|
|
1110
|
+
])])) : q("", !0)
|
|
1110
1111
|
], 512));
|
|
1111
1112
|
}
|
|
1112
|
-
}),
|
|
1113
|
-
function
|
|
1113
|
+
}), _o = /* @__PURE__ */ J(So, [["__scopeId", "data-v-aaa34d1a"]]), de = new re(ae.MENTION);
|
|
1114
|
+
function Lo(e, t) {
|
|
1114
1115
|
if (!t)
|
|
1115
1116
|
return e;
|
|
1116
1117
|
const n = t.toLowerCase();
|
|
@@ -1119,11 +1120,11 @@ function Co(e, t) {
|
|
|
1119
1120
|
return !!(s.label.toLowerCase().includes(n) || (r = s.value) != null && r.toLowerCase().includes(n));
|
|
1120
1121
|
});
|
|
1121
1122
|
}
|
|
1122
|
-
function
|
|
1123
|
+
function ko(e) {
|
|
1123
1124
|
const { editor: t, char: n, items: s, allowSpaces: r } = e;
|
|
1124
1125
|
let o = null, l = null, i = null;
|
|
1125
|
-
return new
|
|
1126
|
-
key:
|
|
1126
|
+
return new ie({
|
|
1127
|
+
key: de,
|
|
1127
1128
|
state: {
|
|
1128
1129
|
init() {
|
|
1129
1130
|
return {
|
|
@@ -1134,7 +1135,7 @@ function So(e) {
|
|
|
1134
1135
|
};
|
|
1135
1136
|
},
|
|
1136
1137
|
apply(a, c) {
|
|
1137
|
-
const d = a.getMeta(
|
|
1138
|
+
const d = a.getMeta(de);
|
|
1138
1139
|
if (d && d.type === "close")
|
|
1139
1140
|
return {
|
|
1140
1141
|
active: !1,
|
|
@@ -1144,7 +1145,7 @@ function So(e) {
|
|
|
1144
1145
|
};
|
|
1145
1146
|
if (!a.docChanged && !a.selectionSet)
|
|
1146
1147
|
return c;
|
|
1147
|
-
const u =
|
|
1148
|
+
const u = To(a.selection, n, r);
|
|
1148
1149
|
if (!u)
|
|
1149
1150
|
return {
|
|
1150
1151
|
active: !1,
|
|
@@ -1152,12 +1153,12 @@ function So(e) {
|
|
|
1152
1153
|
query: "",
|
|
1153
1154
|
filteredItems: []
|
|
1154
1155
|
};
|
|
1155
|
-
const
|
|
1156
|
+
const g = ke(s) ? s.value : s, h = Lo(g, u.query);
|
|
1156
1157
|
return {
|
|
1157
|
-
active:
|
|
1158
|
+
active: h.length > 0,
|
|
1158
1159
|
range: u.range,
|
|
1159
1160
|
query: u.query,
|
|
1160
|
-
filteredItems:
|
|
1161
|
+
filteredItems: h
|
|
1161
1162
|
};
|
|
1162
1163
|
}
|
|
1163
1164
|
},
|
|
@@ -1166,71 +1167,71 @@ function So(e) {
|
|
|
1166
1167
|
decorations(a) {
|
|
1167
1168
|
const c = this.getState(a);
|
|
1168
1169
|
if (!(c != null && c.active) || !c.range)
|
|
1169
|
-
return
|
|
1170
|
+
return Le.empty;
|
|
1170
1171
|
const d = Dt.inline(c.range.from, c.range.to, {
|
|
1171
1172
|
class: "mention-trigger"
|
|
1172
1173
|
});
|
|
1173
|
-
return
|
|
1174
|
+
return Le.create(a.doc, [d]);
|
|
1174
1175
|
},
|
|
1175
1176
|
// 键盘处理
|
|
1176
1177
|
handleKeyDown(a, c) {
|
|
1177
|
-
var u,
|
|
1178
|
-
const d =
|
|
1179
|
-
if (
|
|
1180
|
-
const { selection:
|
|
1181
|
-
if (
|
|
1178
|
+
var u, g, h, E;
|
|
1179
|
+
const d = de.getState(a.state);
|
|
1180
|
+
if (I(c, "BACKSPACE")) {
|
|
1181
|
+
const { selection: w } = a.state, { $from: T } = w;
|
|
1182
|
+
if (T.nodeBefore && T.nodeBefore.type.name === A.MENTION) {
|
|
1182
1183
|
c.preventDefault();
|
|
1183
|
-
const { tr:
|
|
1184
|
-
return
|
|
1184
|
+
const { tr: m } = a.state, y = T.pos - T.nodeBefore.nodeSize;
|
|
1185
|
+
return m.delete(y, T.pos), m.insertText(n, y), m.setSelection(O.create(m.doc, y + 1)), a.dispatch(m), a.focus(), !0;
|
|
1185
1186
|
}
|
|
1186
1187
|
}
|
|
1187
1188
|
if (!(d != null && d.active))
|
|
1188
1189
|
return !1;
|
|
1189
|
-
if (
|
|
1190
|
+
if (I(c, "ESCAPE")) {
|
|
1190
1191
|
c.preventDefault();
|
|
1191
|
-
const
|
|
1192
|
-
return
|
|
1192
|
+
const w = a.state.tr;
|
|
1193
|
+
return w.setMeta(de, {
|
|
1193
1194
|
type: "close"
|
|
1194
|
-
}), a.dispatch(
|
|
1195
|
+
}), a.dispatch(w), o && (i == null || i(), i = null, o.destroy(), o = null), l && (l.remove(), l = null), !0;
|
|
1195
1196
|
}
|
|
1196
|
-
if (
|
|
1197
|
-
if (c.preventDefault(), (
|
|
1197
|
+
if (we(c, ["ENTER", "TAB"])) {
|
|
1198
|
+
if (c.preventDefault(), (g = (u = o == null ? void 0 : o.ref) == null ? void 0 : u.onKeyDown) == null ? void 0 : g.call(u, { event: c }))
|
|
1198
1199
|
return !0;
|
|
1199
1200
|
if (d.filteredItems.length > 0 && d.range) {
|
|
1200
|
-
const
|
|
1201
|
-
return St(a, d.range,
|
|
1201
|
+
const T = d.filteredItems[0];
|
|
1202
|
+
return St(a, d.range, T), !0;
|
|
1202
1203
|
}
|
|
1203
1204
|
return !0;
|
|
1204
1205
|
}
|
|
1205
|
-
return
|
|
1206
|
+
return we(c, ["ARROW_UP", "ARROW_DOWN"]) && ((E = (h = o == null ? void 0 : o.ref) == null ? void 0 : h.onKeyDown) == null ? void 0 : E.call(h, { event: c })) || !1;
|
|
1206
1207
|
}
|
|
1207
1208
|
},
|
|
1208
1209
|
view() {
|
|
1209
1210
|
return {
|
|
1210
1211
|
update(a) {
|
|
1211
|
-
const c =
|
|
1212
|
+
const c = de.getState(a.state);
|
|
1212
1213
|
if (c != null && c.active && c.filteredItems.length > 0) {
|
|
1213
1214
|
o ? o.updateProps({
|
|
1214
1215
|
items: c.filteredItems
|
|
1215
|
-
}) : (o = new
|
|
1216
|
+
}) : (o = new Ot(_o, {
|
|
1216
1217
|
props: {
|
|
1217
1218
|
items: c.filteredItems,
|
|
1218
1219
|
command: (u) => {
|
|
1219
|
-
const
|
|
1220
|
+
const g = {
|
|
1220
1221
|
id: u.id,
|
|
1221
1222
|
label: u.label,
|
|
1222
1223
|
value: u.value || ""
|
|
1223
1224
|
};
|
|
1224
|
-
c.range && St(a, c.range,
|
|
1225
|
+
c.range && St(a, c.range, g);
|
|
1225
1226
|
}
|
|
1226
1227
|
},
|
|
1227
1228
|
editor: t
|
|
1228
1229
|
}), l = o.element, l.style.position = "absolute", l.style.zIndex = "1000", document.body.appendChild(l));
|
|
1229
1230
|
const d = a.dom.querySelector(".mention-trigger");
|
|
1230
|
-
d && l && (i == null || i(), i =
|
|
1231
|
-
|
|
1231
|
+
d && l && (i == null || i(), i = mt(d, l, () => {
|
|
1232
|
+
yt(d, l, {
|
|
1232
1233
|
placement: "bottom-start",
|
|
1233
|
-
middleware: [
|
|
1234
|
+
middleware: [ht(8), xt(), gt({ padding: 8 })]
|
|
1234
1235
|
}).then((u) => {
|
|
1235
1236
|
l && Object.assign(l.style, {
|
|
1236
1237
|
left: `${u.x}px`,
|
|
@@ -1251,22 +1252,22 @@ function So(e) {
|
|
|
1251
1252
|
function St(e, t, n) {
|
|
1252
1253
|
e.focus();
|
|
1253
1254
|
const { state: s, dispatch: r } = e, { tr: o } = s, l = s.schema.nodes.mention.create({
|
|
1254
|
-
id: n.id ||
|
|
1255
|
+
id: n.id || ve("mention"),
|
|
1255
1256
|
label: n.label,
|
|
1256
1257
|
value: n.value || ""
|
|
1257
1258
|
}), i = s.schema.text(" ");
|
|
1258
1259
|
o.delete(t.from, t.to), o.insert(t.from, [l, i]);
|
|
1259
1260
|
const a = t.from + 2;
|
|
1260
|
-
o.setSelection(
|
|
1261
|
+
o.setSelection(O.create(o.doc, a)), o.scrollIntoView(), r(o);
|
|
1261
1262
|
}
|
|
1262
|
-
const
|
|
1263
|
+
const Mo = {
|
|
1263
1264
|
/**
|
|
1264
1265
|
* 插入 mention 节点
|
|
1265
1266
|
*/
|
|
1266
1267
|
insertMention: (e) => ({ commands: t }) => t.insertContent({
|
|
1267
|
-
type:
|
|
1268
|
+
type: A.MENTION,
|
|
1268
1269
|
attrs: {
|
|
1269
|
-
id: e.id ||
|
|
1270
|
+
id: e.id || ve("mention"),
|
|
1270
1271
|
label: e.label || "",
|
|
1271
1272
|
value: e.value
|
|
1272
1273
|
}
|
|
@@ -1277,12 +1278,12 @@ const _o = {
|
|
|
1277
1278
|
deleteMention: (e) => ({ tr: t, state: n }) => {
|
|
1278
1279
|
let s = !1;
|
|
1279
1280
|
return n.doc.descendants((r, o) => {
|
|
1280
|
-
if (r.type.name ===
|
|
1281
|
+
if (r.type.name === A.MENTION && r.attrs.id === e)
|
|
1281
1282
|
return t.delete(o, o + r.nodeSize), s = !0, !1;
|
|
1282
1283
|
}), s;
|
|
1283
1284
|
}
|
|
1284
|
-
}, Gt =
|
|
1285
|
-
name:
|
|
1285
|
+
}, Gt = ct.create({
|
|
1286
|
+
name: be.MENTION,
|
|
1286
1287
|
// 节点配置
|
|
1287
1288
|
group: "inline",
|
|
1288
1289
|
inline: !0,
|
|
@@ -1328,7 +1329,7 @@ const _o = {
|
|
|
1328
1329
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
1329
1330
|
return [
|
|
1330
1331
|
"span",
|
|
1331
|
-
|
|
1332
|
+
ut(this.options.HTMLAttributes || {}, t, {
|
|
1332
1333
|
"data-mention": "",
|
|
1333
1334
|
"data-id": e.attrs.id,
|
|
1334
1335
|
"data-label": e.attrs.label,
|
|
@@ -1339,7 +1340,7 @@ const _o = {
|
|
|
1339
1340
|
},
|
|
1340
1341
|
// 使用 Vue 组件渲染
|
|
1341
1342
|
addNodeView() {
|
|
1342
|
-
return
|
|
1343
|
+
return at(In);
|
|
1343
1344
|
},
|
|
1344
1345
|
// 添加 storage 用于存储实例状态
|
|
1345
1346
|
addStorage() {
|
|
@@ -1349,11 +1350,11 @@ const _o = {
|
|
|
1349
1350
|
},
|
|
1350
1351
|
onCreate() {
|
|
1351
1352
|
const { items: e } = this.options;
|
|
1352
|
-
|
|
1353
|
+
ke(e) && (this.storage.watchStopHandle = K(
|
|
1353
1354
|
e,
|
|
1354
1355
|
() => {
|
|
1355
1356
|
const t = this.editor.state.tr;
|
|
1356
|
-
t.setMeta(
|
|
1357
|
+
t.setMeta(de, { type: "mention-update" }), this.editor.view.dispatch(t);
|
|
1357
1358
|
},
|
|
1358
1359
|
{ deep: !0 }
|
|
1359
1360
|
));
|
|
@@ -1364,7 +1365,7 @@ const _o = {
|
|
|
1364
1365
|
// 添加 Suggestion 插件
|
|
1365
1366
|
addProseMirrorPlugins() {
|
|
1366
1367
|
return [
|
|
1367
|
-
|
|
1368
|
+
ko({
|
|
1368
1369
|
editor: this.editor,
|
|
1369
1370
|
char: this.options.char,
|
|
1370
1371
|
items: this.options.items,
|
|
@@ -1381,33 +1382,33 @@ const _o = {
|
|
|
1381
1382
|
},
|
|
1382
1383
|
// 自定义命令
|
|
1383
1384
|
addCommands() {
|
|
1384
|
-
return
|
|
1385
|
+
return Mo;
|
|
1385
1386
|
}
|
|
1386
1387
|
});
|
|
1387
|
-
function
|
|
1388
|
+
function Ro(e) {
|
|
1388
1389
|
var r;
|
|
1389
|
-
const t = e.extensionManager.extensions.find((o) => o.name ===
|
|
1390
|
+
const t = e.extensionManager.extensions.find((o) => o.name === be.MENTION), n = ((r = t == null ? void 0 : t.options) == null ? void 0 : r.char) || "@";
|
|
1390
1391
|
let s = "";
|
|
1391
1392
|
return e.state.doc.descendants((o) => {
|
|
1392
|
-
o.type.name ===
|
|
1393
|
+
o.type.name === A.MENTION ? s += `${n}${o.attrs.label}` : o.type.name === A.TEXT && (s += o.text || "");
|
|
1393
1394
|
}), s.trim();
|
|
1394
1395
|
}
|
|
1395
|
-
function
|
|
1396
|
+
function Po(e) {
|
|
1396
1397
|
const t = [];
|
|
1397
1398
|
return e.state.doc.descendants((n, s, r) => {
|
|
1398
|
-
if (r && r.type.name ===
|
|
1399
|
-
if (n.type.name ===
|
|
1399
|
+
if (r && r.type.name === A.PARAGRAPH) {
|
|
1400
|
+
if (n.type.name === A.MENTION)
|
|
1400
1401
|
t.push({
|
|
1401
|
-
type:
|
|
1402
|
+
type: G.MENTION,
|
|
1402
1403
|
content: n.attrs.label,
|
|
1403
1404
|
value: n.attrs.value || ""
|
|
1404
1405
|
});
|
|
1405
|
-
else if (n.type.name ===
|
|
1406
|
+
else if (n.type.name === A.TEXT) {
|
|
1406
1407
|
const o = n.text || "";
|
|
1407
1408
|
if (o) {
|
|
1408
1409
|
const l = t[t.length - 1];
|
|
1409
|
-
l && l.type ===
|
|
1410
|
-
type:
|
|
1410
|
+
l && l.type === G.TEXT ? l.content = (l.content || "") + o : t.push({
|
|
1411
|
+
type: G.TEXT,
|
|
1411
1412
|
content: o
|
|
1412
1413
|
});
|
|
1413
1414
|
}
|
|
@@ -1415,7 +1416,7 @@ function ko(e) {
|
|
|
1415
1416
|
}
|
|
1416
1417
|
}), t;
|
|
1417
1418
|
}
|
|
1418
|
-
function
|
|
1419
|
+
function Oo(e, t = "@", n) {
|
|
1419
1420
|
return Gt.configure({
|
|
1420
1421
|
items: e,
|
|
1421
1422
|
char: t,
|
|
@@ -1464,10 +1465,10 @@ const Ut = (e, t) => {
|
|
|
1464
1465
|
text: e.substring(o),
|
|
1465
1466
|
isMatch: !1
|
|
1466
1467
|
}), r;
|
|
1467
|
-
},
|
|
1468
|
+
}, Do = (e, t) => !t || !e ? [{ text: e, isMatch: !1 }] : Ut(e, [t]), Io = (e, t) => {
|
|
1468
1469
|
const { content: n, highlights: s } = e;
|
|
1469
|
-
return typeof s == "function" ? s(n, t) : Array.isArray(s) ? Ut(n, s) :
|
|
1470
|
-
},
|
|
1470
|
+
return typeof s == "function" ? s(n, t) : Array.isArray(s) ? Ut(n, s) : Do(n, t);
|
|
1471
|
+
}, Bo = ["onMouseenter", "onClick"], $o = { class: "suggestion-list__text" }, jo = /* @__PURE__ */ Z({
|
|
1471
1472
|
__name: "suggestion-list",
|
|
1472
1473
|
props: {
|
|
1473
1474
|
show: { type: Boolean },
|
|
@@ -1481,7 +1482,7 @@ const Ut = (e, t) => {
|
|
|
1481
1482
|
onMouseLeave: { type: Function }
|
|
1482
1483
|
},
|
|
1483
1484
|
setup(e) {
|
|
1484
|
-
const t = e, n =
|
|
1485
|
+
const t = e, n = F(null), s = (i) => i === t.activeKeyboardIndex || i === t.activeMouseIndex, r = (i) => {
|
|
1485
1486
|
var a;
|
|
1486
1487
|
(a = t.onMouseEnter) == null || a.call(t, i);
|
|
1487
1488
|
}, o = () => {
|
|
@@ -1492,7 +1493,7 @@ const Ut = (e, t) => {
|
|
|
1492
1493
|
const a = t.suggestions[i];
|
|
1493
1494
|
a && ((c = t.onSelect) == null || c.call(t, un(a)));
|
|
1494
1495
|
};
|
|
1495
|
-
return
|
|
1496
|
+
return K(
|
|
1496
1497
|
() => t.activeKeyboardIndex,
|
|
1497
1498
|
(i) => {
|
|
1498
1499
|
if (i !== -1 && n.value) {
|
|
@@ -1500,39 +1501,39 @@ const Ut = (e, t) => {
|
|
|
1500
1501
|
a && a.scrollIntoView({ block: "nearest" });
|
|
1501
1502
|
}
|
|
1502
1503
|
}
|
|
1503
|
-
), (i, a) => (
|
|
1504
|
-
default:
|
|
1505
|
-
t.show && t.suggestions.length ? (
|
|
1504
|
+
), (i, a) => (M(), U(an, { name: "suggestion-slide-up" }, {
|
|
1505
|
+
default: j(() => [
|
|
1506
|
+
t.show && t.suggestions.length ? (M(), P("div", {
|
|
1506
1507
|
key: 0,
|
|
1507
1508
|
ref_key: "suggestionsListRef",
|
|
1508
1509
|
ref: n,
|
|
1509
1510
|
class: "suggestion-list",
|
|
1510
1511
|
style: cn(t.popupStyle)
|
|
1511
1512
|
}, [
|
|
1512
|
-
(
|
|
1513
|
+
(M(!0), P(Ie, null, Be(t.suggestions, (c, d) => (M(), P("div", {
|
|
1513
1514
|
key: d,
|
|
1514
|
-
class:
|
|
1515
|
+
class: Q(["suggestion-list__item", { highlighted: s(d) }]),
|
|
1515
1516
|
onMouseenter: (u) => r(d),
|
|
1516
1517
|
onMouseleave: o,
|
|
1517
1518
|
onClick: (u) => l(d)
|
|
1518
1519
|
}, [
|
|
1519
|
-
|
|
1520
|
-
B("span",
|
|
1521
|
-
(
|
|
1522
|
-
key:
|
|
1523
|
-
class:
|
|
1520
|
+
se(k(Rn), { class: "suggestion-list__icon" }),
|
|
1521
|
+
B("span", $o, [
|
|
1522
|
+
(M(!0), P(Ie, null, Be(k(Io)(c, t.inputValue), (u, g) => (M(), P("span", {
|
|
1523
|
+
key: g,
|
|
1524
|
+
class: Q({
|
|
1524
1525
|
"suggestion-list__text--match": u.isMatch,
|
|
1525
1526
|
"suggestion-list__text--normal": !u.isMatch
|
|
1526
1527
|
})
|
|
1527
|
-
},
|
|
1528
|
+
}, pe(u.text), 3))), 128))
|
|
1528
1529
|
])
|
|
1529
|
-
], 42,
|
|
1530
|
-
], 4)) :
|
|
1530
|
+
], 42, Bo))), 128))
|
|
1531
|
+
], 4)) : q("", !0)
|
|
1531
1532
|
]),
|
|
1532
1533
|
_: 1
|
|
1533
1534
|
}));
|
|
1534
1535
|
}
|
|
1535
|
-
}),
|
|
1536
|
+
}), No = /* @__PURE__ */ J(jo, [["__scopeId", "data-v-76a6f35e"]]), Wo = (e, t) => {
|
|
1536
1537
|
if (!e || !t)
|
|
1537
1538
|
return { text: "", show: !1, showTab: !1 };
|
|
1538
1539
|
const n = e.toLowerCase(), s = t.toLowerCase();
|
|
@@ -1544,8 +1545,8 @@ const Ut = (e, t) => {
|
|
|
1544
1545
|
show: o,
|
|
1545
1546
|
showTab: o
|
|
1546
1547
|
};
|
|
1547
|
-
},
|
|
1548
|
-
function
|
|
1548
|
+
}, z = new re(ae.SUGGESTION);
|
|
1549
|
+
function Ko(e) {
|
|
1549
1550
|
const {
|
|
1550
1551
|
editor: t,
|
|
1551
1552
|
activeSuggestionKeys: n = ["Enter"],
|
|
@@ -1557,89 +1558,89 @@ function jo(e) {
|
|
|
1557
1558
|
let i = null, a = null, c = null, d = !1;
|
|
1558
1559
|
function u() {
|
|
1559
1560
|
const p = t.extensionManager.extensions.find(
|
|
1560
|
-
(
|
|
1561
|
-
), f = p == null ? void 0 : p.options,
|
|
1562
|
-
return
|
|
1561
|
+
(v) => v.name === be.SUGGESTION
|
|
1562
|
+
), f = p == null ? void 0 : p.options, x = (f == null ? void 0 : f.items) || (f == null ? void 0 : f.suggestions) || [];
|
|
1563
|
+
return x && typeof x == "object" && "value" in x ? x.value : x;
|
|
1563
1564
|
}
|
|
1564
|
-
function
|
|
1565
|
+
function g(p) {
|
|
1565
1566
|
const f = u();
|
|
1566
1567
|
return o ? o(f, p) : f;
|
|
1567
1568
|
}
|
|
1568
|
-
function
|
|
1569
|
+
function h(p) {
|
|
1569
1570
|
return p;
|
|
1570
1571
|
}
|
|
1571
|
-
function E(p, f,
|
|
1572
|
-
if (p === -1 || !
|
|
1572
|
+
function E(p, f, x) {
|
|
1573
|
+
if (p === -1 || !x[p])
|
|
1573
1574
|
return { text: "", show: !1, showTab: !1 };
|
|
1574
|
-
const
|
|
1575
|
-
return
|
|
1575
|
+
const v = x[p];
|
|
1576
|
+
return Wo(v.content, f);
|
|
1576
1577
|
}
|
|
1577
|
-
function
|
|
1578
|
+
function w(p, f, x) {
|
|
1578
1579
|
if (!f) return;
|
|
1579
|
-
(l == null ? void 0 : l(
|
|
1580
|
+
(l == null ? void 0 : l(x)) !== !1 && t.commands.setContent(x.content), t.commands.focus();
|
|
1580
1581
|
}
|
|
1581
|
-
function
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1582
|
+
function T(p, f) {
|
|
1583
|
+
const x = f.filteredSuggestions[f.selectedIndex];
|
|
1584
|
+
x && w(p, f.range, x);
|
|
1585
|
+
const v = p.state.tr;
|
|
1586
|
+
v.setMeta(z, { type: "close" }), p.dispatch(v);
|
|
1586
1587
|
}
|
|
1587
|
-
function
|
|
1588
|
+
function m(p, f) {
|
|
1588
1589
|
c == null || c();
|
|
1589
|
-
const
|
|
1590
|
+
const v = p.dom.closest(".tr-sender") || p.dom, S = () => {
|
|
1590
1591
|
if (typeof s == "number")
|
|
1591
1592
|
return `${s}px`;
|
|
1592
1593
|
if (typeof s == "string") {
|
|
1593
1594
|
if (s.endsWith("%")) {
|
|
1594
|
-
const
|
|
1595
|
-
return `${
|
|
1595
|
+
const _ = parseFloat(s) / 100;
|
|
1596
|
+
return `${v.offsetWidth * _}px`;
|
|
1596
1597
|
}
|
|
1597
1598
|
return s;
|
|
1598
1599
|
}
|
|
1599
1600
|
return "400px";
|
|
1600
1601
|
};
|
|
1601
|
-
c =
|
|
1602
|
-
|
|
1602
|
+
c = mt(v, f, () => {
|
|
1603
|
+
yt(v, f, {
|
|
1603
1604
|
placement: "top-start",
|
|
1604
1605
|
middleware: [
|
|
1605
|
-
|
|
1606
|
-
|
|
1606
|
+
ht(8),
|
|
1607
|
+
xt({
|
|
1607
1608
|
fallbackPlacements: ["bottom-start", "top-start"]
|
|
1608
1609
|
}),
|
|
1609
|
-
|
|
1610
|
+
gt({ padding: 8 })
|
|
1610
1611
|
]
|
|
1611
|
-
}).then(({ x:
|
|
1612
|
-
f.style.position = "absolute", f.style.left = `${
|
|
1612
|
+
}).then(({ x: _, y: b }) => {
|
|
1613
|
+
f.style.position = "absolute", f.style.left = `${_}px`, f.style.top = `${b}px`, f.style.zIndex = "2000", f.style.width = S();
|
|
1613
1614
|
});
|
|
1614
1615
|
});
|
|
1615
1616
|
}
|
|
1616
|
-
function
|
|
1617
|
+
function y(p) {
|
|
1617
1618
|
if (!r || !p.active || !p.autoCompleteText || !p.range)
|
|
1618
|
-
return
|
|
1619
|
-
const f = t.state.doc, { selection:
|
|
1620
|
-
if (!(
|
|
1621
|
-
return
|
|
1622
|
-
const
|
|
1623
|
-
|
|
1619
|
+
return Le.empty;
|
|
1620
|
+
const f = t.state.doc, { selection: x } = t.state, v = x.$head.pos;
|
|
1621
|
+
if (!(v >= f.content.size - 1))
|
|
1622
|
+
return Le.empty;
|
|
1623
|
+
const _ = Dt.widget(
|
|
1624
|
+
v,
|
|
1624
1625
|
() => {
|
|
1625
|
-
const
|
|
1626
|
-
|
|
1627
|
-
const
|
|
1628
|
-
if (
|
|
1629
|
-
const
|
|
1630
|
-
|
|
1626
|
+
const b = document.createElement("span");
|
|
1627
|
+
b.className = "suggestion-autocomplete", b.contentEditable = "false";
|
|
1628
|
+
const L = document.createElement("span");
|
|
1629
|
+
if (L.className = "autocomplete-text", L.textContent = p.autoCompleteText, b.appendChild(L), p.showTabIndicator) {
|
|
1630
|
+
const $ = document.createElement("span");
|
|
1631
|
+
$.className = "tab-hint", $.textContent = "TAB", b.appendChild($);
|
|
1631
1632
|
}
|
|
1632
|
-
return
|
|
1633
|
+
return b;
|
|
1633
1634
|
},
|
|
1634
1635
|
{
|
|
1635
1636
|
side: 1
|
|
1636
1637
|
// 显示在光标右侧
|
|
1637
1638
|
}
|
|
1638
1639
|
);
|
|
1639
|
-
return
|
|
1640
|
+
return Le.create(f, [_]);
|
|
1640
1641
|
}
|
|
1641
|
-
return new
|
|
1642
|
-
key:
|
|
1642
|
+
return new ie({
|
|
1643
|
+
key: z,
|
|
1643
1644
|
state: {
|
|
1644
1645
|
init() {
|
|
1645
1646
|
return {
|
|
@@ -1653,9 +1654,9 @@ function jo(e) {
|
|
|
1653
1654
|
};
|
|
1654
1655
|
},
|
|
1655
1656
|
apply(p, f) {
|
|
1656
|
-
const
|
|
1657
|
-
if (
|
|
1658
|
-
if (
|
|
1657
|
+
const x = p.getMeta(z);
|
|
1658
|
+
if (x) {
|
|
1659
|
+
if (x.type === "close")
|
|
1659
1660
|
return d = !0, setTimeout(() => {
|
|
1660
1661
|
d = !1;
|
|
1661
1662
|
}, 0), {
|
|
@@ -1667,19 +1668,19 @@ function jo(e) {
|
|
|
1667
1668
|
autoCompleteText: "",
|
|
1668
1669
|
showTabIndicator: !1
|
|
1669
1670
|
};
|
|
1670
|
-
if (
|
|
1671
|
-
const
|
|
1671
|
+
if (x.type === "updateIndex") {
|
|
1672
|
+
const L = { ...f, selectedIndex: x.index }, $ = E(x.index, f.query, f.filteredSuggestions);
|
|
1672
1673
|
return {
|
|
1673
|
-
...
|
|
1674
|
-
autoCompleteText:
|
|
1675
|
-
showTabIndicator:
|
|
1674
|
+
...L,
|
|
1675
|
+
autoCompleteText: $.text,
|
|
1676
|
+
showTabIndicator: $.showTab
|
|
1676
1677
|
};
|
|
1677
1678
|
}
|
|
1678
1679
|
}
|
|
1679
1680
|
if (d || !p.docChanged && !p.selectionSet)
|
|
1680
1681
|
return f;
|
|
1681
|
-
const
|
|
1682
|
-
if (!
|
|
1682
|
+
const v = p.doc.textContent.trim(), S = v;
|
|
1683
|
+
if (!v)
|
|
1683
1684
|
return {
|
|
1684
1685
|
active: !1,
|
|
1685
1686
|
range: null,
|
|
@@ -1689,8 +1690,8 @@ function jo(e) {
|
|
|
1689
1690
|
autoCompleteText: "",
|
|
1690
1691
|
showTabIndicator: !1
|
|
1691
1692
|
};
|
|
1692
|
-
const
|
|
1693
|
-
if (
|
|
1693
|
+
const _ = g(S);
|
|
1694
|
+
if (_.length === 0)
|
|
1694
1695
|
return {
|
|
1695
1696
|
active: !1,
|
|
1696
1697
|
range: null,
|
|
@@ -1700,22 +1701,22 @@ function jo(e) {
|
|
|
1700
1701
|
autoCompleteText: "",
|
|
1701
1702
|
showTabIndicator: !1
|
|
1702
1703
|
};
|
|
1703
|
-
const
|
|
1704
|
+
const b = E(0, S, _);
|
|
1704
1705
|
return {
|
|
1705
1706
|
active: !0,
|
|
1706
1707
|
range: { from: 0, to: p.doc.content.size },
|
|
1707
|
-
query:
|
|
1708
|
-
filteredSuggestions:
|
|
1708
|
+
query: S,
|
|
1709
|
+
filteredSuggestions: _,
|
|
1709
1710
|
selectedIndex: 0,
|
|
1710
|
-
autoCompleteText:
|
|
1711
|
-
showTabIndicator:
|
|
1711
|
+
autoCompleteText: b.text,
|
|
1712
|
+
showTabIndicator: b.showTab
|
|
1712
1713
|
};
|
|
1713
1714
|
}
|
|
1714
1715
|
},
|
|
1715
1716
|
props: {
|
|
1716
1717
|
decorations(p) {
|
|
1717
1718
|
const f = this.getState(p);
|
|
1718
|
-
return
|
|
1719
|
+
return y(
|
|
1719
1720
|
f || {
|
|
1720
1721
|
active: !1,
|
|
1721
1722
|
range: null,
|
|
@@ -1725,28 +1726,28 @@ function jo(e) {
|
|
|
1725
1726
|
);
|
|
1726
1727
|
},
|
|
1727
1728
|
handleKeyDown(p, f) {
|
|
1728
|
-
const
|
|
1729
|
-
if (!(
|
|
1729
|
+
const x = z.getState(p.state);
|
|
1730
|
+
if (!(x != null && x.active))
|
|
1730
1731
|
return !1;
|
|
1731
|
-
if (
|
|
1732
|
-
return f.preventDefault(),
|
|
1733
|
-
if (
|
|
1732
|
+
if (I(f, "TAB") && x.autoCompleteText)
|
|
1733
|
+
return f.preventDefault(), T(p, x), !0;
|
|
1734
|
+
if (we(f, ["ARROW_UP", "ARROW_DOWN"])) {
|
|
1734
1735
|
f.preventDefault();
|
|
1735
|
-
const
|
|
1736
|
-
let
|
|
1737
|
-
|
|
1738
|
-
const
|
|
1739
|
-
return
|
|
1736
|
+
const v = I(f, "ARROW_DOWN") ? 1 : -1, S = x.filteredSuggestions.length;
|
|
1737
|
+
let _ = x.selectedIndex + v;
|
|
1738
|
+
_ < 0 ? _ = S - 1 : _ >= S && (_ = 0);
|
|
1739
|
+
const b = p.state.tr;
|
|
1740
|
+
return b.setMeta(z, {
|
|
1740
1741
|
type: "updateIndex",
|
|
1741
|
-
index:
|
|
1742
|
-
}), p.dispatch(
|
|
1742
|
+
index: _
|
|
1743
|
+
}), p.dispatch(b), !0;
|
|
1743
1744
|
}
|
|
1744
1745
|
if (n.includes(f.key))
|
|
1745
|
-
return f.preventDefault(),
|
|
1746
|
-
if (
|
|
1746
|
+
return f.preventDefault(), T(p, x), !0;
|
|
1747
|
+
if (I(f, "ESCAPE")) {
|
|
1747
1748
|
f.preventDefault();
|
|
1748
|
-
const
|
|
1749
|
-
return
|
|
1749
|
+
const v = p.state.tr;
|
|
1750
|
+
return v.setMeta(z, { type: "close" }), p.dispatch(v), !0;
|
|
1750
1751
|
}
|
|
1751
1752
|
return !1;
|
|
1752
1753
|
}
|
|
@@ -1754,7 +1755,7 @@ function jo(e) {
|
|
|
1754
1755
|
view() {
|
|
1755
1756
|
return {
|
|
1756
1757
|
update(p) {
|
|
1757
|
-
const f =
|
|
1758
|
+
const f = z.getState(p.state);
|
|
1758
1759
|
f != null && f.active && f.filteredSuggestions.length > 0 ? (i ? i.updateProps({
|
|
1759
1760
|
show: f.active && f.filteredSuggestions.length > 0,
|
|
1760
1761
|
suggestions: f.filteredSuggestions,
|
|
@@ -1764,7 +1765,7 @@ function jo(e) {
|
|
|
1764
1765
|
},
|
|
1765
1766
|
activeKeyboardIndex: f.selectedIndex,
|
|
1766
1767
|
inputValue: f.query
|
|
1767
|
-
}) : (i = new
|
|
1768
|
+
}) : (i = new Ot(No, {
|
|
1768
1769
|
props: {
|
|
1769
1770
|
show: f.active && f.filteredSuggestions.length > 0,
|
|
1770
1771
|
suggestions: f.filteredSuggestions,
|
|
@@ -1775,18 +1776,18 @@ function jo(e) {
|
|
|
1775
1776
|
activeKeyboardIndex: f.selectedIndex,
|
|
1776
1777
|
activeMouseIndex: -1,
|
|
1777
1778
|
inputValue: f.query,
|
|
1778
|
-
onSelect: (
|
|
1779
|
-
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1779
|
+
onSelect: (x) => {
|
|
1780
|
+
w(p, f.range, x);
|
|
1781
|
+
const v = p.state.tr;
|
|
1782
|
+
v.setMeta(z, { type: "close" }), p.dispatch(v);
|
|
1782
1783
|
},
|
|
1783
|
-
onMouseEnter: (
|
|
1784
|
-
const
|
|
1785
|
-
|
|
1784
|
+
onMouseEnter: (x) => {
|
|
1785
|
+
const v = p.state.tr;
|
|
1786
|
+
v.setMeta(z, { type: "updateIndex", index: x }), p.dispatch(v);
|
|
1786
1787
|
}
|
|
1787
1788
|
},
|
|
1788
1789
|
editor: t
|
|
1789
|
-
}), a = i.element, document.body.appendChild(a)), a &&
|
|
1790
|
+
}), a = i.element, document.body.appendChild(a)), a && m(p, a)) : (i && (c == null || c(), c = null, i.destroy(), i = null), a && (a.remove(), a = null));
|
|
1790
1791
|
},
|
|
1791
1792
|
destroy() {
|
|
1792
1793
|
c == null || c(), i == null || i.destroy(), a == null || a.remove();
|
|
@@ -1796,7 +1797,7 @@ function jo(e) {
|
|
|
1796
1797
|
});
|
|
1797
1798
|
}
|
|
1798
1799
|
const Xt = It.create({
|
|
1799
|
-
name:
|
|
1800
|
+
name: be.SUGGESTION,
|
|
1800
1801
|
addOptions() {
|
|
1801
1802
|
return {
|
|
1802
1803
|
items: [],
|
|
@@ -1812,11 +1813,11 @@ const Xt = It.create({
|
|
|
1812
1813
|
};
|
|
1813
1814
|
},
|
|
1814
1815
|
onCreate() {
|
|
1815
|
-
|
|
1816
|
+
ke(this.options.items) && (this.storage.watchStopHandle = K(
|
|
1816
1817
|
this.options.items,
|
|
1817
1818
|
() => {
|
|
1818
1819
|
const e = this.editor.state.tr;
|
|
1819
|
-
e.setMeta(
|
|
1820
|
+
e.setMeta(z, { type: "update" }), this.editor.view.dispatch(e);
|
|
1820
1821
|
},
|
|
1821
1822
|
{ deep: !0 }
|
|
1822
1823
|
));
|
|
@@ -1826,26 +1827,26 @@ const Xt = It.create({
|
|
|
1826
1827
|
},
|
|
1827
1828
|
addProseMirrorPlugins() {
|
|
1828
1829
|
return [
|
|
1829
|
-
|
|
1830
|
+
Ko({
|
|
1830
1831
|
editor: this.editor,
|
|
1831
1832
|
...this.options
|
|
1832
1833
|
})
|
|
1833
1834
|
];
|
|
1834
1835
|
}
|
|
1835
1836
|
});
|
|
1836
|
-
function
|
|
1837
|
+
function qo(e, t) {
|
|
1837
1838
|
return Xt.configure({
|
|
1838
1839
|
items: e,
|
|
1839
1840
|
...t
|
|
1840
1841
|
});
|
|
1841
1842
|
}
|
|
1842
|
-
function
|
|
1843
|
+
function Ho(e) {
|
|
1843
1844
|
const t = [];
|
|
1844
1845
|
return e.state.doc.descendants((n, s) => {
|
|
1845
|
-
n.type.name ===
|
|
1846
|
+
n.type.name === A.TEMPLATE_BLOCK && t.push({ node: n, pos: s });
|
|
1846
1847
|
}), t;
|
|
1847
1848
|
}
|
|
1848
|
-
const
|
|
1849
|
+
const zo = {
|
|
1849
1850
|
/**
|
|
1850
1851
|
* 设置模板数据(批量)
|
|
1851
1852
|
*/
|
|
@@ -1853,32 +1854,32 @@ const Ko = {
|
|
|
1853
1854
|
t.clearContent();
|
|
1854
1855
|
const n = [];
|
|
1855
1856
|
return e.forEach((s) => {
|
|
1856
|
-
s.type ===
|
|
1857
|
-
type:
|
|
1857
|
+
s.type === G.TEXT ? s.content && n.push({
|
|
1858
|
+
type: A.TEXT,
|
|
1858
1859
|
text: s.content
|
|
1859
|
-
}) : s.type ===
|
|
1860
|
-
type:
|
|
1860
|
+
}) : s.type === G.BLOCK ? n.push({
|
|
1861
|
+
type: A.TEMPLATE_BLOCK,
|
|
1861
1862
|
attrs: {
|
|
1862
|
-
id: s.id ||
|
|
1863
|
+
id: s.id || ve("template"),
|
|
1863
1864
|
content: s.content
|
|
1864
1865
|
},
|
|
1865
1866
|
content: s.content ? [
|
|
1866
1867
|
{
|
|
1867
|
-
type:
|
|
1868
|
+
type: A.TEXT,
|
|
1868
1869
|
text: s.content
|
|
1869
1870
|
}
|
|
1870
1871
|
] : []
|
|
1871
|
-
}) : s.type ===
|
|
1872
|
-
type:
|
|
1872
|
+
}) : s.type === G.SELECT && n.push({
|
|
1873
|
+
type: A.TEMPLATE_SELECT,
|
|
1873
1874
|
attrs: {
|
|
1874
|
-
id: s.id ||
|
|
1875
|
+
id: s.id || ve("select"),
|
|
1875
1876
|
placeholder: s.placeholder,
|
|
1876
1877
|
options: s.options,
|
|
1877
1878
|
value: s.value || null
|
|
1878
1879
|
}
|
|
1879
1880
|
});
|
|
1880
1881
|
}), n.length > 0 && t.insertContent({
|
|
1881
|
-
type:
|
|
1882
|
+
type: A.PARAGRAPH,
|
|
1882
1883
|
content: n
|
|
1883
1884
|
}), !0;
|
|
1884
1885
|
},
|
|
@@ -1888,14 +1889,14 @@ const Ko = {
|
|
|
1888
1889
|
insertTemplate: (e) => ({ commands: t }) => {
|
|
1889
1890
|
const n = e.content || "";
|
|
1890
1891
|
return t.insertContent({
|
|
1891
|
-
type:
|
|
1892
|
+
type: A.TEMPLATE_BLOCK,
|
|
1892
1893
|
attrs: {
|
|
1893
|
-
id: e.id ||
|
|
1894
|
+
id: e.id || ve("template"),
|
|
1894
1895
|
content: n
|
|
1895
1896
|
},
|
|
1896
1897
|
content: n ? [
|
|
1897
1898
|
{
|
|
1898
|
-
type:
|
|
1899
|
+
type: A.TEXT,
|
|
1899
1900
|
text: n
|
|
1900
1901
|
}
|
|
1901
1902
|
] : []
|
|
@@ -1905,7 +1906,7 @@ const Ko = {
|
|
|
1905
1906
|
* 聚焦到第一个模板块
|
|
1906
1907
|
*/
|
|
1907
1908
|
focusFirstTemplate: () => ({ editor: e }) => {
|
|
1908
|
-
const t =
|
|
1909
|
+
const t = Ho(e);
|
|
1909
1910
|
return setTimeout(() => {
|
|
1910
1911
|
var o;
|
|
1911
1912
|
const { state: n, view: s } = e, r = n.tr;
|
|
@@ -1917,7 +1918,7 @@ const Ko = {
|
|
|
1917
1918
|
const { node: a, pos: c } = t[0], d = ((o = a.textContent) == null ? void 0 : o.length) || 0;
|
|
1918
1919
|
l = c + 1 + d;
|
|
1919
1920
|
}
|
|
1920
|
-
const i =
|
|
1921
|
+
const i = O.create(n.doc, l);
|
|
1921
1922
|
r.setSelection(i), s.dispatch(r), s.focus();
|
|
1922
1923
|
} catch (l) {
|
|
1923
1924
|
console.error("[focusFirstTemplate] 设置光标失败", l);
|
|
@@ -1928,40 +1929,40 @@ const Ko = {
|
|
|
1928
1929
|
* 插入选择器
|
|
1929
1930
|
*/
|
|
1930
1931
|
insertTemplateSelect: (e) => ({ commands: t }) => t.insertContent({
|
|
1931
|
-
type:
|
|
1932
|
+
type: A.TEMPLATE_SELECT,
|
|
1932
1933
|
attrs: {
|
|
1933
|
-
id: e.id ||
|
|
1934
|
+
id: e.id || ve("select"),
|
|
1934
1935
|
placeholder: e.placeholder || "Please select",
|
|
1935
1936
|
options: e.options || [],
|
|
1936
1937
|
value: e.value || null
|
|
1937
1938
|
}
|
|
1938
1939
|
})
|
|
1939
1940
|
}, C = "";
|
|
1940
|
-
function
|
|
1941
|
+
function tt(e) {
|
|
1941
1942
|
return Yt(e).map((n) => n.content).join("");
|
|
1942
1943
|
}
|
|
1943
1944
|
function Yt(e) {
|
|
1944
1945
|
const t = [];
|
|
1945
1946
|
return e.state.doc.descendants((n, s, r) => {
|
|
1946
|
-
if (r && r.type.name ===
|
|
1947
|
-
if (n.type.name ===
|
|
1947
|
+
if (r && r.type.name === A.PARAGRAPH) {
|
|
1948
|
+
if (n.type.name === A.TEMPLATE_BLOCK) {
|
|
1948
1949
|
const o = (n.textContent || "").replace(new RegExp(C, "g"), "");
|
|
1949
1950
|
t.push({
|
|
1950
|
-
type:
|
|
1951
|
+
type: G.BLOCK,
|
|
1951
1952
|
content: o
|
|
1952
1953
|
});
|
|
1953
|
-
} else if (n.type.name ===
|
|
1954
|
+
} else if (n.type.name === A.TEMPLATE_SELECT) {
|
|
1954
1955
|
const o = n.attrs.options.find((i) => i.value === n.attrs.value), l = (o == null ? void 0 : o.value) || "";
|
|
1955
1956
|
t.push({
|
|
1956
|
-
type:
|
|
1957
|
+
type: G.SELECT,
|
|
1957
1958
|
content: l
|
|
1958
1959
|
});
|
|
1959
|
-
} else if (n.type.name ===
|
|
1960
|
+
} else if (n.type.name === A.TEXT) {
|
|
1960
1961
|
const o = (n.text || "").replace(new RegExp(C, "g"), "");
|
|
1961
1962
|
if (o) {
|
|
1962
1963
|
const l = t[t.length - 1];
|
|
1963
|
-
l && l.type ===
|
|
1964
|
-
type:
|
|
1964
|
+
l && l.type === G.TEXT ? l.content += o : t.push({
|
|
1965
|
+
type: G.TEXT,
|
|
1965
1966
|
content: o
|
|
1966
1967
|
});
|
|
1967
1968
|
}
|
|
@@ -1969,27 +1970,27 @@ function Yt(e) {
|
|
|
1969
1970
|
}
|
|
1970
1971
|
}), t;
|
|
1971
1972
|
}
|
|
1972
|
-
const
|
|
1973
|
+
const Fo = /* @__PURE__ */ Z({
|
|
1973
1974
|
__name: "template-block-view",
|
|
1974
1975
|
props: {
|
|
1975
1976
|
node: {}
|
|
1976
1977
|
},
|
|
1977
1978
|
setup(e) {
|
|
1978
|
-
const t = e, n =
|
|
1979
|
+
const t = e, n = R(() => {
|
|
1979
1980
|
const s = t.node.textContent || "";
|
|
1980
1981
|
return s.length === 0 || s === C;
|
|
1981
1982
|
});
|
|
1982
|
-
return (s, r) => (
|
|
1983
|
+
return (s, r) => (M(), U(k(lt), {
|
|
1983
1984
|
as: "span",
|
|
1984
|
-
class:
|
|
1985
|
+
class: Q(["template-block", { "is-empty": n.value }]),
|
|
1985
1986
|
"data-id": e.node.attrs.id
|
|
1986
1987
|
}, {
|
|
1987
|
-
default:
|
|
1988
|
+
default: j(() => [
|
|
1988
1989
|
r[0] || (r[0] = B("span", {
|
|
1989
1990
|
contenteditable: "false",
|
|
1990
1991
|
class: "template-block__prefix"
|
|
1991
1992
|
}, " ", -1)),
|
|
1992
|
-
|
|
1993
|
+
se(k(bn), {
|
|
1993
1994
|
as: "span",
|
|
1994
1995
|
class: "template-block__content"
|
|
1995
1996
|
}),
|
|
@@ -2001,24 +2002,24 @@ const qo = /* @__PURE__ */ X({
|
|
|
2001
2002
|
_: 1
|
|
2002
2003
|
}, 8, ["class", "data-id"]));
|
|
2003
2004
|
}
|
|
2004
|
-
}),
|
|
2005
|
-
function
|
|
2005
|
+
}), Vo = /* @__PURE__ */ J(Fo, [["__scopeId", "data-v-aa55b9db"]]);
|
|
2006
|
+
function Go(e) {
|
|
2006
2007
|
const t = [];
|
|
2007
2008
|
let { tr: n } = e;
|
|
2008
2009
|
return e.doc.descendants((s, r, o) => {
|
|
2009
|
-
if (s.type.name ===
|
|
2010
|
+
if (s.type.name === A.PARAGRAPH && s.childCount > 0) {
|
|
2010
2011
|
const { lastChild: l, firstChild: i } = s;
|
|
2011
|
-
if (i && i.type.name ===
|
|
2012
|
+
if (i && i.type.name === A.TEMPLATE_BLOCK && t.push(r + 1), l && l.type.name === A.TEMPLATE_BLOCK) {
|
|
2012
2013
|
const a = r + s.nodeSize - 1;
|
|
2013
2014
|
n.doc.textBetween(a - 1, a, "", "") !== C && t.push(a);
|
|
2014
2015
|
}
|
|
2015
2016
|
l === i && l && l.isText && l.text === C && t.push(["remove", r + 1]);
|
|
2016
2017
|
}
|
|
2017
|
-
if (s.type.name ===
|
|
2018
|
+
if (s.type.name === A.TEMPLATE_BLOCK && s.content.size === 0 && t.push(r + 1), s.type.name === A.TEMPLATE_BLOCK && o) {
|
|
2018
2019
|
let l = -1;
|
|
2019
2020
|
if (o.forEach((i, a, c) => {
|
|
2020
2021
|
i === s && (l = c);
|
|
2021
|
-
}), l > -1 && l < o.childCount - 1 && o.child(l + 1).type.name ===
|
|
2022
|
+
}), l > -1 && l < o.childCount - 1 && o.child(l + 1).type.name === A.TEMPLATE_BLOCK) {
|
|
2022
2023
|
const a = r + s.nodeSize;
|
|
2023
2024
|
n.doc.textBetween(a, a + 1, "", "") !== C && t.push(a);
|
|
2024
2025
|
}
|
|
@@ -2030,207 +2031,207 @@ function zo(e) {
|
|
|
2030
2031
|
Array.isArray(s) && s[0] === "remove" ? n = n.delete(s[1], s[1] + 1) : typeof s == "number" && (n = n.insertText(C, s, s));
|
|
2031
2032
|
}), n) : null;
|
|
2032
2033
|
}
|
|
2033
|
-
function
|
|
2034
|
-
return new
|
|
2035
|
-
key: new
|
|
2034
|
+
function Uo() {
|
|
2035
|
+
return new ie({
|
|
2036
|
+
key: new re(ae.TEMPLATE_BLOCK_ZERO_WIDTH),
|
|
2036
2037
|
appendTransaction(e, t, n) {
|
|
2037
|
-
return e.some((r) => r.docChanged) ?
|
|
2038
|
+
return e.some((r) => r.docChanged) ? Go(n) : null;
|
|
2038
2039
|
}
|
|
2039
2040
|
});
|
|
2040
2041
|
}
|
|
2041
|
-
function
|
|
2042
|
-
return new
|
|
2043
|
-
key: new
|
|
2042
|
+
function Xo() {
|
|
2043
|
+
return new ie({
|
|
2044
|
+
key: new re(ae.TEMPLATE_BLOCK_KEYBOARD),
|
|
2044
2045
|
props: {
|
|
2045
2046
|
handleKeyDown(e, t) {
|
|
2046
|
-
var i, a, c, d, u,
|
|
2047
|
+
var i, a, c, d, u, g, h, E, w;
|
|
2047
2048
|
const { state: n, dispatch: s } = e, { selection: r } = n, { $from: o } = r;
|
|
2048
|
-
if (
|
|
2049
|
-
const
|
|
2050
|
-
if (
|
|
2051
|
-
if (
|
|
2049
|
+
if (I(t, "ARROW_LEFT") && o.nodeBefore && o.nodeBefore.isText && o.nodeBefore.text && o.nodeBefore.text === C) {
|
|
2050
|
+
const T = o.parent, m = o.index();
|
|
2051
|
+
if (m >= 2) {
|
|
2052
|
+
if (T.child(m - 2).type.name === A.TEMPLATE_BLOCK) {
|
|
2052
2053
|
const p = o.pos - 2;
|
|
2053
|
-
return s(n.tr.setSelection(
|
|
2054
|
+
return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
|
|
2054
2055
|
}
|
|
2055
|
-
} else if (
|
|
2056
|
-
const
|
|
2057
|
-
if (
|
|
2058
|
-
return s(n.tr.setSelection(
|
|
2056
|
+
} else if (m === 1 && o.pos !== 0) {
|
|
2057
|
+
const y = o.before() - 1;
|
|
2058
|
+
if (y >= 0)
|
|
2059
|
+
return s(n.tr.setSelection(O.create(n.doc, y))), t.preventDefault(), !0;
|
|
2059
2060
|
}
|
|
2060
2061
|
}
|
|
2061
|
-
if (
|
|
2062
|
-
const
|
|
2063
|
-
if (
|
|
2064
|
-
if (
|
|
2062
|
+
if (I(t, "ARROW_RIGHT") && o.nodeAfter && o.nodeAfter.isText && o.nodeAfter.text === C) {
|
|
2063
|
+
const T = o.parent, m = o.index();
|
|
2064
|
+
if (m < T.childCount - 1) {
|
|
2065
|
+
if (T.child(m + 1).type.name === A.TEMPLATE_BLOCK) {
|
|
2065
2066
|
const p = o.pos + 2;
|
|
2066
|
-
return s(n.tr.setSelection(
|
|
2067
|
+
return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
|
|
2067
2068
|
}
|
|
2068
|
-
} else if (
|
|
2069
|
-
const
|
|
2070
|
-
return s(n.tr.setSelection(
|
|
2069
|
+
} else if (m === T.childCount - 1 && n.doc.lastChild !== o.node()) {
|
|
2070
|
+
const y = o.after() + 1;
|
|
2071
|
+
return s(n.tr.setSelection(O.create(n.doc, y))), t.preventDefault(), !0;
|
|
2071
2072
|
}
|
|
2072
2073
|
}
|
|
2073
2074
|
const l = o.node();
|
|
2074
|
-
if (l.type.name ===
|
|
2075
|
-
const
|
|
2076
|
-
if (
|
|
2077
|
-
if (
|
|
2078
|
-
const
|
|
2079
|
-
if (r.from !==
|
|
2080
|
-
return s(n.tr.setSelection(
|
|
2075
|
+
if (l.type.name === A.TEMPLATE_BLOCK) {
|
|
2076
|
+
const T = l.textContent || "";
|
|
2077
|
+
if (T === "" || T === C) {
|
|
2078
|
+
if (we(t, ["ARROW_LEFT", "ARROW_RIGHT"])) {
|
|
2079
|
+
const m = I(t, "ARROW_LEFT") ? o.before() : o.after();
|
|
2080
|
+
if (r.from !== m)
|
|
2081
|
+
return s(n.tr.setSelection(O.create(n.doc, m))), t.preventDefault(), !0;
|
|
2081
2082
|
}
|
|
2082
2083
|
} else {
|
|
2083
|
-
if (
|
|
2084
|
-
const
|
|
2085
|
-
return s(n.tr.setSelection(
|
|
2084
|
+
if (I(t, "ARROW_LEFT") && o.pos === o.start()) {
|
|
2085
|
+
const m = o.before();
|
|
2086
|
+
return s(n.tr.setSelection(O.create(n.doc, m))), t.preventDefault(), !0;
|
|
2086
2087
|
}
|
|
2087
|
-
if (
|
|
2088
|
-
const
|
|
2089
|
-
return s(n.tr.setSelection(
|
|
2088
|
+
if (I(t, "ARROW_RIGHT") && o.pos === o.end()) {
|
|
2089
|
+
const m = o.after();
|
|
2090
|
+
return s(n.tr.setSelection(O.create(n.doc, m))), t.preventDefault(), !0;
|
|
2090
2091
|
}
|
|
2091
2092
|
}
|
|
2092
2093
|
}
|
|
2093
|
-
if (
|
|
2094
|
-
const
|
|
2095
|
-
if (
|
|
2096
|
-
const
|
|
2097
|
-
if (o.pos === o.end() &&
|
|
2094
|
+
if (I(t, "BACKSPACE") && r.empty) {
|
|
2095
|
+
const T = o.node(), m = o.nodeBefore;
|
|
2096
|
+
if (T.type.name === A.TEMPLATE_BLOCK) {
|
|
2097
|
+
const y = T.textContent || "";
|
|
2098
|
+
if (o.pos === o.end() && y.length === 1 && y !== C) {
|
|
2098
2099
|
const p = o.pos - 1;
|
|
2099
2100
|
return s(n.tr.insertText(C, p, p + 1)), t.preventDefault(), !0;
|
|
2100
2101
|
}
|
|
2101
|
-
if (
|
|
2102
|
-
const p = o.before(), f = n.tr.setSelection(
|
|
2102
|
+
if (y === C) {
|
|
2103
|
+
const p = o.before(), f = n.tr.setSelection(O.create(n.doc, p));
|
|
2103
2104
|
return s(f), t.preventDefault(), !0;
|
|
2104
2105
|
}
|
|
2105
|
-
if (
|
|
2106
|
-
const p = o.before(), f = n.tr.setSelection(
|
|
2106
|
+
if (y === "") {
|
|
2107
|
+
const p = o.before(), f = n.tr.setSelection(O.create(n.doc, p));
|
|
2107
2108
|
return s(f), t.preventDefault(), !0;
|
|
2108
2109
|
}
|
|
2109
|
-
if (o.pos === o.start() &&
|
|
2110
|
+
if (o.pos === o.start() && y.length > 0 && y !== C) {
|
|
2110
2111
|
const p = o.before();
|
|
2111
|
-
return s(n.tr.setSelection(
|
|
2112
|
+
return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
|
|
2112
2113
|
}
|
|
2113
2114
|
return !1;
|
|
2114
2115
|
}
|
|
2115
|
-
if (
|
|
2116
|
-
const
|
|
2117
|
-
let f = n.tr.delete(
|
|
2118
|
-
return f = f.insertText(C,
|
|
2116
|
+
if (m && m.isText && ((i = m.text) == null ? void 0 : i.length) === 1 && m.text !== C && o.nodeAfter && o.nodeAfter.type.name === A.TEMPLATE_BLOCK) {
|
|
2117
|
+
const y = o.pos - m.nodeSize, p = o.pos;
|
|
2118
|
+
let f = n.tr.delete(y, p);
|
|
2119
|
+
return f = f.insertText(C, y, y), s(f), t.preventDefault(), !0;
|
|
2119
2120
|
}
|
|
2120
|
-
if (
|
|
2121
|
-
const
|
|
2122
|
-
if (
|
|
2123
|
-
const f = o.parent,
|
|
2124
|
-
let
|
|
2125
|
-
if (
|
|
2126
|
-
const
|
|
2127
|
-
|
|
2121
|
+
if (m && m.type.name === A.TEMPLATE_BLOCK) {
|
|
2122
|
+
const y = m.textContent || "";
|
|
2123
|
+
if (y.length === 0 || y === C) {
|
|
2124
|
+
const f = o.parent, x = o.index(), v = o.nodeAfter;
|
|
2125
|
+
let S = o.pos - m.nodeSize, _ = o.pos;
|
|
2126
|
+
if (x > 1) {
|
|
2127
|
+
const b = f.child(x - 2);
|
|
2128
|
+
b && b.isText && b.text === C && (S = S - 1);
|
|
2128
2129
|
}
|
|
2129
|
-
return
|
|
2130
|
+
return v && v.isText && ((a = v.text) != null && a.startsWith(C)) && (_ = _ + 1), s(n.tr.delete(S, _)), t.preventDefault(), !0;
|
|
2130
2131
|
} else {
|
|
2131
2132
|
const f = o.pos - 1;
|
|
2132
|
-
return s(n.tr.setSelection(
|
|
2133
|
+
return s(n.tr.setSelection(O.create(n.doc, f))), t.preventDefault(), !0;
|
|
2133
2134
|
}
|
|
2134
2135
|
}
|
|
2135
|
-
if (
|
|
2136
|
-
const
|
|
2137
|
-
if (
|
|
2136
|
+
if (m && m.isText) {
|
|
2137
|
+
const y = o.parent, p = o.index();
|
|
2138
|
+
if (m.text === C) {
|
|
2138
2139
|
if (p > 1) {
|
|
2139
|
-
const f =
|
|
2140
|
-
if (f.type.name ===
|
|
2141
|
-
const
|
|
2142
|
-
if (
|
|
2143
|
-
const
|
|
2144
|
-
let
|
|
2145
|
-
return
|
|
2140
|
+
const f = y.child(p - 2);
|
|
2141
|
+
if (f.type.name === A.TEMPLATE_BLOCK) {
|
|
2142
|
+
const x = f.textContent || "";
|
|
2143
|
+
if (x.length === 0 || x === C) {
|
|
2144
|
+
const S = o.pos - m.nodeSize - f.nodeSize, _ = o.nodeAfter;
|
|
2145
|
+
let b = o.pos;
|
|
2146
|
+
return _ && _.isText && _.text === C && (b = b + 1), s(n.tr.delete(S, b)), t.preventDefault(), !0;
|
|
2146
2147
|
} else {
|
|
2147
|
-
const
|
|
2148
|
-
if (
|
|
2149
|
-
return s(n.tr.setSelection(
|
|
2148
|
+
const S = o.pos - 2;
|
|
2149
|
+
if (S >= 0)
|
|
2150
|
+
return s(n.tr.setSelection(O.create(n.doc, S))), t.preventDefault(), !0;
|
|
2150
2151
|
}
|
|
2151
2152
|
}
|
|
2152
2153
|
}
|
|
2153
|
-
} else if (p === 1 && o.pos !== 1 &&
|
|
2154
|
+
} else if (p === 1 && o.pos !== 1 && m.text === C) {
|
|
2154
2155
|
const f = r.from - 1 - 2;
|
|
2155
2156
|
if (f >= 0)
|
|
2156
2157
|
return s(n.tr.delete(f, r.to)), t.preventDefault(), !0;
|
|
2157
2158
|
}
|
|
2158
2159
|
}
|
|
2159
2160
|
}
|
|
2160
|
-
if (
|
|
2161
|
-
let
|
|
2162
|
-
const
|
|
2163
|
-
if (
|
|
2164
|
-
const f = n.tr.delete(
|
|
2161
|
+
if (I(t, "BACKSPACE") && !r.empty) {
|
|
2162
|
+
let T = r.from, m = r.to;
|
|
2163
|
+
const y = o.nodeBefore, p = o.nodeAfter;
|
|
2164
|
+
if (y && y.isText && ((c = y.text) != null && c.endsWith(C)) && (T -= 1), p && p.isText && ((d = p.text) != null && d.startsWith(C)) && (m += 1), T !== r.from || m !== r.to) {
|
|
2165
|
+
const f = n.tr.delete(T, m);
|
|
2165
2166
|
return s(f), t.preventDefault(), !0;
|
|
2166
2167
|
}
|
|
2167
2168
|
}
|
|
2168
|
-
if (
|
|
2169
|
-
const
|
|
2170
|
-
if (
|
|
2171
|
-
const
|
|
2172
|
-
if (o.pos === o.start() &&
|
|
2169
|
+
if (I(t, "DELETE") && r.empty) {
|
|
2170
|
+
const T = o.node(), m = o.nodeAfter;
|
|
2171
|
+
if (T.type.name === A.TEMPLATE_BLOCK) {
|
|
2172
|
+
const y = T.textContent || "";
|
|
2173
|
+
if (o.pos === o.start() && y.length === 1 && y !== C) {
|
|
2173
2174
|
const p = o.pos;
|
|
2174
2175
|
return s(n.tr.insertText(C, p, p + 1)), t.preventDefault(), !0;
|
|
2175
2176
|
}
|
|
2176
|
-
if (
|
|
2177
|
-
const p = o.after(), f = n.tr.setSelection(
|
|
2177
|
+
if (y === C) {
|
|
2178
|
+
const p = o.after(), f = n.tr.setSelection(O.create(n.doc, p));
|
|
2178
2179
|
return s(f), t.preventDefault(), !0;
|
|
2179
2180
|
}
|
|
2180
|
-
if (
|
|
2181
|
-
const p = o.after(), f = n.tr.setSelection(
|
|
2181
|
+
if (y === "") {
|
|
2182
|
+
const p = o.after(), f = n.tr.setSelection(O.create(n.doc, p));
|
|
2182
2183
|
return s(f), t.preventDefault(), !0;
|
|
2183
2184
|
}
|
|
2184
|
-
if (o.pos === o.end() &&
|
|
2185
|
+
if (o.pos === o.end() && y.length > 0 && y !== C) {
|
|
2185
2186
|
const p = o.after();
|
|
2186
|
-
return s(n.tr.setSelection(
|
|
2187
|
+
return s(n.tr.setSelection(O.create(n.doc, p))), t.preventDefault(), !0;
|
|
2187
2188
|
}
|
|
2188
2189
|
return !1;
|
|
2189
2190
|
}
|
|
2190
|
-
if (
|
|
2191
|
-
const
|
|
2192
|
-
let f = n.tr.delete(
|
|
2193
|
-
return f = f.insertText(C,
|
|
2191
|
+
if (m && m.isText && ((u = m.text) == null ? void 0 : u.length) === 1 && m.text !== C && o.nodeBefore && o.nodeBefore.type.name === A.TEMPLATE_BLOCK) {
|
|
2192
|
+
const y = o.pos, p = o.pos + m.nodeSize;
|
|
2193
|
+
let f = n.tr.delete(y, p);
|
|
2194
|
+
return f = f.insertText(C, y, y), s(f), t.preventDefault(), !0;
|
|
2194
2195
|
}
|
|
2195
|
-
if (
|
|
2196
|
-
const
|
|
2197
|
-
if (
|
|
2198
|
-
const f = o.parent,
|
|
2199
|
-
let
|
|
2200
|
-
if (
|
|
2201
|
-
const
|
|
2202
|
-
|
|
2196
|
+
if (m && m.type.name === A.TEMPLATE_BLOCK) {
|
|
2197
|
+
const y = m.textContent || "";
|
|
2198
|
+
if (y.length === 0 || y === C) {
|
|
2199
|
+
const f = o.parent, x = o.index(), v = o.nodeBefore;
|
|
2200
|
+
let S = o.pos, _ = o.pos + m.nodeSize;
|
|
2201
|
+
if (v && v.isText && v.text === C && (S = S - 1), x < f.childCount - 1) {
|
|
2202
|
+
const b = f.child(x + 1);
|
|
2203
|
+
b && b.isText && b.text === C && (_ = _ + 1);
|
|
2203
2204
|
}
|
|
2204
|
-
return s(n.tr.delete(
|
|
2205
|
+
return s(n.tr.delete(S, _)), t.preventDefault(), !0;
|
|
2205
2206
|
} else {
|
|
2206
2207
|
const f = o.pos + 1;
|
|
2207
|
-
return s(n.tr.setSelection(
|
|
2208
|
+
return s(n.tr.setSelection(O.create(n.doc, f))), t.preventDefault(), !0;
|
|
2208
2209
|
}
|
|
2209
2210
|
}
|
|
2210
|
-
if (
|
|
2211
|
-
const
|
|
2212
|
-
if (p <
|
|
2213
|
-
const f =
|
|
2214
|
-
if (f.type.name ===
|
|
2215
|
-
const
|
|
2216
|
-
if (
|
|
2217
|
-
let
|
|
2218
|
-
const
|
|
2219
|
-
return
|
|
2211
|
+
if (m && m.isText) {
|
|
2212
|
+
const y = o.parent, p = o.index();
|
|
2213
|
+
if (p < y.childCount - 1) {
|
|
2214
|
+
const f = y.child(p + 1);
|
|
2215
|
+
if (f.type.name === A.TEMPLATE_BLOCK) {
|
|
2216
|
+
const x = f.textContent || "";
|
|
2217
|
+
if (x.length === 0 || x === C) {
|
|
2218
|
+
let S = o.pos;
|
|
2219
|
+
const _ = o.pos + m.nodeSize + f.nodeSize, b = o.nodeBefore;
|
|
2220
|
+
return b && b.isText && ((g = b.text) != null && g.endsWith(C)) && (S = S - 1), s(n.tr.delete(S, _)), t.preventDefault(), !0;
|
|
2220
2221
|
}
|
|
2221
|
-
if (
|
|
2222
|
-
const
|
|
2223
|
-
return s(n.tr.setSelection(
|
|
2222
|
+
if (m.text === C || (h = m.text) != null && h.startsWith(C)) {
|
|
2223
|
+
const S = o.pos + 2;
|
|
2224
|
+
return s(n.tr.setSelection(O.create(n.doc, S))), t.preventDefault(), !0;
|
|
2224
2225
|
}
|
|
2225
2226
|
}
|
|
2226
2227
|
}
|
|
2227
2228
|
}
|
|
2228
2229
|
}
|
|
2229
|
-
if (
|
|
2230
|
-
let
|
|
2231
|
-
const
|
|
2232
|
-
if (
|
|
2233
|
-
const f = n.tr.delete(
|
|
2230
|
+
if (I(t, "DELETE") && !r.empty) {
|
|
2231
|
+
let T = r.from, m = r.to;
|
|
2232
|
+
const y = o.nodeBefore, p = o.nodeAfter;
|
|
2233
|
+
if (y && y.isText && ((E = y.text) != null && E.endsWith(C)) && (T -= 1), p && p.isText && ((w = p.text) != null && w.startsWith(C)) && (m += 1), T !== r.from || m !== r.to) {
|
|
2234
|
+
const f = n.tr.delete(T, m);
|
|
2234
2235
|
return s(f), t.preventDefault(), !0;
|
|
2235
2236
|
}
|
|
2236
2237
|
}
|
|
@@ -2239,9 +2240,9 @@ function Vo() {
|
|
|
2239
2240
|
}
|
|
2240
2241
|
});
|
|
2241
2242
|
}
|
|
2242
|
-
function
|
|
2243
|
-
return new
|
|
2244
|
-
key: new
|
|
2243
|
+
function Yo() {
|
|
2244
|
+
return new ie({
|
|
2245
|
+
key: new re(ae.TEMPLATE_BLOCK_PASTE),
|
|
2245
2246
|
props: {
|
|
2246
2247
|
handlePaste(e, t) {
|
|
2247
2248
|
var o, l, i;
|
|
@@ -2253,29 +2254,29 @@ function Go() {
|
|
|
2253
2254
|
const { state: a, dispatch: c } = e, d = a.selection.$from;
|
|
2254
2255
|
let u = a.tr;
|
|
2255
2256
|
d.nodeBefore && d.nodeBefore.isText && d.nodeBefore.text === C && (u = u.delete(d.pos - d.nodeBefore.nodeSize, d.pos)), d.nodeAfter && d.nodeAfter.isText && d.nodeAfter.text === C && (u = u.delete(d.pos, d.pos + d.nodeAfter.nodeSize));
|
|
2256
|
-
const
|
|
2257
|
+
const g = r.split(`
|
|
2257
2258
|
`);
|
|
2258
|
-
let
|
|
2259
|
-
if (
|
|
2260
|
-
u = u.insertText(
|
|
2259
|
+
let h;
|
|
2260
|
+
if (g.length === 1)
|
|
2261
|
+
u = u.insertText(g[0], u.selection.from, u.selection.to), h = u.selection.$to.pos;
|
|
2261
2262
|
else {
|
|
2262
|
-
u = u.insertText(
|
|
2263
|
+
u = u.insertText(g[0], u.selection.from, u.selection.to);
|
|
2263
2264
|
let E = u.selection.$to.pos;
|
|
2264
|
-
for (let
|
|
2265
|
-
const
|
|
2266
|
-
u = u.insert(E,
|
|
2265
|
+
for (let w = 1; w < g.length; w++) {
|
|
2266
|
+
const T = a.schema.nodes.paragraph.create({}, g[w] ? a.schema.text(g[w]) : null);
|
|
2267
|
+
u = u.insert(E, T), E += T.nodeSize;
|
|
2267
2268
|
}
|
|
2268
|
-
|
|
2269
|
+
h = E;
|
|
2269
2270
|
}
|
|
2270
|
-
return u = u.setSelection(
|
|
2271
|
+
return u = u.setSelection(O.create(u.doc, h)), u = u.scrollIntoView(), c(u), t.preventDefault(), !0;
|
|
2271
2272
|
}
|
|
2272
2273
|
return !1;
|
|
2273
2274
|
}
|
|
2274
2275
|
}
|
|
2275
2276
|
});
|
|
2276
2277
|
}
|
|
2277
|
-
const
|
|
2278
|
-
name:
|
|
2278
|
+
const Zo = ct.create({
|
|
2279
|
+
name: A.TEMPLATE_BLOCK,
|
|
2279
2280
|
// 节点配置
|
|
2280
2281
|
group: "inline",
|
|
2281
2282
|
inline: !0,
|
|
@@ -2287,10 +2288,10 @@ const Uo = lt.create({
|
|
|
2287
2288
|
draggable: !1,
|
|
2288
2289
|
onCreate() {
|
|
2289
2290
|
const { items: e } = this.options;
|
|
2290
|
-
e &&
|
|
2291
|
+
e && ke(e) && K(
|
|
2291
2292
|
e,
|
|
2292
2293
|
() => {
|
|
2293
|
-
const t =
|
|
2294
|
+
const t = ke(e) ? e.value : e;
|
|
2294
2295
|
t != null && (this.editor.commands.setTemplateData(t), this.editor.commands.focusFirstTemplate());
|
|
2295
2296
|
},
|
|
2296
2297
|
{ deep: !0, immediate: !0 }
|
|
@@ -2328,7 +2329,7 @@ const Uo = lt.create({
|
|
|
2328
2329
|
const n = e.textContent || "";
|
|
2329
2330
|
return [
|
|
2330
2331
|
"span",
|
|
2331
|
-
|
|
2332
|
+
ut(this.options.HTMLAttributes || {}, t, {
|
|
2332
2333
|
"data-template": "",
|
|
2333
2334
|
"data-id": e.attrs.id,
|
|
2334
2335
|
"data-content": n
|
|
@@ -2338,18 +2339,18 @@ const Uo = lt.create({
|
|
|
2338
2339
|
},
|
|
2339
2340
|
// 使用 Vue 组件渲染
|
|
2340
2341
|
addNodeView() {
|
|
2341
|
-
return
|
|
2342
|
+
return at(Vo);
|
|
2342
2343
|
},
|
|
2343
2344
|
// 添加插件
|
|
2344
2345
|
addProseMirrorPlugins() {
|
|
2345
|
-
return [
|
|
2346
|
+
return [Uo(), Xo(), Yo()];
|
|
2346
2347
|
}
|
|
2347
|
-
}),
|
|
2348
|
-
|
|
2348
|
+
}), Ce = new re(
|
|
2349
|
+
ae.TEMPLATE_SELECT_DROPDOWN
|
|
2349
2350
|
);
|
|
2350
|
-
function
|
|
2351
|
-
return new
|
|
2352
|
-
key:
|
|
2351
|
+
function Jo() {
|
|
2352
|
+
return new ie({
|
|
2353
|
+
key: Ce,
|
|
2353
2354
|
state: {
|
|
2354
2355
|
init() {
|
|
2355
2356
|
return {
|
|
@@ -2358,7 +2359,7 @@ function Xo() {
|
|
|
2358
2359
|
};
|
|
2359
2360
|
},
|
|
2360
2361
|
apply(e, t) {
|
|
2361
|
-
const n = e.getMeta(
|
|
2362
|
+
const n = e.getMeta(Ce);
|
|
2362
2363
|
if (n) {
|
|
2363
2364
|
if (n.type === "open")
|
|
2364
2365
|
return {
|
|
@@ -2376,15 +2377,15 @@ function Xo() {
|
|
|
2376
2377
|
}
|
|
2377
2378
|
});
|
|
2378
2379
|
}
|
|
2379
|
-
function
|
|
2380
|
-
return new
|
|
2381
|
-
key: new
|
|
2380
|
+
function Qo() {
|
|
2381
|
+
return new ie({
|
|
2382
|
+
key: new re(ae.TEMPLATE_SELECT_ZERO_WIDTH),
|
|
2382
2383
|
appendTransaction(e, t, n) {
|
|
2383
2384
|
if (!e.some((l) => l.docChanged)) return null;
|
|
2384
2385
|
const r = [];
|
|
2385
2386
|
let { tr: o } = n;
|
|
2386
2387
|
return n.doc.descendants((l, i) => {
|
|
2387
|
-
if (l.type.name ===
|
|
2388
|
+
if (l.type.name === A.PARAGRAPH && l.childCount > 0) {
|
|
2388
2389
|
const { lastChild: a, firstChild: c } = l;
|
|
2389
2390
|
a === c && a && a.isText && a.text === C && r.push(["remove", i + 1]);
|
|
2390
2391
|
}
|
|
@@ -2394,49 +2395,49 @@ function Yo() {
|
|
|
2394
2395
|
}
|
|
2395
2396
|
});
|
|
2396
2397
|
}
|
|
2397
|
-
function
|
|
2398
|
-
return new
|
|
2399
|
-
key: new
|
|
2398
|
+
function es() {
|
|
2399
|
+
return new ie({
|
|
2400
|
+
key: new re(ae.TEMPLATE_SELECT_KEYBOARD),
|
|
2400
2401
|
props: {
|
|
2401
2402
|
handleKeyDown(e, t) {
|
|
2402
|
-
const { state: n, dispatch: s } = e, { selection: r } = n, { $from: o } = r, l =
|
|
2403
|
-
if (l != null && l.isOpen &&
|
|
2403
|
+
const { state: n, dispatch: s } = e, { selection: r } = n, { $from: o } = r, l = Ce.getState(e.state);
|
|
2404
|
+
if (l != null && l.isOpen && we(t, ["ENTER", "ARROW_UP", "ARROW_DOWN", "ESCAPE"]))
|
|
2404
2405
|
return !0;
|
|
2405
|
-
if (
|
|
2406
|
+
if (I(t, "BACKSPACE") && r.empty) {
|
|
2406
2407
|
const i = o.nodeBefore, a = o.nodeAfter;
|
|
2407
|
-
if ((i == null ? void 0 : i.type.name) ===
|
|
2408
|
+
if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_SELECT)
|
|
2408
2409
|
return s(n.tr.delete(o.pos - i.nodeSize, o.pos)), t.preventDefault(), !0;
|
|
2409
2410
|
if (i != null && i.isText && i.text === C) {
|
|
2410
2411
|
const c = o.pos - 1, u = n.doc.resolve(c).nodeBefore;
|
|
2411
|
-
if ((u == null ? void 0 : u.type.name) ===
|
|
2412
|
-
const
|
|
2413
|
-
return s(n.tr.delete(
|
|
2412
|
+
if ((u == null ? void 0 : u.type.name) === A.TEMPLATE_SELECT) {
|
|
2413
|
+
const g = c - u.nodeSize, h = o.pos;
|
|
2414
|
+
return s(n.tr.delete(g, h)), t.preventDefault(), !0;
|
|
2414
2415
|
}
|
|
2415
2416
|
}
|
|
2416
|
-
if ((a == null ? void 0 : a.type.name) ===
|
|
2417
|
+
if ((a == null ? void 0 : a.type.name) === A.TEMPLATE_SELECT) {
|
|
2417
2418
|
if (i != null && i.isText && i.text !== C)
|
|
2418
2419
|
return s(n.tr.delete(o.pos - 1, o.pos)), t.preventDefault(), !0;
|
|
2419
|
-
if ((i == null ? void 0 : i.type.name) ===
|
|
2420
|
+
if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_BLOCK)
|
|
2420
2421
|
return !1;
|
|
2421
2422
|
}
|
|
2422
2423
|
if (!a && (i != null && i.isText) && i.text !== C)
|
|
2423
2424
|
return s(n.tr.delete(o.pos - 1, o.pos)), t.preventDefault(), !0;
|
|
2424
2425
|
}
|
|
2425
|
-
if (
|
|
2426
|
+
if (I(t, "DELETE") && r.empty) {
|
|
2426
2427
|
const i = o.nodeAfter, a = o.nodeBefore;
|
|
2427
|
-
if ((i == null ? void 0 : i.type.name) ===
|
|
2428
|
+
if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_SELECT)
|
|
2428
2429
|
return s(n.tr.delete(o.pos, o.pos + i.nodeSize)), t.preventDefault(), !0;
|
|
2429
2430
|
if (i != null && i.isText && i.text === C) {
|
|
2430
2431
|
const c = o.pos + 1, u = n.doc.resolve(c).nodeAfter;
|
|
2431
|
-
if ((u == null ? void 0 : u.type.name) ===
|
|
2432
|
-
const
|
|
2433
|
-
return s(n.tr.delete(o.pos,
|
|
2432
|
+
if ((u == null ? void 0 : u.type.name) === A.TEMPLATE_SELECT) {
|
|
2433
|
+
const g = c + u.nodeSize;
|
|
2434
|
+
return s(n.tr.delete(o.pos, g)), t.preventDefault(), !0;
|
|
2434
2435
|
}
|
|
2435
2436
|
}
|
|
2436
|
-
if ((a == null ? void 0 : a.type.name) ===
|
|
2437
|
+
if ((a == null ? void 0 : a.type.name) === A.TEMPLATE_SELECT) {
|
|
2437
2438
|
if (i != null && i.isText && i.text !== C)
|
|
2438
2439
|
return s(n.tr.delete(o.pos, o.pos + 1)), t.preventDefault(), !0;
|
|
2439
|
-
if ((i == null ? void 0 : i.type.name) ===
|
|
2440
|
+
if ((i == null ? void 0 : i.type.name) === A.TEMPLATE_BLOCK)
|
|
2440
2441
|
return !1;
|
|
2441
2442
|
}
|
|
2442
2443
|
if (!a && (i != null && i.isText) && i.text !== C)
|
|
@@ -2447,7 +2448,7 @@ function Zo() {
|
|
|
2447
2448
|
}
|
|
2448
2449
|
});
|
|
2449
2450
|
}
|
|
2450
|
-
function
|
|
2451
|
+
function ts(e, t, n) {
|
|
2451
2452
|
const s = (r) => {
|
|
2452
2453
|
const o = r.target;
|
|
2453
2454
|
!e.contains(o) && !t.contains(o) && (n(), document.removeEventListener("click", s));
|
|
@@ -2458,7 +2459,7 @@ function Jo(e, t, n) {
|
|
|
2458
2459
|
document.removeEventListener("click", s);
|
|
2459
2460
|
};
|
|
2460
2461
|
}
|
|
2461
|
-
const
|
|
2462
|
+
const ns = { class: "template-select__icon" }, os = ["onMousedown", "onMouseenter"], ss = /* @__PURE__ */ Z({
|
|
2462
2463
|
__name: "template-select-view",
|
|
2463
2464
|
props: {
|
|
2464
2465
|
node: {},
|
|
@@ -2466,134 +2467,134 @@ const Qo = { class: "template-select__icon" }, es = ["onMousedown", "onMouseente
|
|
|
2466
2467
|
editor: {}
|
|
2467
2468
|
},
|
|
2468
2469
|
setup(e) {
|
|
2469
|
-
const t = e, n =
|
|
2470
|
+
const t = e, n = F(!1), s = F(-1), r = F(), o = F();
|
|
2470
2471
|
let l = null, i = null;
|
|
2471
|
-
const a =
|
|
2472
|
-
var
|
|
2473
|
-
return ((
|
|
2474
|
-
}), d =
|
|
2475
|
-
n.value ?
|
|
2476
|
-
},
|
|
2477
|
-
var
|
|
2478
|
-
if (n.value = !0, (
|
|
2479
|
-
const
|
|
2480
|
-
|
|
2472
|
+
const a = R(() => t.node.attrs.options.find((x) => x.value === t.node.attrs.value)), c = R(() => {
|
|
2473
|
+
var x;
|
|
2474
|
+
return ((x = a.value) == null ? void 0 : x.label) || t.node.attrs.placeholder;
|
|
2475
|
+
}), d = R(() => !t.node.attrs.value), u = () => {
|
|
2476
|
+
n.value ? h() : g();
|
|
2477
|
+
}, g = async () => {
|
|
2478
|
+
var x;
|
|
2479
|
+
if (n.value = !0, (x = t.editor) != null && x.view) {
|
|
2480
|
+
const v = t.editor.view, S = v.state.tr;
|
|
2481
|
+
S.setMeta(Ce, {
|
|
2481
2482
|
type: "open",
|
|
2482
2483
|
selectId: t.node.attrs.id
|
|
2483
|
-
}),
|
|
2484
|
+
}), v.dispatch(S);
|
|
2484
2485
|
}
|
|
2485
|
-
t.node.attrs.value ? s.value = t.node.attrs.options.findIndex((
|
|
2486
|
-
},
|
|
2487
|
-
var
|
|
2488
|
-
if (n.value = !1, s.value = -1, (
|
|
2489
|
-
const
|
|
2490
|
-
|
|
2486
|
+
t.node.attrs.value ? s.value = t.node.attrs.options.findIndex((v) => v.value === t.node.attrs.value) : s.value = -1, await me(), w(), r.value && o.value && (l = ts(r.value, o.value, h));
|
|
2487
|
+
}, h = async () => {
|
|
2488
|
+
var x;
|
|
2489
|
+
if (n.value = !1, s.value = -1, (x = t.editor) != null && x.view) {
|
|
2490
|
+
const v = t.editor.view, S = v.state.tr;
|
|
2491
|
+
S.setMeta(Ce, {
|
|
2491
2492
|
type: "close"
|
|
2492
|
-
}),
|
|
2493
|
+
}), v.dispatch(S);
|
|
2493
2494
|
}
|
|
2494
2495
|
l && (l(), l = null), i && (i(), i = null);
|
|
2495
|
-
}, E = (
|
|
2496
|
-
t.updateAttributes({ value:
|
|
2497
|
-
},
|
|
2498
|
-
!r.value || !o.value || (i && (i(), i = null), i =
|
|
2499
|
-
!r.value || !o.value ||
|
|
2496
|
+
}, E = (x) => {
|
|
2497
|
+
t.updateAttributes({ value: x.value }), h();
|
|
2498
|
+
}, w = () => {
|
|
2499
|
+
!r.value || !o.value || (i && (i(), i = null), i = mt(r.value, o.value, () => {
|
|
2500
|
+
!r.value || !o.value || yt(r.value, o.value, {
|
|
2500
2501
|
placement: "bottom-start",
|
|
2501
2502
|
strategy: "fixed",
|
|
2502
2503
|
// 使用 fixed 定位策略,相对于视口
|
|
2503
|
-
middleware: [
|
|
2504
|
-
}).then(({ x
|
|
2504
|
+
middleware: [ht(4), xt(), gt({ padding: 8 })]
|
|
2505
|
+
}).then(({ x, y: v }) => {
|
|
2505
2506
|
o.value && Object.assign(o.value.style, {
|
|
2506
|
-
left: `${
|
|
2507
|
-
top: `${
|
|
2507
|
+
left: `${x}px`,
|
|
2508
|
+
top: `${v}px`
|
|
2508
2509
|
});
|
|
2509
2510
|
});
|
|
2510
2511
|
}));
|
|
2511
|
-
},
|
|
2512
|
+
}, T = (x) => {
|
|
2512
2513
|
if (n.value)
|
|
2513
|
-
switch (
|
|
2514
|
+
switch (x.key) {
|
|
2514
2515
|
case "ArrowUp":
|
|
2515
|
-
|
|
2516
|
+
x.preventDefault(), m();
|
|
2516
2517
|
break;
|
|
2517
2518
|
case "ArrowDown":
|
|
2518
|
-
|
|
2519
|
+
x.preventDefault(), y();
|
|
2519
2520
|
break;
|
|
2520
2521
|
case "Enter":
|
|
2521
|
-
|
|
2522
|
+
x.preventDefault(), f();
|
|
2522
2523
|
break;
|
|
2523
2524
|
case "Escape":
|
|
2524
|
-
|
|
2525
|
+
x.preventDefault(), h();
|
|
2525
2526
|
break;
|
|
2526
2527
|
}
|
|
2527
|
-
},
|
|
2528
|
+
}, m = () => {
|
|
2528
2529
|
s.value === -1 || s.value <= 0 ? s.value = t.node.attrs.options.length - 1 : s.value -= 1, p();
|
|
2529
|
-
},
|
|
2530
|
+
}, y = () => {
|
|
2530
2531
|
s.value === -1 || s.value >= t.node.attrs.options.length - 1 ? s.value = 0 : s.value += 1, p();
|
|
2531
2532
|
}, p = () => {
|
|
2532
|
-
|
|
2533
|
+
me(() => {
|
|
2533
2534
|
if (!o.value) return;
|
|
2534
|
-
const
|
|
2535
|
-
|
|
2535
|
+
const x = o.value.querySelector(".template-select__option.is-highlighted");
|
|
2536
|
+
x && x.scrollIntoView({
|
|
2536
2537
|
block: "nearest",
|
|
2537
2538
|
behavior: "smooth"
|
|
2538
2539
|
});
|
|
2539
2540
|
});
|
|
2540
2541
|
}, f = () => {
|
|
2541
|
-
s.value >= 0 && s.value < t.node.attrs.options.length ? E(t.node.attrs.options[s.value]) :
|
|
2542
|
+
s.value >= 0 && s.value < t.node.attrs.options.length ? E(t.node.attrs.options[s.value]) : h();
|
|
2542
2543
|
};
|
|
2543
2544
|
return dn(() => {
|
|
2544
|
-
document.addEventListener("keydown",
|
|
2545
|
+
document.addEventListener("keydown", T);
|
|
2545
2546
|
}), fn(() => {
|
|
2546
|
-
document.removeEventListener("keydown",
|
|
2547
|
-
}), (
|
|
2547
|
+
document.removeEventListener("keydown", T), l && l(), i && i();
|
|
2548
|
+
}), (x, v) => (M(), U(k(lt), {
|
|
2548
2549
|
as: "span",
|
|
2549
2550
|
class: "template-select"
|
|
2550
2551
|
}, {
|
|
2551
|
-
default:
|
|
2552
|
-
|
|
2552
|
+
default: j(() => [
|
|
2553
|
+
v[0] || (v[0] = B("span", {
|
|
2553
2554
|
contenteditable: "false",
|
|
2554
2555
|
class: "template-select__prefix"
|
|
2555
2556
|
}, "", -1)),
|
|
2556
2557
|
B("span", {
|
|
2557
2558
|
ref_key: "triggerRef",
|
|
2558
2559
|
ref: r,
|
|
2559
|
-
class:
|
|
2560
|
-
onMousedown:
|
|
2560
|
+
class: Q(["template-select__trigger", { "is-open": n.value }]),
|
|
2561
|
+
onMousedown: nt(u, ["prevent"])
|
|
2561
2562
|
}, [
|
|
2562
2563
|
B("span", {
|
|
2563
|
-
class:
|
|
2564
|
-
},
|
|
2565
|
-
B("span",
|
|
2566
|
-
|
|
2564
|
+
class: Q(["template-select__text", { "is-placeholder": d.value }])
|
|
2565
|
+
}, pe(c.value), 3),
|
|
2566
|
+
B("span", ns, [
|
|
2567
|
+
se(k(Pn))
|
|
2567
2568
|
])
|
|
2568
2569
|
], 34),
|
|
2569
|
-
|
|
2570
|
+
v[1] || (v[1] = B("span", {
|
|
2570
2571
|
contenteditable: "false",
|
|
2571
2572
|
class: "template-select__suffix"
|
|
2572
2573
|
}, "", -1)),
|
|
2573
|
-
(
|
|
2574
|
-
n.value ? (
|
|
2574
|
+
(M(), U(pn, { to: "body" }, [
|
|
2575
|
+
n.value ? (M(), P("div", {
|
|
2575
2576
|
key: 0,
|
|
2576
2577
|
ref_key: "dropdownRef",
|
|
2577
2578
|
ref: o,
|
|
2578
2579
|
class: "template-select__dropdown"
|
|
2579
2580
|
}, [
|
|
2580
|
-
(
|
|
2581
|
-
key:
|
|
2582
|
-
class:
|
|
2583
|
-
"is-highlighted":
|
|
2584
|
-
"is-selected":
|
|
2581
|
+
(M(!0), P(Ie, null, Be(e.node.attrs.options, (S, _) => (M(), P("div", {
|
|
2582
|
+
key: S.value,
|
|
2583
|
+
class: Q(["template-select__option", {
|
|
2584
|
+
"is-highlighted": _ === s.value,
|
|
2585
|
+
"is-selected": S.value === e.node.attrs.value
|
|
2585
2586
|
}]),
|
|
2586
|
-
onMousedown:
|
|
2587
|
-
onMouseenter: (
|
|
2588
|
-
},
|
|
2589
|
-
], 512)) :
|
|
2587
|
+
onMousedown: nt((b) => E(S), ["prevent"]),
|
|
2588
|
+
onMouseenter: (b) => s.value = _
|
|
2589
|
+
}, pe(S.label), 43, os))), 128))
|
|
2590
|
+
], 512)) : q("", !0)
|
|
2590
2591
|
]))
|
|
2591
2592
|
]),
|
|
2592
2593
|
_: 1
|
|
2593
2594
|
}));
|
|
2594
2595
|
}
|
|
2595
|
-
}),
|
|
2596
|
-
name:
|
|
2596
|
+
}), rs = /* @__PURE__ */ J(ss, [["__scopeId", "data-v-dbb18436"]]), is = ct.create({
|
|
2597
|
+
name: A.TEMPLATE_SELECT,
|
|
2597
2598
|
// 节点配置
|
|
2598
2599
|
group: "inline",
|
|
2599
2600
|
inline: !0,
|
|
@@ -2661,7 +2662,7 @@ const Qo = { class: "template-select__icon" }, es = ["onMousedown", "onMouseente
|
|
|
2661
2662
|
}
|
|
2662
2663
|
return [
|
|
2663
2664
|
"span",
|
|
2664
|
-
|
|
2665
|
+
ut(t, {
|
|
2665
2666
|
"data-template-select": "",
|
|
2666
2667
|
"data-id": e.attrs.id,
|
|
2667
2668
|
"data-placeholder": e.attrs.placeholder,
|
|
@@ -2673,23 +2674,23 @@ const Qo = { class: "template-select__icon" }, es = ["onMousedown", "onMouseente
|
|
|
2673
2674
|
},
|
|
2674
2675
|
// 使用 Vue 组件渲染
|
|
2675
2676
|
addNodeView() {
|
|
2676
|
-
return
|
|
2677
|
+
return at(rs);
|
|
2677
2678
|
},
|
|
2678
2679
|
// 添加插件
|
|
2679
2680
|
addProseMirrorPlugins() {
|
|
2680
|
-
return [
|
|
2681
|
+
return [Jo(), Qo(), es()];
|
|
2681
2682
|
}
|
|
2682
2683
|
}), Zt = It.create({
|
|
2683
|
-
name:
|
|
2684
|
+
name: be.TEMPLATE,
|
|
2684
2685
|
addExtensions() {
|
|
2685
|
-
return [
|
|
2686
|
+
return [Zo.configure(this.options), is];
|
|
2686
2687
|
},
|
|
2687
2688
|
// 添加命令(统一命令入口)
|
|
2688
2689
|
addCommands() {
|
|
2689
|
-
return
|
|
2690
|
+
return zo;
|
|
2690
2691
|
}
|
|
2691
2692
|
});
|
|
2692
|
-
function
|
|
2693
|
+
function ls(e, t) {
|
|
2693
2694
|
return Zt.configure({
|
|
2694
2695
|
items: e,
|
|
2695
2696
|
...t
|
|
@@ -2718,72 +2719,72 @@ function Qt(e, t, n = 0, s = t.length - 1) {
|
|
|
2718
2719
|
}
|
|
2719
2720
|
return -1;
|
|
2720
2721
|
}
|
|
2721
|
-
const
|
|
2722
|
+
const rt = Jt(
|
|
2722
2723
|
/** @type {UnicodeDataEncoding} */
|
|
2723
2724
|
",9,a,,b,1,d,,e,h,3j,w,4p,,4t,,4u,,lc,33,w3,6,13l,18,14v,,14x,1,150,1,153,,16o,5,174,a,17g,,18r,k,19s,,1cm,6,1ct,,1cv,5,1d3,1,1d6,3,1e7,,1e9,,1f4,q,1ie,a,1kb,8,1kt,,1li,3,1ln,8,1lx,2,1m1,4,1nd,2,1ow,1,1p3,8,1qi,n,1r6,,1r7,v,1s3,,1tm,,1tn,,1to,,1tq,2,1tt,7,1u1,3,1u5,,1u6,1,1u9,6,1uq,1,1vl,,1vm,1,1x8,,1xa,,1xb,1,1xd,3,1xj,1,1xn,1,1xp,,1xz,,1ya,1,1z2,,1z5,1,1z7,,20s,,20u,2,20x,1,213,1,217,2,21d,,228,1,22d,,22p,1,22r,,24c,,24e,2,24h,4,24n,1,24p,,24r,1,24t,,25e,1,262,5,269,,26a,1,27w,,27y,1,280,,281,3,287,1,28b,1,28d,,28l,2,28y,1,29u,,2bi,,2bj,,2bk,,2bl,1,2bq,2,2bu,2,2bx,,2c7,,2dc,,2dd,2,2dg,,2f0,,2f2,2,2f5,3,2fa,2,2fe,3,2fp,1,2g2,1,2gx,,2gy,1,2ik,,2im,,2in,1,2ip,,2iq,,2ir,1,2iu,2,2iy,3,2j9,1,2jm,1,2k3,,2kg,1,2ki,1,2m3,1,2m6,,2m7,1,2m9,3,2me,2,2mi,2,2ml,,2mm,,2mv,,2n6,1,2o1,,2o2,1,2q2,,2q7,,2q8,1,2qa,2,2qe,,2qg,6,2qn,,2r6,1,2sx,,2sz,,2t0,6,2tj,7,2wh,,2wj,,2wk,8,2x4,6,2zc,1,305,,307,,309,,30e,1,31t,d,327,,328,4,32e,1,32l,a,32x,z,346,,371,3,375,,376,5,37d,1,37f,1,37h,1,386,1,388,1,38e,2,38x,3,39e,,39g,,39h,1,39p,,3a5,,3cw,2n,3fk,1z,3hk,2f,3tp,2,4k2,3,4ky,2,4lu,1,4mq,1,4ok,1,4om,,4on,6,4ou,7,4p2,,4p3,1,4p5,a,4pp,,4qz,2,4r2,,4r3,,4ud,1,4vd,,4yo,2,4yr,3,4yv,1,4yx,2,4z4,1,4z6,,4z7,5,4zd,2,55j,1,55l,1,55n,,579,,57a,,57b,,57c,6,57k,,57m,,57p,7,57x,5,583,9,58f,,59s,u,5c0,3,5c4,,5dg,9,5dq,3,5du,2,5ez,8,5fk,1,5fm,,5gh,,5gi,3,5gm,1,5go,5,5ie,,5if,,5ig,1,5ii,2,5il,,5im,,5in,4,5k4,7,5kc,7,5kk,1,5km,1,5ow,2,5p0,c,5pd,,5pe,6,5pp,,5pw,,5pz,,5q0,1,5vk,1r,6bv,,6bw,,6bx,,6by,1,6co,6,6d8,,6dl,,6e8,f,6hc,w,6jm,,6k9,,6ms,5,6nd,1,6xm,1,6y0,,70o,,72n,,73d,a,73s,2,79e,,7fu,1,7g6,,7gg,,7i3,3,7i8,5,7if,b,7is,35,7m8,39,7pk,a,7pw,,7py,,7q5,,7q9,,7qg,,7qr,1,7r8,,7rb,,7rg,,7ri,,7rn,2,7rr,,7s3,4,7th,2,7tt,,7u8,,7un,,850,1,8hx,2,8ij,1,8k0,,8k5,,8vj,2,8zj,,928,v,wvj,3,wvo,9,wwu,1,wz4,1,x6q,,x6u,,x6z,,x7n,1,x7p,1,x7r,,x7w,,xa8,1,xbo,f,xc4,1,xcw,h,xdr,,xeu,7,xfr,a,xg2,,xg3,,xgg,s,xhc,2,xhf,,xir,,xis,1,xiu,3,xiy,1,xj0,1,xj2,1,xj4,,xk5,,xm1,5,xm7,1,xm9,1,xmb,1,xmd,1,xmr,,xn0,,xn1,,xoc,,xps,,xpu,2,xpz,1,xq6,1,xq9,,xrf,,xrg,1,xri,1,xrp,,xrq,,xyb,1,xyd,,xye,1,xyg,,xyh,1,xyk,,xyl,,1e68,f,1e74,f,1edb,,1ehq,1,1ek0,b,1eyl,,1f4w,,1f92,4,1gjl,2,1gjp,1,1gjw,3,1gl4,2,1glb,,1gpx,1,1h5w,3,1h7t,4,1hgr,1,1hj0,3,1hl2,a,1hmq,3,1hq8,,1hq9,,1hqa,,1hrs,e,1htc,,1htf,1,1htr,2,1htu,,1hv4,2,1hv7,3,1hvb,1,1hvd,1,1hvh,,1hvm,,1hvx,,1hxc,2,1hyf,4,1hyk,,1hyl,7,1hz9,1,1i0j,,1i0w,1,1i0y,,1i2b,2,1i2e,8,1i2n,,1i2o,,1i2q,1,1i2x,3,1i32,,1i33,,1i5o,2,1i5r,2,1i5u,1,1i5w,3,1i66,,1i69,,1ian,,1iao,2,1iar,7,1ibk,1,1ibm,1,1id7,1,1ida,,1idb,,1idc,,1idd,3,1idj,1,1idn,1,1idp,,1idz,,1iea,1,1iee,6,1ieo,4,1igo,,1igp,1,1igr,5,1igy,,1ih1,,1ih3,2,1ih6,,1ih8,1,1iha,2,1ihd,,1ihe,,1iht,1,1ik5,2,1ik8,7,1ikg,1,1iki,2,1ikl,,1ikm,,1ila,,1ink,,1inl,1,1inn,5,1int,,1inu,,1inv,1,1inx,,1iny,,1inz,1,1io1,,1io2,1,1iun,,1iuo,1,1iuq,3,1iuw,3,1iv0,1,1iv2,,1iv3,1,1ivw,1,1iy8,2,1iyb,7,1iyj,1,1iyl,,1iym,,1iyn,1,1j1n,,1j1o,,1j1p,,1j1q,1,1j1s,7,1j4t,,1j4u,,1j4v,,1j4y,3,1j52,,1j53,4,1jcc,2,1jcf,8,1jco,,1jcp,1,1jjk,,1jjl,4,1jjr,1,1jjv,3,1jjz,,1jk0,,1jk1,,1jk2,,1jk3,,1jo1,2,1jo4,3,1joa,1,1joc,3,1jog,,1jok,,1jpd,9,1jqr,5,1jqx,,1jqy,,1jqz,3,1jrb,,1jrl,5,1jrr,1,1jrt,2,1jt0,5,1jt6,c,1jtj,,1jtk,1,1k4v,,1k4w,6,1k54,5,1k5a,,1k5b,,1k7m,l,1k89,,1k8a,6,1k8h,,1k8i,1,1k8k,,1k8l,1,1kc1,5,1kca,,1kcc,1,1kcf,6,1kcm,,1kcn,,1kei,4,1keo,1,1ker,1,1ket,,1keu,,1kev,,1koj,1,1kol,1,1kow,1,1koy,,1koz,,1kqc,1,1kqe,4,1kqm,1,1kqo,2,1kre,,1ovk,f,1ow0,,1ow7,e,1xr2,b,1xre,2,1xrh,2,1zow,4,1zqo,6,206b,,206f,3,20jz,,20k1,1i,20lr,3,20o4,,20og,1,2ftp,1,2fts,3,2jgg,19,2jhs,m,2jxh,4,2jxp,5,2jxv,7,2jy3,7,2jyd,6,2jze,3,2k3m,2,2lmo,1i,2lob,1d,2lpx,,2lqc,,2lqz,4,2lr5,e,2mtc,6,2mtk,g,2mu3,6,2mub,1,2mue,4,2mxb,,2n1s,6,2nce,,2ne4,3,2nsc,3,2nzi,1,2ok0,6,2on8,6,2pz4,73,2q6l,2,2q7j,,2q98,5,2q9q,1,2qa6,,2qa9,9,2qb1,1k,2qcm,p,2qdd,e,2qe2,,2qen,,2qeq,8,2qf0,3,2qfd,c1,2qrf,4,2qrk,8t,2r0m,7d,2r9c,3j,2rg4,b,2rit,16,2rkc,3,2rm0,7,2rmi,5,2rns,7,2rou,29,2rrg,1a,2rss,9,2rt3,c8,2scg,sd,jny8,v,jnz4,2n,jo1s,3j,jo5c,6n,joc0,2rz",
|
|
2724
2725
|
"262122424333333393233393339333333333393393b3b3b3b3b333b33b3bb33333b3b3333333b3b33bb3333b33b3bb33333b3bbb333b333b33333b3b3b3b3333b3b33b3bb39333b33b33b3b3b333b333333b3b333333b33b3b3333b3335dc333333b3b3b33323333b3bb3b33b3b3b3333b3333b3b333bb3b33b3b3b3b3b333b333b3323e2244234444444444444444444444444444444444444444443333333333b3b3bb33333b353b3b3b3b333b3b333b333333b3bb3b3b3bb333232333333333333333b3b3333bb3b393933b3b33bb3b393b3b3b3333b33b33b3bbb33b333b3333bb3933b3b3b333b3b3b3b3b33b3b3b33b3b3b33b3b33b33b3b3b33bb39b9b3b33b3b33b9333b393b3b33b33b3b3b3333393b3b3b33b39bb3b332333b333dd3b33332333323333333333333333333333344444444a44444434444444444444423232"
|
|
2725
|
-
),
|
|
2726
|
+
), as = Jt(
|
|
2726
2727
|
/** @type {UnicodeDataEncoding} */
|
|
2727
2728
|
"1sl,10,1ug,7,1vc,7,1w5,j,1wq,6,1wy,,1x2,3,1y4,1,1y7,,1yo,1,239,j,23u,6,242,1,245,4,261,,26t,j,27e,6,27m,1,27p,4,28s,1,28v,,29d,,2dx,j,2ei,f,2fs,2,2l1,11"
|
|
2728
2729
|
), _t = 65535;
|
|
2729
|
-
function*
|
|
2730
|
+
function* cs(e) {
|
|
2730
2731
|
let t = e.codePointAt(0);
|
|
2731
2732
|
if (t == null) return;
|
|
2732
|
-
let n = t <= _t ? 1 : 2, s = e.length, r = Lt(t), o = 0, l = 0, i = !1, a = !1, c = !1, d = 0, u = r,
|
|
2733
|
+
let n = t <= _t ? 1 : 2, s = e.length, r = Lt(t), o = 0, l = 0, i = !1, a = !1, c = !1, d = 0, u = r, g = t;
|
|
2733
2734
|
for (; n < s; ) {
|
|
2734
2735
|
t = /** @type {number} */
|
|
2735
2736
|
e.codePointAt(n), o = Lt(t);
|
|
2736
|
-
let
|
|
2737
|
-
r === 1 ?
|
|
2737
|
+
let h = !0;
|
|
2738
|
+
r === 1 ? h = o !== 6 : r === 2 || r === 6 || o === 1 || o === 2 || o === 6 ? h = !0 : o === 3 || o === 14 || o === 11 || r === 9 ? h = !1 : r === 14 && o === 4 ? h = !i : r === 10 && o === 10 ? h = l++ % 2 === 1 : r === 5 ? h = !(o === 5 || o === 13 || o === 7 || o === 8) : ((r === 7 || r === 13) && (o === 13 || o === 12) || (r === 8 || r === 12) && o === 12 || o === 0 && a && c && kt(t)) && (h = !1), h ? (yield {
|
|
2738
2739
|
segment: e.slice(d, n),
|
|
2739
2740
|
index: d,
|
|
2740
2741
|
input: e,
|
|
2741
|
-
_hd:
|
|
2742
|
+
_hd: g,
|
|
2742
2743
|
_catBegin: u,
|
|
2743
2744
|
_catEnd: r
|
|
2744
|
-
}, i = !1, l = 0, d = n, u = o,
|
|
2745
|
+
}, i = !1, l = 0, d = n, u = o, g = t) : o === 14 && (r === 3 || r === 4) ? i = !0 : t >= 2325 && (!a && r === 0 && (a = kt(g)), a && o === 3 ? c = c || t === 2381 || t === 2509 || t === 2637 || t === 2765 || t === 2893 || t === 3149 || t === 3405 : c = !1), n += t <= _t ? 1 : 2, r = o;
|
|
2745
2746
|
}
|
|
2746
2747
|
d < s && (yield {
|
|
2747
2748
|
segment: e.slice(d),
|
|
2748
2749
|
index: d,
|
|
2749
2750
|
input: e,
|
|
2750
|
-
_hd:
|
|
2751
|
+
_hd: g,
|
|
2751
2752
|
_catBegin: u,
|
|
2752
2753
|
_catEnd: r
|
|
2753
2754
|
});
|
|
2754
2755
|
}
|
|
2755
|
-
function
|
|
2756
|
+
function us(e) {
|
|
2756
2757
|
let t = 0;
|
|
2757
|
-
for (let n of
|
|
2758
|
+
for (let n of cs(e)) t += 1;
|
|
2758
2759
|
return t;
|
|
2759
2760
|
}
|
|
2760
|
-
const en = new Uint8Array(6080),
|
|
2761
|
+
const en = new Uint8Array(6080), qe = 128, it = 12287, tn = new Uint8Array(1536), He = 40960, nn = 44031, ds = (() => {
|
|
2761
2762
|
let e = 0;
|
|
2762
2763
|
for (; ; ) {
|
|
2763
|
-
let [t, n, s] =
|
|
2764
|
+
let [t, n, s] = rt[e];
|
|
2764
2765
|
if (t > nn) break;
|
|
2765
|
-
if (e++, !(n <
|
|
2766
|
+
if (e++, !(n < qe || t > it && n < He))
|
|
2766
2767
|
for (let r = t; r <= n; r++) {
|
|
2767
2768
|
let o, l = 0;
|
|
2768
|
-
r <=
|
|
2769
|
+
r <= it ? (o = en, l = r - qe >> 1) : (o = tn, l = r - He >> 1), o[l] = r & 1 ? o[l] & 15 | s << 4 : o[l] & 240 | s;
|
|
2769
2770
|
}
|
|
2770
2771
|
}
|
|
2771
2772
|
return e;
|
|
2772
2773
|
})();
|
|
2773
2774
|
function Lt(e) {
|
|
2774
|
-
if (e <
|
|
2775
|
+
if (e < qe)
|
|
2775
2776
|
return e >= 32 ? 0 : e === 10 ? 6 : e === 13 ? 1 : 2;
|
|
2776
|
-
if (e <=
|
|
2777
|
-
let n = en[e -
|
|
2777
|
+
if (e <= it) {
|
|
2778
|
+
let n = en[e - qe >> 1];
|
|
2778
2779
|
return (
|
|
2779
2780
|
/** @type {GraphemeCategoryNum} */
|
|
2780
2781
|
e & 1 ? n >> 4 : n & 15
|
|
2781
2782
|
);
|
|
2782
2783
|
}
|
|
2783
|
-
if (e <
|
|
2784
|
+
if (e < He)
|
|
2784
2785
|
return e < 12336 ? e >= 12330 ? 3 : 0 : e < 12443 ? e === 12336 || e === 12349 ? 4 : e >= 12441 ? 3 : 0 : e === 12951 || e === 12953 ? 4 : 0;
|
|
2785
2786
|
if (e <= nn) {
|
|
2786
|
-
let n = tn[e -
|
|
2787
|
+
let n = tn[e - He >> 1];
|
|
2787
2788
|
return (
|
|
2788
2789
|
/** @type {GraphemeCategoryNum} */
|
|
2789
2790
|
e & 1 ? n >> 4 : n & 15
|
|
@@ -2795,11 +2796,11 @@ function Lt(e) {
|
|
|
2795
2796
|
return e <= 55238 ? e >= 55216 ? 13 : 0 : e >= 55243 ? 12 : 0;
|
|
2796
2797
|
if (e < 65024)
|
|
2797
2798
|
return e === 64286 ? 3 : 0;
|
|
2798
|
-
let t = Qt(e,
|
|
2799
|
-
return t < 0 ? 0 :
|
|
2799
|
+
let t = Qt(e, rt, ds);
|
|
2800
|
+
return t < 0 ? 0 : rt[t][2];
|
|
2800
2801
|
}
|
|
2801
2802
|
function kt(e) {
|
|
2802
|
-
return Qt(e,
|
|
2803
|
+
return Qt(e, as) >= 0;
|
|
2803
2804
|
}
|
|
2804
2805
|
const Mt = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null;
|
|
2805
2806
|
function on(e) {
|
|
@@ -2810,27 +2811,27 @@ function on(e) {
|
|
|
2810
2811
|
t++;
|
|
2811
2812
|
return t;
|
|
2812
2813
|
}
|
|
2813
|
-
return
|
|
2814
|
+
return us(e);
|
|
2814
2815
|
}
|
|
2815
|
-
function
|
|
2816
|
-
const n =
|
|
2816
|
+
function fs(e, t) {
|
|
2817
|
+
const n = F(null), s = De(e, "placeholder"), r = () => {
|
|
2817
2818
|
var i;
|
|
2818
2819
|
const l = [
|
|
2819
|
-
vn,
|
|
2820
|
-
Tn,
|
|
2821
2820
|
En,
|
|
2822
2821
|
wn,
|
|
2822
|
+
Cn,
|
|
2823
|
+
An,
|
|
2823
2824
|
// 提供 undo/redo 功能
|
|
2824
|
-
|
|
2825
|
+
Sn.configure({
|
|
2825
2826
|
placeholder: () => s.value || "请输入内容..."
|
|
2826
2827
|
}),
|
|
2827
|
-
|
|
2828
|
+
_n.configure({
|
|
2828
2829
|
mode: "textSize",
|
|
2829
2830
|
textCounter: on
|
|
2830
2831
|
})
|
|
2831
2832
|
];
|
|
2832
2833
|
return (i = e.extensions) != null && i.length && l.push(...e.extensions), l;
|
|
2833
|
-
}, o =
|
|
2834
|
+
}, o = vn({
|
|
2834
2835
|
content: e.modelValue ?? e.defaultValue ?? "",
|
|
2835
2836
|
extensions: r(),
|
|
2836
2837
|
autofocus: e.autofocus ? "end" : !1,
|
|
@@ -2841,13 +2842,13 @@ function cs(e, t) {
|
|
|
2841
2842
|
},
|
|
2842
2843
|
// 处理粘贴事件 - 只粘贴纯文本
|
|
2843
2844
|
handlePaste(l, i) {
|
|
2844
|
-
var
|
|
2845
|
-
const a = (
|
|
2845
|
+
var g;
|
|
2846
|
+
const a = (g = i.clipboardData) == null ? void 0 : g.getData("text/plain");
|
|
2846
2847
|
if (!a) return !1;
|
|
2847
2848
|
const c = e.mode === "single" ? a.replace(/\r?\n/g, " ") : a, { state: d } = l, { tr: u } = d;
|
|
2848
|
-
return u.insertText(c), l.dispatch(u),
|
|
2849
|
-
var
|
|
2850
|
-
(
|
|
2849
|
+
return u.insertText(c), l.dispatch(u), me(() => {
|
|
2850
|
+
var h;
|
|
2851
|
+
(h = o.value) == null || h.commands.scrollIntoView();
|
|
2851
2852
|
}), !0;
|
|
2852
2853
|
}
|
|
2853
2854
|
},
|
|
@@ -2862,12 +2863,12 @@ function cs(e, t) {
|
|
|
2862
2863
|
t("blur", l.event);
|
|
2863
2864
|
}
|
|
2864
2865
|
});
|
|
2865
|
-
return
|
|
2866
|
+
return K(
|
|
2866
2867
|
() => e.modelValue,
|
|
2867
2868
|
(l) => {
|
|
2868
2869
|
o.value && l !== o.value.getText() && o.value.commands.setContent(l ?? "", { emitUpdate: !1 });
|
|
2869
2870
|
}
|
|
2870
|
-
),
|
|
2871
|
+
), K(
|
|
2871
2872
|
() => e.placeholder,
|
|
2872
2873
|
() => {
|
|
2873
2874
|
if (o.value) {
|
|
@@ -2875,7 +2876,7 @@ function cs(e, t) {
|
|
|
2875
2876
|
o.value.view.dispatch(i);
|
|
2876
2877
|
}
|
|
2877
2878
|
}
|
|
2878
|
-
),
|
|
2879
|
+
), K(
|
|
2879
2880
|
() => e.enterkeyhint,
|
|
2880
2881
|
(l) => {
|
|
2881
2882
|
if (o.value) {
|
|
@@ -2891,11 +2892,11 @@ function cs(e, t) {
|
|
|
2891
2892
|
editorRef: n
|
|
2892
2893
|
};
|
|
2893
2894
|
}
|
|
2894
|
-
function
|
|
2895
|
+
function ps(e) {
|
|
2895
2896
|
const { submitType: t } = e;
|
|
2896
2897
|
return {
|
|
2897
2898
|
checkSubmitShortcut: (r) => {
|
|
2898
|
-
if (!
|
|
2899
|
+
if (!I(r, "ENTER")) return !1;
|
|
2899
2900
|
switch (t.value) {
|
|
2900
2901
|
case "enter":
|
|
2901
2902
|
return !r.shiftKey && !r.ctrlKey && !r.metaKey;
|
|
@@ -2908,7 +2909,7 @@ function us(e) {
|
|
|
2908
2909
|
}
|
|
2909
2910
|
},
|
|
2910
2911
|
checkNewlineShortcut: (r) => {
|
|
2911
|
-
if (!
|
|
2912
|
+
if (!I(r, "ENTER")) return !1;
|
|
2912
2913
|
switch (t.value) {
|
|
2913
2914
|
case "enter":
|
|
2914
2915
|
return r.shiftKey || r.ctrlKey || r.metaKey;
|
|
@@ -2921,32 +2922,32 @@ function us(e) {
|
|
|
2921
2922
|
}
|
|
2922
2923
|
};
|
|
2923
2924
|
}
|
|
2924
|
-
function
|
|
2925
|
-
const s =
|
|
2925
|
+
function ms(e, t, n) {
|
|
2926
|
+
const s = F(e.mode || "single"), r = F(!1), o = F(e.mode || "single"), { start: l, stop: i } = Ln(
|
|
2926
2927
|
() => {
|
|
2927
2928
|
r.value = !1;
|
|
2928
2929
|
},
|
|
2929
2930
|
300,
|
|
2930
2931
|
{ immediate: !1 }
|
|
2931
|
-
), a =
|
|
2932
|
+
), a = R(() => {
|
|
2932
2933
|
var u;
|
|
2933
2934
|
return (u = n.value) == null ? void 0 : u.closest(".tr-sender-main");
|
|
2934
2935
|
}), c = () => {
|
|
2935
2936
|
if (o.value !== "single" || r.value || !t.value || !n.value) return;
|
|
2936
2937
|
const u = n.value.querySelector(".ProseMirror");
|
|
2937
2938
|
if (!u) return;
|
|
2938
|
-
const
|
|
2939
|
-
s.value === "single" ? u.scrollWidth > u.clientWidth && d("multiple") :
|
|
2939
|
+
const g = t.value.getText();
|
|
2940
|
+
s.value === "single" ? u.scrollWidth > u.clientWidth && d("multiple") : g.length || d("single");
|
|
2940
2941
|
}, d = (u) => {
|
|
2941
|
-
s.value !== u && (r.value = !0, s.value = u,
|
|
2942
|
+
s.value !== u && (r.value = !0, s.value = u, me(() => {
|
|
2942
2943
|
t.value && t.value.commands.focus("end"), i(), l();
|
|
2943
2944
|
}));
|
|
2944
2945
|
};
|
|
2945
|
-
return
|
|
2946
|
+
return kn(a, () => {
|
|
2946
2947
|
requestAnimationFrame(() => {
|
|
2947
2948
|
c();
|
|
2948
2949
|
});
|
|
2949
|
-
}),
|
|
2950
|
+
}), K(
|
|
2950
2951
|
() => e.mode,
|
|
2951
2952
|
(u) => {
|
|
2952
2953
|
u && u !== s.value && (o.value = u, d(u));
|
|
@@ -2958,15 +2959,15 @@ function ds(e, t, n) {
|
|
|
2958
2959
|
checkOverflow: c
|
|
2959
2960
|
};
|
|
2960
2961
|
}
|
|
2961
|
-
function
|
|
2962
|
-
const s =
|
|
2962
|
+
function hs(e, t, n) {
|
|
2963
|
+
const s = Mn("--tr-sender-line-height", t), r = R(() => {
|
|
2963
2964
|
const i = s.value;
|
|
2964
2965
|
if (i) {
|
|
2965
2966
|
const a = parseFloat(i);
|
|
2966
2967
|
return isNaN(a) ? 26 : a;
|
|
2967
2968
|
}
|
|
2968
2969
|
return 26;
|
|
2969
|
-
}), o =
|
|
2970
|
+
}), o = R(() => n === !1 || n === void 0 ? null : n === !0 ? {
|
|
2970
2971
|
minRows: 1,
|
|
2971
2972
|
maxRows: 5
|
|
2972
2973
|
} : typeof n == "object" ? {
|
|
@@ -2986,18 +2987,18 @@ function fs(e, t, n) {
|
|
|
2986
2987
|
} else
|
|
2987
2988
|
i.style.minHeight = "", i.style.maxHeight = "", i.style.overflowY = e.value === "single" ? "hidden" : "auto";
|
|
2988
2989
|
};
|
|
2989
|
-
return
|
|
2990
|
+
return K(
|
|
2990
2991
|
e,
|
|
2991
2992
|
() => {
|
|
2992
|
-
|
|
2993
|
+
me(() => {
|
|
2993
2994
|
l();
|
|
2994
2995
|
});
|
|
2995
2996
|
},
|
|
2996
2997
|
{ immediate: !0 }
|
|
2997
|
-
),
|
|
2998
|
+
), K(
|
|
2998
2999
|
o,
|
|
2999
3000
|
() => {
|
|
3000
|
-
|
|
3001
|
+
me(() => {
|
|
3001
3002
|
l();
|
|
3002
3003
|
});
|
|
3003
3004
|
},
|
|
@@ -3006,113 +3007,149 @@ function fs(e, t, n) {
|
|
|
3006
3007
|
updateHeight: l
|
|
3007
3008
|
};
|
|
3008
3009
|
}
|
|
3009
|
-
|
|
3010
|
-
const
|
|
3011
|
-
|
|
3012
|
-
return
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3010
|
+
const gs = (e) => e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.length > 0 : typeof e == "object" ? Object.keys(e).length > 0 : !!e, xs = (e, t) => {
|
|
3011
|
+
const n = gn(t);
|
|
3012
|
+
if (gs(n))
|
|
3013
|
+
return {
|
|
3014
|
+
source: e,
|
|
3015
|
+
payload: n
|
|
3016
|
+
};
|
|
3017
|
+
};
|
|
3018
|
+
function ys() {
|
|
3019
|
+
const e = hn(/* @__PURE__ */ new Map()), t = R(() => {
|
|
3020
|
+
const r = [];
|
|
3021
|
+
for (const o of e.values()) {
|
|
3022
|
+
const l = xs(o.source, o.payload);
|
|
3023
|
+
l && r.push(l);
|
|
3022
3024
|
}
|
|
3023
|
-
|
|
3024
|
-
}, { currentMode: d, isAutoSwitching: u, setMode: x, checkOverflow: g } = ds(e, n, s), E = us({
|
|
3025
|
-
submitType: O(() => e.submitType ?? "enter")
|
|
3025
|
+
return r;
|
|
3026
3026
|
});
|
|
3027
|
-
|
|
3027
|
+
return {
|
|
3028
|
+
hasRegisteredContent: R(() => t.value.length > 0),
|
|
3029
|
+
registerContent: (r, o) => {
|
|
3030
|
+
const l = Symbol("sender-content");
|
|
3031
|
+
return e.set(l, { source: r, payload: o }), () => {
|
|
3032
|
+
e.delete(l);
|
|
3033
|
+
};
|
|
3034
|
+
},
|
|
3035
|
+
externalPayloads: t
|
|
3036
|
+
};
|
|
3037
|
+
}
|
|
3038
|
+
function bs(e, t) {
|
|
3039
|
+
const { editor: n, editorRef: s } = fs(e, t), r = R(() => n.value ? tt(n.value).trim().length > 0 : !1), { hasRegisteredContent: o, registerContent: l, externalPayloads: i } = ys(), a = R(() => r.value || o.value || !!e.hasExternalContent), c = R(() => n.value ? on(tt(n.value)) : 0), d = R(() => e.maxLength ? c.value > e.maxLength : !1), u = R(() => {
|
|
3040
|
+
var b, L;
|
|
3041
|
+
return !e.disabled && !e.loading && a.value && !d.value && !((L = (b = e.defaultActions) == null ? void 0 : b.submit) != null && L.disabled);
|
|
3042
|
+
}), g = () => {
|
|
3043
|
+
if (!u.value || !n.value) return;
|
|
3044
|
+
let b, L = "";
|
|
3045
|
+
if (n.value.extensionManager.extensions.some((N) => N.name === be.TEMPLATE)) {
|
|
3046
|
+
const N = Yt(n.value);
|
|
3047
|
+
N.length > 0 && (b = N), L = tt(n.value);
|
|
3048
|
+
} else if (n.value.extensionManager.extensions.some((N) => N.name === be.MENTION)) {
|
|
3049
|
+
const N = Po(n.value);
|
|
3050
|
+
N.length > 0 && (b = N), L = Ro(n.value);
|
|
3051
|
+
}
|
|
3052
|
+
L || (L = n.value.getText());
|
|
3053
|
+
const $ = i.value.slice();
|
|
3054
|
+
if ($.length === 0) {
|
|
3055
|
+
t("submit", L, b);
|
|
3056
|
+
return;
|
|
3057
|
+
}
|
|
3058
|
+
t("submit", L, b, {
|
|
3059
|
+
externalPayloads: $
|
|
3060
|
+
});
|
|
3061
|
+
}, { currentMode: h, isAutoSwitching: E, setMode: w, checkOverflow: T } = ms(e, n, s), m = ps({
|
|
3062
|
+
submitType: R(() => e.submitType ?? "enter")
|
|
3063
|
+
});
|
|
3064
|
+
K(
|
|
3028
3065
|
n,
|
|
3029
|
-
(
|
|
3030
|
-
|
|
3066
|
+
(b) => {
|
|
3067
|
+
b && b.setOptions({
|
|
3031
3068
|
editorProps: {
|
|
3032
|
-
...
|
|
3033
|
-
handleKeyDown: (
|
|
3034
|
-
const
|
|
3035
|
-
return
|
|
3036
|
-
|
|
3037
|
-
}, 0)) :
|
|
3069
|
+
...b.options.editorProps,
|
|
3070
|
+
handleKeyDown: (L, $) => {
|
|
3071
|
+
const N = de.getState(L.state), Se = z.getState(L.state), V = Ce.getState(L.state);
|
|
3072
|
+
return N && N.active || Se && Se.active || V && V.isOpen ? !1 : m.checkSubmitShortcut($) ? ($.preventDefault(), g(), !0) : m.checkNewlineShortcut($) ? ($.preventDefault(), h.value === "single" ? (w("multiple"), setTimeout(() => {
|
|
3073
|
+
b.commands.splitBlock(), b.commands.focus();
|
|
3074
|
+
}, 0)) : b.commands.splitBlock(), !0) : !1;
|
|
3038
3075
|
}
|
|
3039
3076
|
}
|
|
3040
3077
|
});
|
|
3041
3078
|
},
|
|
3042
3079
|
{ immediate: !0 }
|
|
3043
|
-
),
|
|
3080
|
+
), hs(h, s, e.autoSize), K(
|
|
3044
3081
|
() => {
|
|
3045
|
-
var
|
|
3046
|
-
return (
|
|
3082
|
+
var b;
|
|
3083
|
+
return (b = n.value) == null ? void 0 : b.state.doc.content;
|
|
3047
3084
|
},
|
|
3048
3085
|
() => {
|
|
3049
3086
|
setTimeout(() => {
|
|
3050
|
-
|
|
3087
|
+
T();
|
|
3051
3088
|
}, 0);
|
|
3052
3089
|
},
|
|
3053
3090
|
{ deep: !0 }
|
|
3054
3091
|
);
|
|
3055
|
-
const
|
|
3056
|
-
var
|
|
3057
|
-
(
|
|
3058
|
-
},
|
|
3059
|
-
var
|
|
3060
|
-
(
|
|
3061
|
-
}, h = () => {
|
|
3062
|
-
t("cancel");
|
|
3063
|
-
}, b = () => {
|
|
3064
|
-
var m;
|
|
3065
|
-
(m = n.value) == null || m.commands.blur();
|
|
3066
|
-
}, p = (m) => {
|
|
3067
|
-
var T;
|
|
3068
|
-
(T = n.value) == null || T.commands.setContent(m);
|
|
3092
|
+
const y = () => {
|
|
3093
|
+
var b;
|
|
3094
|
+
(b = n.value) == null || b.commands.focus();
|
|
3095
|
+
}, p = () => {
|
|
3096
|
+
var b, L;
|
|
3097
|
+
(b = n.value) == null || b.commands.clearContent(), (L = n.value) == null || L.commands.focus(), t("clear");
|
|
3069
3098
|
}, f = () => {
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3099
|
+
t("cancel");
|
|
3100
|
+
}, x = () => {
|
|
3101
|
+
var b;
|
|
3102
|
+
(b = n.value) == null || b.commands.blur();
|
|
3103
|
+
}, v = (b) => {
|
|
3104
|
+
var L;
|
|
3105
|
+
(L = n.value) == null || L.commands.setContent(b);
|
|
3106
|
+
}, S = () => {
|
|
3107
|
+
var b;
|
|
3108
|
+
return ((b = n.value) == null ? void 0 : b.getText()) || "";
|
|
3109
|
+
}, _ = {
|
|
3073
3110
|
editor: n,
|
|
3074
3111
|
editorRef: s,
|
|
3075
|
-
mode:
|
|
3076
|
-
isAutoSwitching:
|
|
3077
|
-
loading:
|
|
3078
|
-
disabled:
|
|
3079
|
-
hasContent:
|
|
3112
|
+
mode: h,
|
|
3113
|
+
isAutoSwitching: E,
|
|
3114
|
+
loading: R(() => e.loading ?? !1),
|
|
3115
|
+
disabled: R(() => e.disabled ?? !1),
|
|
3116
|
+
hasContent: a,
|
|
3080
3117
|
hasEditorContent: r,
|
|
3081
|
-
canSubmit:
|
|
3082
|
-
isOverLimit:
|
|
3083
|
-
characterCount:
|
|
3084
|
-
maxLength:
|
|
3085
|
-
size:
|
|
3086
|
-
showWordLimit:
|
|
3087
|
-
clearable:
|
|
3088
|
-
defaultActions:
|
|
3089
|
-
submitType:
|
|
3090
|
-
stopText:
|
|
3091
|
-
submit:
|
|
3092
|
-
clear:
|
|
3093
|
-
cancel:
|
|
3094
|
-
focus:
|
|
3095
|
-
blur:
|
|
3096
|
-
setContent:
|
|
3097
|
-
getContent:
|
|
3118
|
+
canSubmit: u,
|
|
3119
|
+
isOverLimit: d,
|
|
3120
|
+
characterCount: c,
|
|
3121
|
+
maxLength: De(e, "maxLength"),
|
|
3122
|
+
size: R(() => e.size ?? "normal"),
|
|
3123
|
+
showWordLimit: R(() => e.showWordLimit ?? !1),
|
|
3124
|
+
clearable: R(() => e.clearable ?? !1),
|
|
3125
|
+
defaultActions: De(e, "defaultActions"),
|
|
3126
|
+
submitType: R(() => e.submitType ?? "enter"),
|
|
3127
|
+
stopText: De(e, "stopText"),
|
|
3128
|
+
submit: g,
|
|
3129
|
+
clear: p,
|
|
3130
|
+
cancel: f,
|
|
3131
|
+
focus: y,
|
|
3132
|
+
blur: x,
|
|
3133
|
+
setContent: v,
|
|
3134
|
+
getContent: S
|
|
3098
3135
|
};
|
|
3099
|
-
return
|
|
3100
|
-
context:
|
|
3136
|
+
return xn(yn, _), On(l), {
|
|
3137
|
+
context: _,
|
|
3101
3138
|
expose: {
|
|
3102
|
-
submit:
|
|
3103
|
-
clear:
|
|
3104
|
-
cancel:
|
|
3105
|
-
focus:
|
|
3106
|
-
blur:
|
|
3107
|
-
setContent:
|
|
3108
|
-
getContent:
|
|
3139
|
+
submit: g,
|
|
3140
|
+
clear: p,
|
|
3141
|
+
cancel: f,
|
|
3142
|
+
focus: y,
|
|
3143
|
+
blur: x,
|
|
3144
|
+
setContent: v,
|
|
3145
|
+
getContent: S,
|
|
3109
3146
|
editor: n
|
|
3110
3147
|
}
|
|
3111
3148
|
};
|
|
3112
3149
|
}
|
|
3113
|
-
function
|
|
3114
|
-
const e =
|
|
3115
|
-
return
|
|
3150
|
+
function bt() {
|
|
3151
|
+
const e = Pe();
|
|
3152
|
+
return R(() => ({
|
|
3116
3153
|
// 编辑器实例
|
|
3117
3154
|
editor: e.editor.value,
|
|
3118
3155
|
// 基础操作
|
|
@@ -3139,58 +3176,58 @@ function xt() {
|
|
|
3139
3176
|
hasContent: e.hasContent.value
|
|
3140
3177
|
}));
|
|
3141
3178
|
}
|
|
3142
|
-
const
|
|
3179
|
+
const vs = { class: "tr-sender-editor-scroll" }, Ts = /* @__PURE__ */ Z({
|
|
3143
3180
|
__name: "index",
|
|
3144
3181
|
setup(e) {
|
|
3145
|
-
const { editor: t, editorRef: n } =
|
|
3146
|
-
return (s, r) => (
|
|
3182
|
+
const { editor: t, editorRef: n } = Pe();
|
|
3183
|
+
return (s, r) => (M(), P("div", {
|
|
3147
3184
|
ref_key: "editorRef",
|
|
3148
3185
|
ref: n,
|
|
3149
3186
|
class: "tr-sender-editor-wrapper"
|
|
3150
3187
|
}, [
|
|
3151
|
-
B("div",
|
|
3152
|
-
|
|
3188
|
+
B("div", vs, [
|
|
3189
|
+
k(t) ? (M(), U(k(Tn), {
|
|
3153
3190
|
key: 0,
|
|
3154
|
-
editor:
|
|
3191
|
+
editor: k(t),
|
|
3155
3192
|
class: "tr-sender-editor-content"
|
|
3156
|
-
}, null, 8, ["editor"])) :
|
|
3193
|
+
}, null, 8, ["editor"])) : q("", !0)
|
|
3157
3194
|
])
|
|
3158
3195
|
], 512));
|
|
3159
3196
|
}
|
|
3160
|
-
}), sn = /* @__PURE__ */
|
|
3197
|
+
}), sn = /* @__PURE__ */ J(Ts, [["__scopeId", "data-v-7f5b51aa"]]), Es = { class: "tr-sender-single-layout" }, ws = {
|
|
3161
3198
|
key: 0,
|
|
3162
3199
|
class: "tr-sender-header"
|
|
3163
|
-
},
|
|
3200
|
+
}, Cs = { class: "tr-sender-container" }, As = { class: "tr-sender-main" }, Ss = {
|
|
3164
3201
|
key: 0,
|
|
3165
3202
|
class: "tr-sender-prefix"
|
|
3166
|
-
},
|
|
3203
|
+
}, _s = { class: "tr-sender-content" }, Ls = /* @__PURE__ */ Z({
|
|
3167
3204
|
__name: "SingleLineLayout",
|
|
3168
3205
|
setup(e) {
|
|
3169
|
-
const { editor: t, hasContent: n, loading: s, showWordLimit: r, maxLength: o } =
|
|
3170
|
-
return (i, a) => (
|
|
3171
|
-
i.$slots.header ? (
|
|
3172
|
-
|
|
3173
|
-
])) :
|
|
3174
|
-
B("div",
|
|
3175
|
-
B("div",
|
|
3176
|
-
i.$slots.prefix ? (
|
|
3177
|
-
|
|
3178
|
-
])) :
|
|
3179
|
-
B("div",
|
|
3180
|
-
|
|
3181
|
-
|
|
3206
|
+
const { editor: t, hasContent: n, loading: s, showWordLimit: r, maxLength: o } = Pe(), l = bt();
|
|
3207
|
+
return (i, a) => (M(), P("div", Es, [
|
|
3208
|
+
i.$slots.header ? (M(), P("div", ws, [
|
|
3209
|
+
D(i.$slots, "header", {}, void 0, !0)
|
|
3210
|
+
])) : q("", !0),
|
|
3211
|
+
B("div", Cs, [
|
|
3212
|
+
B("div", As, [
|
|
3213
|
+
i.$slots.prefix ? (M(), P("div", Ss, [
|
|
3214
|
+
D(i.$slots, "prefix", {}, void 0, !0)
|
|
3215
|
+
])) : q("", !0),
|
|
3216
|
+
B("div", _s, [
|
|
3217
|
+
D(i.$slots, "content", { editor: k(t) }, () => [
|
|
3218
|
+
se(sn)
|
|
3182
3219
|
], !0)
|
|
3183
3220
|
])
|
|
3184
3221
|
]),
|
|
3185
3222
|
B("div", {
|
|
3186
|
-
class:
|
|
3223
|
+
class: Q(["tr-sender-actions-inline", { "has-content": k(n) || k(s) }])
|
|
3187
3224
|
}, [
|
|
3188
|
-
|
|
3189
|
-
|
|
3225
|
+
k(r) && k(o) ? (M(), U(k(Rt), { key: 0 })) : q("", !0),
|
|
3226
|
+
se(k(Pt), null, $e({ _: 2 }, [
|
|
3190
3227
|
i.$slots["actions-inline"] ? {
|
|
3191
3228
|
name: "prepend",
|
|
3192
|
-
fn:
|
|
3193
|
-
|
|
3229
|
+
fn: j(() => [
|
|
3230
|
+
D(i.$slots, "actions-inline", he(ge(k(l))), void 0, !0)
|
|
3194
3231
|
]),
|
|
3195
3232
|
key: "0"
|
|
3196
3233
|
} : void 0
|
|
@@ -3199,69 +3236,69 @@ const ms = { class: "tr-sender-editor-scroll" }, hs = /* @__PURE__ */ X({
|
|
|
3199
3236
|
])
|
|
3200
3237
|
]));
|
|
3201
3238
|
}
|
|
3202
|
-
}),
|
|
3239
|
+
}), ks = /* @__PURE__ */ J(Ls, [["__scopeId", "data-v-7b0a576c"]]), Ms = {
|
|
3203
3240
|
key: 0,
|
|
3204
3241
|
class: "tr-sender-footer"
|
|
3205
|
-
},
|
|
3242
|
+
}, Rs = { class: "tr-sender-footer-left" }, Ps = { class: "tr-sender-footer-right" }, Os = /* @__PURE__ */ Z({
|
|
3206
3243
|
__name: "index",
|
|
3207
3244
|
setup(e) {
|
|
3208
|
-
const { mode: t, showWordLimit: n, maxLength: s } =
|
|
3209
|
-
return (o, l) =>
|
|
3210
|
-
B("div",
|
|
3211
|
-
|
|
3245
|
+
const { mode: t, showWordLimit: n, maxLength: s } = Pe(), r = bt();
|
|
3246
|
+
return (o, l) => k(t) === "multiple" ? (M(), P("div", Ms, [
|
|
3247
|
+
B("div", Rs, [
|
|
3248
|
+
D(o.$slots, "footer", he(ge(k(r))), void 0, !0)
|
|
3212
3249
|
]),
|
|
3213
|
-
B("div",
|
|
3214
|
-
|
|
3215
|
-
|
|
3250
|
+
B("div", Ps, [
|
|
3251
|
+
k(n) && k(s) ? (M(), U(k(Rt), { key: 0 })) : q("", !0),
|
|
3252
|
+
se(k(Pt), null, $e({ _: 2 }, [
|
|
3216
3253
|
o.$slots["footer-right"] ? {
|
|
3217
3254
|
name: "prepend",
|
|
3218
|
-
fn:
|
|
3219
|
-
|
|
3255
|
+
fn: j(() => [
|
|
3256
|
+
D(o.$slots, "footer-right", he(ge(k(r))), void 0, !0)
|
|
3220
3257
|
]),
|
|
3221
3258
|
key: "0"
|
|
3222
3259
|
} : void 0
|
|
3223
3260
|
]), 1024)
|
|
3224
3261
|
])
|
|
3225
|
-
])) :
|
|
3262
|
+
])) : q("", !0);
|
|
3226
3263
|
}
|
|
3227
|
-
}),
|
|
3264
|
+
}), Ds = /* @__PURE__ */ J(Os, [["__scopeId", "data-v-ffcdce27"]]), Is = { class: "tr-sender-multi-layout" }, Bs = {
|
|
3228
3265
|
key: 0,
|
|
3229
3266
|
class: "tr-sender-header"
|
|
3230
|
-
},
|
|
3267
|
+
}, $s = { class: "tr-sender-main" }, js = {
|
|
3231
3268
|
key: 0,
|
|
3232
3269
|
class: "tr-sender-prefix"
|
|
3233
|
-
},
|
|
3270
|
+
}, Ns = { class: "tr-sender-content" }, Ws = /* @__PURE__ */ Z({
|
|
3234
3271
|
__name: "MultiLineLayout",
|
|
3235
3272
|
setup(e) {
|
|
3236
|
-
const t =
|
|
3237
|
-
return (s, r) => (
|
|
3238
|
-
s.$slots.header ? (
|
|
3239
|
-
|
|
3240
|
-
])) :
|
|
3241
|
-
B("div",
|
|
3242
|
-
s.$slots.prefix ? (
|
|
3243
|
-
|
|
3244
|
-
])) :
|
|
3245
|
-
B("div",
|
|
3246
|
-
|
|
3247
|
-
editor:
|
|
3273
|
+
const t = Pe(), n = bt();
|
|
3274
|
+
return (s, r) => (M(), P("div", Is, [
|
|
3275
|
+
s.$slots.header ? (M(), P("div", Bs, [
|
|
3276
|
+
D(s.$slots, "header", {}, void 0, !0)
|
|
3277
|
+
])) : q("", !0),
|
|
3278
|
+
B("div", $s, [
|
|
3279
|
+
s.$slots.prefix ? (M(), P("div", js, [
|
|
3280
|
+
D(s.$slots, "prefix", {}, void 0, !0)
|
|
3281
|
+
])) : q("", !0),
|
|
3282
|
+
B("div", Ns, [
|
|
3283
|
+
D(s.$slots, "content", {
|
|
3284
|
+
editor: k(t).editor
|
|
3248
3285
|
}, () => [
|
|
3249
|
-
|
|
3286
|
+
se(sn)
|
|
3250
3287
|
], !0)
|
|
3251
3288
|
])
|
|
3252
3289
|
]),
|
|
3253
|
-
|
|
3254
|
-
footer:
|
|
3255
|
-
|
|
3290
|
+
se(Ds, null, {
|
|
3291
|
+
footer: j(() => [
|
|
3292
|
+
D(s.$slots, "footer", he(ge(k(n))), void 0, !0)
|
|
3256
3293
|
]),
|
|
3257
|
-
"footer-right":
|
|
3258
|
-
|
|
3294
|
+
"footer-right": j(() => [
|
|
3295
|
+
D(s.$slots, "footer-right", he(ge(k(n))), void 0, !0)
|
|
3259
3296
|
]),
|
|
3260
3297
|
_: 3
|
|
3261
3298
|
})
|
|
3262
3299
|
]));
|
|
3263
3300
|
}
|
|
3264
|
-
}),
|
|
3301
|
+
}), Ks = /* @__PURE__ */ J(Ws, [["__scopeId", "data-v-0b507198"]]), qs = /* @__PURE__ */ Z({
|
|
3265
3302
|
__name: "index",
|
|
3266
3303
|
props: {
|
|
3267
3304
|
modelValue: {},
|
|
@@ -3285,102 +3322,102 @@ const ms = { class: "tr-sender-editor-scroll" }, hs = /* @__PURE__ */ X({
|
|
|
3285
3322
|
},
|
|
3286
3323
|
emits: ["update:modelValue", "submit", "focus", "blur", "clear", "cancel", "input"],
|
|
3287
3324
|
setup(e, { expose: t, emit: n }) {
|
|
3288
|
-
const s = e, r = n, { context: o, expose: l } =
|
|
3289
|
-
return t(l), (i, a) => (
|
|
3290
|
-
class:
|
|
3325
|
+
const s = e, r = n, { context: o, expose: l } = bs(s, r);
|
|
3326
|
+
return t(l), (i, a) => (M(), P("div", {
|
|
3327
|
+
class: Q([
|
|
3291
3328
|
"tr-sender",
|
|
3292
|
-
`tr-sender--${
|
|
3293
|
-
`tr-sender--${
|
|
3329
|
+
`tr-sender--${k(o).mode.value}`,
|
|
3330
|
+
`tr-sender--${k(o).size.value}`,
|
|
3294
3331
|
{
|
|
3295
|
-
"is-auto-switching":
|
|
3296
|
-
"is-disabled":
|
|
3332
|
+
"is-auto-switching": k(o).isAutoSwitching.value,
|
|
3333
|
+
"is-disabled": k(o).disabled.value
|
|
3297
3334
|
}
|
|
3298
3335
|
])
|
|
3299
3336
|
}, [
|
|
3300
|
-
|
|
3337
|
+
k(o).mode.value === "single" ? (M(), U(ks, { key: 0 }, $e({ _: 2 }, [
|
|
3301
3338
|
i.$slots.header ? {
|
|
3302
3339
|
name: "header",
|
|
3303
|
-
fn:
|
|
3304
|
-
|
|
3340
|
+
fn: j(() => [
|
|
3341
|
+
D(i.$slots, "header", {}, void 0, !0)
|
|
3305
3342
|
]),
|
|
3306
3343
|
key: "0"
|
|
3307
3344
|
} : void 0,
|
|
3308
3345
|
i.$slots.prefix ? {
|
|
3309
3346
|
name: "prefix",
|
|
3310
|
-
fn:
|
|
3311
|
-
|
|
3347
|
+
fn: j(() => [
|
|
3348
|
+
D(i.$slots, "prefix", {}, void 0, !0)
|
|
3312
3349
|
]),
|
|
3313
3350
|
key: "1"
|
|
3314
3351
|
} : void 0,
|
|
3315
3352
|
i.$slots.content ? {
|
|
3316
3353
|
name: "content",
|
|
3317
|
-
fn:
|
|
3318
|
-
|
|
3354
|
+
fn: j((c) => [
|
|
3355
|
+
D(i.$slots, "content", he(ge(c)), void 0, !0)
|
|
3319
3356
|
]),
|
|
3320
3357
|
key: "2"
|
|
3321
3358
|
} : void 0,
|
|
3322
3359
|
i.$slots["actions-inline"] ? {
|
|
3323
3360
|
name: "actions-inline",
|
|
3324
|
-
fn:
|
|
3325
|
-
|
|
3361
|
+
fn: j(() => [
|
|
3362
|
+
D(i.$slots, "actions-inline", {}, void 0, !0)
|
|
3326
3363
|
]),
|
|
3327
3364
|
key: "3"
|
|
3328
3365
|
} : void 0
|
|
3329
|
-
]), 1024)) : (
|
|
3366
|
+
]), 1024)) : (M(), U(Ks, { key: 1 }, $e({ _: 2 }, [
|
|
3330
3367
|
i.$slots.header ? {
|
|
3331
3368
|
name: "header",
|
|
3332
|
-
fn:
|
|
3333
|
-
|
|
3369
|
+
fn: j(() => [
|
|
3370
|
+
D(i.$slots, "header", {}, void 0, !0)
|
|
3334
3371
|
]),
|
|
3335
3372
|
key: "0"
|
|
3336
3373
|
} : void 0,
|
|
3337
3374
|
i.$slots.prefix ? {
|
|
3338
3375
|
name: "prefix",
|
|
3339
|
-
fn:
|
|
3340
|
-
|
|
3376
|
+
fn: j(() => [
|
|
3377
|
+
D(i.$slots, "prefix", {}, void 0, !0)
|
|
3341
3378
|
]),
|
|
3342
3379
|
key: "1"
|
|
3343
3380
|
} : void 0,
|
|
3344
3381
|
i.$slots.content ? {
|
|
3345
3382
|
name: "content",
|
|
3346
|
-
fn:
|
|
3347
|
-
|
|
3383
|
+
fn: j((c) => [
|
|
3384
|
+
D(i.$slots, "content", he(ge(c)), void 0, !0)
|
|
3348
3385
|
]),
|
|
3349
3386
|
key: "2"
|
|
3350
3387
|
} : void 0,
|
|
3351
3388
|
i.$slots.footer ? {
|
|
3352
3389
|
name: "footer",
|
|
3353
|
-
fn:
|
|
3354
|
-
|
|
3390
|
+
fn: j(() => [
|
|
3391
|
+
D(i.$slots, "footer", {}, void 0, !0)
|
|
3355
3392
|
]),
|
|
3356
3393
|
key: "3"
|
|
3357
3394
|
} : void 0,
|
|
3358
3395
|
i.$slots["footer-right"] ? {
|
|
3359
3396
|
name: "footer-right",
|
|
3360
|
-
fn:
|
|
3361
|
-
|
|
3397
|
+
fn: j(() => [
|
|
3398
|
+
D(i.$slots, "footer-right", {}, void 0, !0)
|
|
3362
3399
|
]),
|
|
3363
3400
|
key: "4"
|
|
3364
3401
|
} : void 0
|
|
3365
3402
|
]), 1024))
|
|
3366
3403
|
], 2));
|
|
3367
3404
|
}
|
|
3368
|
-
}),
|
|
3369
|
-
|
|
3370
|
-
const
|
|
3371
|
-
e.component(
|
|
3372
|
-
},
|
|
3373
|
-
install:
|
|
3405
|
+
}), ze = /* @__PURE__ */ J(qs, [["__scopeId", "data-v-a15c5d11"]]);
|
|
3406
|
+
ze.name = "TrSender";
|
|
3407
|
+
const Hs = function(e) {
|
|
3408
|
+
e.component(ze.name, ze);
|
|
3409
|
+
}, ir = Object.assign(ze, {
|
|
3410
|
+
install: Hs,
|
|
3374
3411
|
// 扩展类(用于继承)
|
|
3375
3412
|
Mention: Gt,
|
|
3376
3413
|
Suggestion: Xt,
|
|
3377
3414
|
Template: Zt,
|
|
3378
3415
|
// 便捷函数(用于简单场景)
|
|
3379
|
-
mention:
|
|
3380
|
-
suggestion:
|
|
3381
|
-
template:
|
|
3416
|
+
mention: Oo,
|
|
3417
|
+
suggestion: qo,
|
|
3418
|
+
template: ls
|
|
3382
3419
|
});
|
|
3383
3420
|
export {
|
|
3384
|
-
|
|
3385
|
-
|
|
3421
|
+
ir as default,
|
|
3422
|
+
Pe as useSenderContext
|
|
3386
3423
|
};
|