@ant-design/agentic-ui 2.0.14 → 2.0.15
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/BackTo/BackBottom.d.ts +56 -0
- package/dist/BackTo/BackTop.d.ts +39 -2
- package/dist/BackTo/index.d.ts +20 -0
- package/dist/Bubble/AIBubble.js +1 -1
- package/dist/Bubble/List/index.js +1 -1
- package/dist/Bubble/UserBubble.js +1 -1
- package/dist/Bubble/index.d.ts +6 -0
- package/dist/Bubble/style.js +1 -1
- package/dist/ChatBootPage/CaseReply.js +1 -1
- package/dist/ChatBootPage/Title.js +1 -1
- package/dist/ChatBootPage/index.d.ts +6 -0
- package/dist/Components/ActionIconBox/index.js +1 -1
- package/dist/Components/ActionItemBox/ActionItemBox.js +1 -1
- package/dist/Components/ActionItemBox/index.d.ts +6 -0
- package/dist/Components/Button/index.d.ts +6 -0
- package/dist/History/components/HistoryItem.js +2 -2
- package/dist/History/components/NewChatComponent.js +1 -1
- package/dist/History/components/SearchComponent.d.ts +2 -0
- package/dist/History/components/SearchComponent.js +17 -3
- package/dist/History/index.d.ts +4 -0
- package/dist/History/index.js +10 -9
- package/dist/History/menu.d.ts +2 -0
- package/dist/History/menu.js +18 -5
- package/dist/History/style.js +1 -1
- package/dist/History/types/index.d.ts +6 -0
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +1 -1
- package/dist/MarkdownEditor/editor/components/CommentList/index.js +1 -1
- package/dist/MarkdownEditor/editor/components/ContributorAvatar/index.js +1 -1
- package/dist/MarkdownEditor/editor/components/fntTag/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Comment/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition.js +1 -1
- package/dist/MarkdownEditor/editor/elements/FootnoteReference.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Head.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Image/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +2 -2
- package/dist/MarkdownEditor/editor/elements/List/List.js +1 -1
- package/dist/MarkdownEditor/editor/elements/List/ListItem.js +1 -1
- package/dist/MarkdownEditor/editor/elements/List/style.js +2 -2
- package/dist/MarkdownEditor/editor/elements/Media.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Paragraph.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/SimpleTable.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/Table.js +5 -3
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndex/index.js +3 -1
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndexSpacer/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/TableRowIndex/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/Td/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.d.ts +0 -22
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +171 -122
- package/dist/MarkdownEditor/editor/elements/index.js +1 -1
- package/dist/MarkdownEditor/editor/style.js +6 -6
- package/dist/MarkdownEditor/editor/tools/DragHandle.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/ToolBar.js +1 -1
- package/dist/MarkdownEditor/editor/utils/dom.d.ts +1 -1
- package/dist/MarkdownEditor/editor/utils/index.d.ts +1 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/index.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/index.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/utils.d.ts +8 -0
- package/dist/MarkdownInputField/AttachmentButton/utils.js +10 -3
- package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +1 -1
- package/dist/MarkdownInputField/Enlargement/index.js +1 -1
- package/dist/MarkdownInputField/FileMapView/index.js +5 -2
- package/dist/MarkdownInputField/MarkdownInputField.js +1 -1
- package/dist/MarkdownInputField/QuickActions/index.js +4 -8
- package/dist/MarkdownInputField/RefinePromptButton/index.js +1 -1
- package/dist/MarkdownInputField/SendActions/index.js +1 -1
- package/dist/MarkdownInputField/SendButton/index.js +1 -1
- package/dist/MarkdownInputField/SkillModeBar/index.js +1 -1
- package/dist/MarkdownInputField/TopOperatingArea/index.js +1 -1
- package/dist/MarkdownInputField/VoiceInput/index.js +1 -1
- package/dist/Plugins/chart/index.js +2 -2
- package/dist/Plugins/index.d.ts +6 -0
- package/dist/Plugins/mermaid/index.js +1 -1
- package/dist/Quote/index.js +1 -1
- package/dist/Schema/index.d.ts +6 -0
- package/dist/ThoughtChainList/DotAni/index.css +1 -1
- package/dist/ThoughtChainList/DotAni/index.js +2 -2
- package/dist/ToolUseBar/ToolUseBarThink.js +1 -1
- package/dist/ToolUseBar/index.js +1 -1
- package/dist/WelcomeMessage/index.d.ts +42 -0
- package/dist/WelcomeMessage/index.js +1 -1
- package/dist/Workspace/RealtimeFollow/style.js +1 -1
- package/dist/Workspace/Task/index.js +1 -1
- package/package.json +1 -1
|
@@ -195,7 +195,7 @@ var ListItem = ({
|
|
|
195
195
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
196
196
|
const listItemRender = (_a = editorProps == null ? void 0 : editorProps.comment) == null ? void 0 : _a.listItemRender;
|
|
197
197
|
const { hashId = "" } = useContext(ListContext) || {};
|
|
198
|
-
const baseCls = context.getPrefixCls("md-editor-list");
|
|
198
|
+
const baseCls = context.getPrefixCls("agentic-md-editor-list");
|
|
199
199
|
const checkbox = React.useMemo(() => {
|
|
200
200
|
if (!isTask)
|
|
201
201
|
return null;
|
|
@@ -39,12 +39,12 @@ var genStyle = (token) => {
|
|
|
39
39
|
paddingTop: "0 !important",
|
|
40
40
|
paddingBottom: "0 !important"
|
|
41
41
|
},
|
|
42
|
-
[`li:not(${token.componentCls}-task) > :first-child .ant-md-editor-drag-handle`]: {
|
|
42
|
+
[`li:not(${token.componentCls}-task) > :first-child .ant-agentic-md-editor-drag-handle`]: {
|
|
43
43
|
paddingLeft: "2px",
|
|
44
44
|
paddingRight: "12px",
|
|
45
45
|
left: "-44px !important"
|
|
46
46
|
},
|
|
47
|
-
[`li${token.componentCls}-task > :nth-child(2) .ant-md-editor-drag-handle`]: {
|
|
47
|
+
[`li${token.componentCls}-task > :nth-child(2) .ant-agentic-md-editor-drag-handle`]: {
|
|
48
48
|
paddingLeft: "2px",
|
|
49
49
|
paddingRight: "10px",
|
|
50
50
|
left: "-50px !important"
|
|
@@ -474,7 +474,7 @@ function Media({
|
|
|
474
474
|
return /* @__PURE__ */ React.createElement("div", __spreadValues({}, attributes), /* @__PURE__ */ React.createElement(
|
|
475
475
|
"div",
|
|
476
476
|
{
|
|
477
|
-
className: "ant-md-editor-drag-el",
|
|
477
|
+
className: "ant-agentic-md-editor-drag-el",
|
|
478
478
|
"data-be": "media",
|
|
479
479
|
"data-testid": "media-container",
|
|
480
480
|
style: {
|
|
@@ -61,7 +61,7 @@ var Paragraph = (props) => {
|
|
|
61
61
|
"div",
|
|
62
62
|
__spreadProps(__spreadValues({}, props.attributes), {
|
|
63
63
|
"data-be": "paragraph",
|
|
64
|
-
className: classNames("ant-md-editor-drag-el", {
|
|
64
|
+
className: classNames("ant-agentic-md-editor-drag-el", {
|
|
65
65
|
empty: isEmpty,
|
|
66
66
|
typewriter: isLast && typewriter
|
|
67
67
|
}),
|
|
@@ -28,7 +28,7 @@ import { SlateTable } from "./Table";
|
|
|
28
28
|
import { TablePropsProvider } from "./TableContext";
|
|
29
29
|
var SimpleTable = (props) => {
|
|
30
30
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
31
|
-
const baseCls = getPrefixCls("md-editor-content-table");
|
|
31
|
+
const baseCls = getPrefixCls("agentic-md-editor-content-table");
|
|
32
32
|
const editor = useSlate();
|
|
33
33
|
const { wrapSSR, hashId } = useTableStyle(baseCls, {});
|
|
34
34
|
const tablePath = useMemo(
|
|
@@ -37,7 +37,7 @@ var SlateTable = (_a) => {
|
|
|
37
37
|
const { readonly, markdownContainerRef } = useEditorStore();
|
|
38
38
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
39
39
|
const { tablePath } = useContext(TablePropsContext);
|
|
40
|
-
const baseCls = getPrefixCls("md-editor-content-table");
|
|
40
|
+
const baseCls = getPrefixCls("agentic-md-editor-content-table");
|
|
41
41
|
const tableTargetRef = useRef(null);
|
|
42
42
|
const [tableRef, scrollState] = useScrollShadow();
|
|
43
43
|
const colWidths = useMemo(() => {
|
|
@@ -60,7 +60,9 @@ var SlateTable = (_a) => {
|
|
|
60
60
|
const tableRows = props.element.children;
|
|
61
61
|
if (!((_m = (_l = tableRows == null ? void 0 : tableRows[0]) == null ? void 0 : _l.children) == null ? void 0 : _m.length))
|
|
62
62
|
return [];
|
|
63
|
-
const containerWidth = (((_o = (_n = markdownContainerRef == null ? void 0 : markdownContainerRef.current) == null ? void 0 : _n.querySelector(
|
|
63
|
+
const containerWidth = (((_o = (_n = markdownContainerRef == null ? void 0 : markdownContainerRef.current) == null ? void 0 : _n.querySelector(
|
|
64
|
+
".ant-agentic-md-editor-content"
|
|
65
|
+
)) == null ? void 0 : _o.clientWidth) || 400) - 32 - 12;
|
|
64
66
|
const maxColumnWidth = containerWidth / 4;
|
|
65
67
|
const minColumnWidth = 60;
|
|
66
68
|
const columnCount = ((_q = (_p = tableRows == null ? void 0 : tableRows[0]) == null ? void 0 : _p.children) == null ? void 0 : _q.length) || 0;
|
|
@@ -113,7 +115,7 @@ var SlateTable = (_a) => {
|
|
|
113
115
|
return;
|
|
114
116
|
let maxWidth = colWidths ? (colWidths == null ? void 0 : colWidths.reduce((a, b) => a + b, 0)) + 8 : 0;
|
|
115
117
|
const minWidth = (_b3 = (_a3 = markdownContainerRef == null ? void 0 : markdownContainerRef.current) == null ? void 0 : _a3.querySelector(
|
|
116
|
-
".ant-md-editor-content"
|
|
118
|
+
".ant-agentic-md-editor-content"
|
|
117
119
|
)) == null ? void 0 : _b3.clientWidth;
|
|
118
120
|
const dom = tableRef.current;
|
|
119
121
|
if (dom) {
|
|
@@ -38,7 +38,9 @@ var TableCellIndex = ({
|
|
|
38
38
|
tablePath
|
|
39
39
|
}) => {
|
|
40
40
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
41
|
-
const baseClassName = context == null ? void 0 : context.getPrefixCls(
|
|
41
|
+
const baseClassName = context == null ? void 0 : context.getPrefixCls(
|
|
42
|
+
"agentic-md-editor-table-cell-index"
|
|
43
|
+
);
|
|
42
44
|
const { wrapSSR, hashId } = useStyle(baseClassName);
|
|
43
45
|
const editor = useSlate();
|
|
44
46
|
const tableContext = useContext(TablePropsContext);
|
|
@@ -39,7 +39,7 @@ var TableCellIndexSpacer = ({
|
|
|
39
39
|
}) => {
|
|
40
40
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
41
41
|
const baseClassName = context == null ? void 0 : context.getPrefixCls(
|
|
42
|
-
"md-editor-table-cell-index-spacer"
|
|
42
|
+
"agentic-md-editor-table-cell-index-spacer"
|
|
43
43
|
);
|
|
44
44
|
const { wrapSSR, hashId } = useStyle(baseClassName);
|
|
45
45
|
const editor = useSlate();
|
|
@@ -11,7 +11,7 @@ var TableRowIndex = ({
|
|
|
11
11
|
tablePath
|
|
12
12
|
}) => {
|
|
13
13
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
14
|
-
const baseClassName = context == null ? void 0 : context.getPrefixCls("md-editor-table-row-index");
|
|
14
|
+
const baseClassName = context == null ? void 0 : context.getPrefixCls("agentic-md-editor-table-row-index");
|
|
15
15
|
const { wrapSSR, hashId } = useStyle(baseClassName);
|
|
16
16
|
return wrapSSR(
|
|
17
17
|
/* @__PURE__ */ React.createElement(
|
|
@@ -37,7 +37,7 @@ var Td = ({
|
|
|
37
37
|
const width = element == null ? void 0 : element.width;
|
|
38
38
|
useSlateSelection();
|
|
39
39
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
40
|
-
const prefix = getPrefixCls("md-editor-table-td");
|
|
40
|
+
const prefix = getPrefixCls("agentic-md-editor-table-td");
|
|
41
41
|
const tdRef = useRef(null);
|
|
42
42
|
const { wrapSSR, hashId } = useStyle(prefix);
|
|
43
43
|
const handleRef = (node) => {
|
|
@@ -100,27 +100,5 @@ export type TagPopupProps = {
|
|
|
100
100
|
onChange?: (value: string, props: RenderProps) => void;
|
|
101
101
|
type?: 'panel' | 'dropdown';
|
|
102
102
|
};
|
|
103
|
-
/**
|
|
104
|
-
* TagPopup 组件 - 在编辑器中显示一个标签弹出选择框
|
|
105
|
-
*
|
|
106
|
-
* 该组件在编辑器中创建一个交互式标签选择弹出框,允许用户从预定义列表中选择标签。
|
|
107
|
-
* 当选择一个标签时,会调用提供的回调函数并关闭弹出框。该组件与 Slate 编辑器集成,
|
|
108
|
-
* 可以感知当前的节点路径。
|
|
109
|
-
*
|
|
110
|
-
* @param props - 组件属性
|
|
111
|
-
* @param props.items - 可选的下拉菜单项列表
|
|
112
|
-
* @param props.onSelect - 当选择一个项时的回调函数,接收所选项的键和路径
|
|
113
|
-
* @param props.children - 触发器元素内容
|
|
114
|
-
* @param props.dropdownRender - 自定义下拉菜单渲染函数
|
|
115
|
-
* @param props.dropdownStyle - 下拉菜单的样式
|
|
116
|
-
* @param props.menu - 自定义菜单配置
|
|
117
|
-
* @param props.notFoundContent - 未找到内容时显示的内容
|
|
118
|
-
* @param props.className - 组件的额外 CSS 类名
|
|
119
|
-
* @param props.open - 控制下拉菜单是否打开
|
|
120
|
-
* @param props.onOpenChange - 下拉菜单打开状态变化时的回调
|
|
121
|
-
* @param props.text - 包含文本内容
|
|
122
|
-
*
|
|
123
|
-
* @returns 一个带有下拉菜单的标签弹出组件
|
|
124
|
-
*/
|
|
125
103
|
export declare const TagPopup: (props: RenderProps) => React.JSX.Element;
|
|
126
104
|
export {};
|
|
@@ -52,8 +52,137 @@ import React, {
|
|
|
52
52
|
import { ReactEditor, useSlate } from "slate-react";
|
|
53
53
|
import { SuggestionConnext } from "../../../../MarkdownInputField/Suggestion";
|
|
54
54
|
import { useStyle } from "./style";
|
|
55
|
+
var getNodePath = (editor, domRef) => {
|
|
56
|
+
if (!domRef.current)
|
|
57
|
+
return null;
|
|
58
|
+
const slateNode = ReactEditor.toSlateNode(editor, domRef.current);
|
|
59
|
+
return ReactEditor.findPath(editor, slateNode);
|
|
60
|
+
};
|
|
61
|
+
var updateNodeContext = (editor, domRef, suggestionConnext, props, onSelect, pathRef) => {
|
|
62
|
+
const path = getNodePath(editor, domRef);
|
|
63
|
+
if (!path)
|
|
64
|
+
return;
|
|
65
|
+
pathRef.current = path;
|
|
66
|
+
if (suggestionConnext == null ? void 0 : suggestionConnext.triggerNodeContext) {
|
|
67
|
+
suggestionConnext.triggerNodeContext.current = __spreadProps(__spreadValues({}, props), {
|
|
68
|
+
text: props.text
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (suggestionConnext == null ? void 0 : suggestionConnext.onSelectRef) {
|
|
72
|
+
suggestionConnext.onSelectRef.current = (newValue) => {
|
|
73
|
+
var _a;
|
|
74
|
+
const currentPath = getNodePath(editor, domRef);
|
|
75
|
+
onSelect == null ? void 0 : onSelect(newValue, currentPath || path || []);
|
|
76
|
+
(_a = suggestionConnext == null ? void 0 : suggestionConnext.setOpen) == null ? void 0 : _a.call(suggestionConnext, false);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var loadItemsData = (items, props, setLoading, setSelectedItems) => __async(void 0, null, function* () {
|
|
81
|
+
if (typeof items !== "function")
|
|
82
|
+
return;
|
|
83
|
+
setLoading(true);
|
|
84
|
+
const result = yield items(props);
|
|
85
|
+
if (Array.isArray(result)) {
|
|
86
|
+
setSelectedItems(result || []);
|
|
87
|
+
}
|
|
88
|
+
setLoading(false);
|
|
89
|
+
});
|
|
90
|
+
var initializeAutoOpen = (autoOpen, type, setOpen, suggestionConnext) => {
|
|
91
|
+
var _a;
|
|
92
|
+
if (!autoOpen)
|
|
93
|
+
return;
|
|
94
|
+
if (type === "dropdown") {
|
|
95
|
+
setOpen(true);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
(_a = suggestionConnext == null ? void 0 : suggestionConnext.setOpen) == null ? void 0 : _a.call(suggestionConnext, true);
|
|
99
|
+
};
|
|
100
|
+
var handleMouseEnter = (domRef) => {
|
|
101
|
+
const target = domRef.current;
|
|
102
|
+
if (!target)
|
|
103
|
+
return;
|
|
104
|
+
target.classList.remove("no-focus");
|
|
105
|
+
};
|
|
106
|
+
var handleMouseLeave = (domRef) => {
|
|
107
|
+
const target = domRef.current;
|
|
108
|
+
if (!target)
|
|
109
|
+
return;
|
|
110
|
+
target.classList.add("no-focus");
|
|
111
|
+
};
|
|
112
|
+
var createDefaultDom = (domRef, baseCls, hashId, loading, selectedItems, children, text, placeholder) => {
|
|
113
|
+
const isEmpty = !(text == null ? void 0 : text.trim());
|
|
114
|
+
const hasItems = (selectedItems == null ? void 0 : selectedItems.length) > 0;
|
|
115
|
+
return /* @__PURE__ */ React.createElement(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
ref: domRef,
|
|
119
|
+
className: classNames(`${baseCls}-tag-popup-input`, "no-focus", hashId, {
|
|
120
|
+
empty: isEmpty,
|
|
121
|
+
[`${baseCls}-tag-popup-input-loading`]: loading,
|
|
122
|
+
[`${baseCls}-tag-popup-input-has-arrow`]: hasItems
|
|
123
|
+
}),
|
|
124
|
+
onMouseEnter: () => handleMouseEnter(domRef),
|
|
125
|
+
onMouseLeave: () => handleMouseLeave(domRef),
|
|
126
|
+
title: placeholder
|
|
127
|
+
},
|
|
128
|
+
children,
|
|
129
|
+
hasItems && /* @__PURE__ */ React.createElement(
|
|
130
|
+
ChevronDown,
|
|
131
|
+
{
|
|
132
|
+
className: classNames(`${baseCls}-tag-popup-input-arrow `, hashId, {
|
|
133
|
+
empty: isEmpty
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
var getRenderDom = (tagRender, props, defaultDom, onSelect, currentNodePath) => {
|
|
140
|
+
if (!tagRender)
|
|
141
|
+
return defaultDom;
|
|
142
|
+
return tagRender(
|
|
143
|
+
__spreadProps(__spreadValues({}, props), {
|
|
144
|
+
text: props.text,
|
|
145
|
+
onSelect: (value, tagNode) => {
|
|
146
|
+
onSelect == null ? void 0 : onSelect(value, currentNodePath.current || [], tagNode);
|
|
147
|
+
}
|
|
148
|
+
}),
|
|
149
|
+
defaultDom
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
var handlePanelClick = (suggestionConnext, props, onSelect, currentNodePath) => {
|
|
153
|
+
var _a;
|
|
154
|
+
if (suggestionConnext == null ? void 0 : suggestionConnext.triggerNodeContext) {
|
|
155
|
+
suggestionConnext.triggerNodeContext.current = __spreadProps(__spreadValues({}, props), {
|
|
156
|
+
text: props.text
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (suggestionConnext == null ? void 0 : suggestionConnext.onSelectRef) {
|
|
160
|
+
suggestionConnext.onSelectRef.current = (newValue) => {
|
|
161
|
+
var _a2;
|
|
162
|
+
onSelect == null ? void 0 : onSelect(newValue, currentNodePath.current || []);
|
|
163
|
+
(_a2 = suggestionConnext == null ? void 0 : suggestionConnext.setOpen) == null ? void 0 : _a2.call(suggestionConnext, false);
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
(_a = suggestionConnext == null ? void 0 : suggestionConnext.setOpen) == null ? void 0 : _a.call(suggestionConnext, true);
|
|
167
|
+
};
|
|
168
|
+
var canOpen = (props, placeholder) => {
|
|
169
|
+
if (!props.beforeOpenChange)
|
|
170
|
+
return true;
|
|
171
|
+
return props.beforeOpenChange(true, __spreadProps(__spreadValues({}, props), {
|
|
172
|
+
text: props.text,
|
|
173
|
+
placeholder
|
|
174
|
+
}));
|
|
175
|
+
};
|
|
176
|
+
var handleClick = (e, props, placeholder, type, suggestionConnext, onSelect, currentNodePath) => {
|
|
177
|
+
e.preventDefault();
|
|
178
|
+
e.stopPropagation();
|
|
179
|
+
if (!canOpen(props, placeholder))
|
|
180
|
+
return;
|
|
181
|
+
if (type === "dropdown")
|
|
182
|
+
return;
|
|
183
|
+
handlePanelClick(suggestionConnext, props, onSelect, currentNodePath);
|
|
184
|
+
};
|
|
55
185
|
var TagPopup = (props) => {
|
|
56
|
-
var _a, _b;
|
|
57
186
|
const { onSelect, items, children, type } = props || {};
|
|
58
187
|
const editor = useSlate();
|
|
59
188
|
const [open, setOpen] = useState(false);
|
|
@@ -61,62 +190,34 @@ var TagPopup = (props) => {
|
|
|
61
190
|
const domRef = useRef(null);
|
|
62
191
|
const suggestionConnext = useContext(SuggestionConnext);
|
|
63
192
|
const antdContext = useContext(ConfigProvider.ConfigContext);
|
|
64
|
-
const baseCls = antdContext == null ? void 0 : antdContext.getPrefixCls("md-editor-tag-popup-input");
|
|
193
|
+
const baseCls = antdContext == null ? void 0 : antdContext.getPrefixCls("agentic-md-editor-tag-popup-input");
|
|
65
194
|
const { wrapSSR, hashId } = useStyle(baseCls);
|
|
66
195
|
const currentNodePath = useRef();
|
|
67
196
|
useEffect(() => {
|
|
68
|
-
|
|
69
|
-
return;
|
|
70
|
-
const slateNode = ReactEditor.toSlateNode(editor, domRef.current);
|
|
71
|
-
const path = ReactEditor.findPath(editor, slateNode);
|
|
197
|
+
const path = getNodePath(editor, domRef);
|
|
72
198
|
if (path) {
|
|
73
199
|
currentNodePath.current = path;
|
|
74
200
|
}
|
|
75
201
|
}, [editor.children, props.text]);
|
|
76
202
|
useEffect(() => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
text: props.text
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
if (suggestionConnext == null ? void 0 : suggestionConnext.onSelectRef) {
|
|
89
|
-
suggestionConnext.onSelectRef.current = (newValue) => {
|
|
90
|
-
var _a2;
|
|
91
|
-
const currentPath = ReactEditor.findPath(editor, slateNode);
|
|
92
|
-
onSelect == null ? void 0 : onSelect(newValue, currentPath || path || []);
|
|
93
|
-
(_a2 = suggestionConnext == null ? void 0 : suggestionConnext.setOpen) == null ? void 0 : _a2.call(suggestionConnext, false);
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
}
|
|
203
|
+
updateNodeContext(
|
|
204
|
+
editor,
|
|
205
|
+
domRef,
|
|
206
|
+
suggestionConnext,
|
|
207
|
+
props,
|
|
208
|
+
onSelect,
|
|
209
|
+
currentNodePath
|
|
210
|
+
);
|
|
97
211
|
}, [props.text]);
|
|
98
212
|
const [selectedItems, setSelectedItems] = useState(() => {
|
|
99
|
-
|
|
100
|
-
return [];
|
|
101
|
-
}
|
|
102
|
-
return items || [];
|
|
213
|
+
return typeof items === "function" ? [] : items || [];
|
|
103
214
|
});
|
|
104
215
|
useEffect(() => {
|
|
105
|
-
|
|
106
|
-
if (typeof items === "function") {
|
|
107
|
-
setLoading(true);
|
|
108
|
-
const result = yield items(props);
|
|
109
|
-
if (Array.isArray(result)) {
|
|
110
|
-
setSelectedItems(result || []);
|
|
111
|
-
}
|
|
112
|
-
setLoading(false);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
loadingData();
|
|
216
|
+
loadItemsData(items, props, setLoading, setSelectedItems);
|
|
116
217
|
}, [open, items]);
|
|
117
218
|
useEffect(() => {
|
|
118
|
-
var
|
|
119
|
-
(
|
|
219
|
+
var _a;
|
|
220
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, props.text || "", __spreadProps(__spreadValues({}, props), {
|
|
120
221
|
text: props.text,
|
|
121
222
|
onSelect: (value) => {
|
|
122
223
|
onSelect == null ? void 0 : onSelect(value, currentNodePath.current || []);
|
|
@@ -124,57 +225,26 @@ var TagPopup = (props) => {
|
|
|
124
225
|
}));
|
|
125
226
|
}, [props.text, suggestionConnext.open]);
|
|
126
227
|
useEffect(() => {
|
|
127
|
-
|
|
128
|
-
if (type === "dropdown") {
|
|
129
|
-
setOpen(true);
|
|
130
|
-
} else if (suggestionConnext == null ? void 0 : suggestionConnext.setOpen) {
|
|
131
|
-
suggestionConnext.setOpen(true);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
228
|
+
initializeAutoOpen(props.autoOpen, type, setOpen, suggestionConnext);
|
|
134
229
|
}, []);
|
|
135
230
|
const placeholder = props.placeholder;
|
|
136
|
-
const defaultDom =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
[`${baseCls}-tag-popup-input-loading`]: loading,
|
|
143
|
-
[`${baseCls}-tag-popup-input-has-arrow`]: (selectedItems == null ? void 0 : selectedItems.length) > 0
|
|
144
|
-
}),
|
|
145
|
-
onMouseEnter: () => {
|
|
146
|
-
const target = domRef.current;
|
|
147
|
-
if (!target)
|
|
148
|
-
return;
|
|
149
|
-
target == null ? void 0 : target.classList.remove(`no-focus`);
|
|
150
|
-
},
|
|
151
|
-
onMouseLeave: () => {
|
|
152
|
-
const target = domRef.current;
|
|
153
|
-
if (!target)
|
|
154
|
-
return;
|
|
155
|
-
target == null ? void 0 : target.classList.add(`no-focus`);
|
|
156
|
-
},
|
|
157
|
-
title: placeholder
|
|
158
|
-
},
|
|
231
|
+
const defaultDom = createDefaultDom(
|
|
232
|
+
domRef,
|
|
233
|
+
baseCls,
|
|
234
|
+
hashId,
|
|
235
|
+
loading,
|
|
236
|
+
selectedItems,
|
|
159
237
|
children,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
238
|
+
props.text,
|
|
239
|
+
placeholder
|
|
240
|
+
);
|
|
241
|
+
const renderDom = getRenderDom(
|
|
242
|
+
props.tagRender,
|
|
243
|
+
props,
|
|
244
|
+
defaultDom,
|
|
245
|
+
onSelect,
|
|
246
|
+
currentNodePath
|
|
168
247
|
);
|
|
169
|
-
let renderDom = props.tagRender ? props.tagRender(
|
|
170
|
-
__spreadProps(__spreadValues({}, props), {
|
|
171
|
-
text: props.text,
|
|
172
|
-
onSelect: (value, tagNode) => {
|
|
173
|
-
onSelect == null ? void 0 : onSelect(value, currentNodePath.current || [], tagNode);
|
|
174
|
-
}
|
|
175
|
-
}),
|
|
176
|
-
defaultDom
|
|
177
|
-
) : defaultDom;
|
|
178
248
|
return wrapSSR(
|
|
179
249
|
/* @__PURE__ */ React.createElement(
|
|
180
250
|
"div",
|
|
@@ -191,36 +261,15 @@ var TagPopup = (props) => {
|
|
|
191
261
|
text: props.text,
|
|
192
262
|
placeholder
|
|
193
263
|
}))),
|
|
194
|
-
onClick: (e) =>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if (!canOpen) {
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (type === "dropdown") {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
if (suggestionConnext == null ? void 0 : suggestionConnext.triggerNodeContext) {
|
|
211
|
-
suggestionConnext.triggerNodeContext.current = __spreadProps(__spreadValues({}, props), {
|
|
212
|
-
text: props.text
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
if (suggestionConnext == null ? void 0 : suggestionConnext.onSelectRef) {
|
|
216
|
-
suggestionConnext.onSelectRef.current = (newValue) => {
|
|
217
|
-
var _a3;
|
|
218
|
-
onSelect == null ? void 0 : onSelect(newValue, currentNodePath.current || []);
|
|
219
|
-
(_a3 = suggestionConnext == null ? void 0 : suggestionConnext.setOpen) == null ? void 0 : _a3.call(suggestionConnext, false);
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
(_a2 = suggestionConnext == null ? void 0 : suggestionConnext.setOpen) == null ? void 0 : _a2.call(suggestionConnext, true);
|
|
223
|
-
}
|
|
264
|
+
onClick: (e) => handleClick(
|
|
265
|
+
e,
|
|
266
|
+
props,
|
|
267
|
+
placeholder,
|
|
268
|
+
type,
|
|
269
|
+
suggestionConnext,
|
|
270
|
+
onSelect,
|
|
271
|
+
currentNodePath
|
|
272
|
+
)
|
|
224
273
|
},
|
|
225
274
|
type === "dropdown" ? /* @__PURE__ */ React.createElement(
|
|
226
275
|
Dropdown,
|
|
@@ -231,9 +280,9 @@ var TagPopup = (props) => {
|
|
|
231
280
|
menu: {
|
|
232
281
|
items: selectedItems,
|
|
233
282
|
onClick: (e) => {
|
|
234
|
-
var
|
|
283
|
+
var _a;
|
|
235
284
|
onSelect == null ? void 0 : onSelect(e.key, currentNodePath.current || []);
|
|
236
|
-
(
|
|
285
|
+
(_a = suggestionConnext == null ? void 0 : suggestionConnext.setOpen) == null ? void 0 : _a.call(suggestionConnext, false);
|
|
237
286
|
}
|
|
238
287
|
}
|
|
239
288
|
},
|
|
@@ -221,7 +221,7 @@ var MLeafComponent = (props) => {
|
|
|
221
221
|
const { markdownEditorRef, markdownContainerRef, readonly, setShowComment } = useEditorStore();
|
|
222
222
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
223
223
|
const { locale } = useContext(I18nContext);
|
|
224
|
-
const mdEditorBaseClass = context == null ? void 0 : context.getPrefixCls("md-editor-content");
|
|
224
|
+
const mdEditorBaseClass = context == null ? void 0 : context.getPrefixCls("agentic-md-editor-content");
|
|
225
225
|
const leaf = props.leaf;
|
|
226
226
|
const style = {};
|
|
227
227
|
let prefixClassName = classNames(props.hashId);
|
|
@@ -38,7 +38,7 @@ var blinkCaret = new Keyframes("blink-caret", {
|
|
|
38
38
|
var genStyle = (token) => {
|
|
39
39
|
return {
|
|
40
40
|
// 拖拽手柄样式
|
|
41
|
-
".ant-md-editor-drag-handle": {
|
|
41
|
+
".ant-agentic-md-editor-drag-handle": {
|
|
42
42
|
position: "absolute",
|
|
43
43
|
display: "flex",
|
|
44
44
|
userSelect: "none",
|
|
@@ -51,7 +51,7 @@ var genStyle = (token) => {
|
|
|
51
51
|
top: "calc(3px + 0.75em - 14px)"
|
|
52
52
|
},
|
|
53
53
|
// 拖拽图标样式
|
|
54
|
-
".ant-md-editor-drag-icon": {
|
|
54
|
+
".ant-agentic-md-editor-drag-icon": {
|
|
55
55
|
display: "flex",
|
|
56
56
|
alignItems: "center",
|
|
57
57
|
borderRadius: "18px",
|
|
@@ -64,7 +64,7 @@ var genStyle = (token) => {
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
// 拖拽元素悬浮效果
|
|
67
|
-
".ant-md-editor-drag-el:hover > .ant-md-editor-drag-handle": {
|
|
67
|
+
".ant-agentic-md-editor-drag-el:hover > .ant-agentic-md-editor-drag-handle": {
|
|
68
68
|
opacity: 1
|
|
69
69
|
},
|
|
70
70
|
// 可调整大小组件样式
|
|
@@ -114,7 +114,7 @@ var genStyle = (token) => {
|
|
|
114
114
|
transitionDuration: "200ms"
|
|
115
115
|
},
|
|
116
116
|
// 隐藏样式
|
|
117
|
-
".ant-md-editor-hidden": {
|
|
117
|
+
".ant-agentic-md-editor-hidden": {
|
|
118
118
|
display: "none"
|
|
119
119
|
},
|
|
120
120
|
// KaTeX容器样式
|
|
@@ -228,7 +228,7 @@ var genStyle = (token) => {
|
|
|
228
228
|
"h1,h2,h3,h4,h5,h6": {
|
|
229
229
|
position: "relative",
|
|
230
230
|
textWrap: "balance",
|
|
231
|
-
".ant-md-editor-drag-handle": {
|
|
231
|
+
".ant-agentic-md-editor-drag-handle": {
|
|
232
232
|
top: "calc(3px + 0.05em) !important"
|
|
233
233
|
}
|
|
234
234
|
},
|
|
@@ -453,7 +453,7 @@ var genStyle = (token) => {
|
|
|
453
453
|
margin: "var(--margin-8x) 0"
|
|
454
454
|
},
|
|
455
455
|
// 打字机效果样式
|
|
456
|
-
".ant-md-editor-content .typewriter:last-of-type > *:last-of-type span[data-slate-leaf]:last-of-type span[data-slate-string]": {
|
|
456
|
+
".ant-agentic-md-editor-content .typewriter:last-of-type > *:last-of-type span[data-slate-leaf]:last-of-type span[data-slate-string]": {
|
|
457
457
|
borderRight: "0.15em solid var(--color-primary-control-fill-primary)",
|
|
458
458
|
animationName: `${typing.getName()}, ${blinkCaret.getName()}`,
|
|
459
459
|
animationDuration: "3.5s, 0.5s",
|
|
@@ -33,7 +33,7 @@ var DragHandle = (props) => {
|
|
|
33
33
|
return /* @__PURE__ */ React.createElement(Tooltip, { title: "拖拽移动" }, /* @__PURE__ */ React.createElement(
|
|
34
34
|
"span",
|
|
35
35
|
{
|
|
36
|
-
className: "ant-md-editor-drag-handle",
|
|
36
|
+
className: "ant-agentic-md-editor-drag-handle",
|
|
37
37
|
"data-testid": "drag-handle",
|
|
38
38
|
style: __spreadValues({}, props.style),
|
|
39
39
|
contentEditable: false,
|
|
@@ -53,7 +53,7 @@ var DragHandle = (props) => {
|
|
|
53
53
|
store.draggedElement = parent;
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
|
-
/* @__PURE__ */ React.createElement("div", { className: "ant-md-editor-drag-icon" }, /* @__PURE__ */ React.createElement(HolderOutlined, null))
|
|
56
|
+
/* @__PURE__ */ React.createElement("div", { className: "ant-agentic-md-editor-drag-icon" }, /* @__PURE__ */ React.createElement(HolderOutlined, null))
|
|
57
57
|
));
|
|
58
58
|
};
|
|
59
59
|
export {
|
|
@@ -23,7 +23,7 @@ import { BaseToolBar } from "./BaseBar";
|
|
|
23
23
|
import { useStyle } from "./toolBarStyle";
|
|
24
24
|
var ToolBar = (props) => {
|
|
25
25
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
26
|
-
const baseClassName = context == null ? void 0 : context.getPrefixCls(`md-editor-toolbar`);
|
|
26
|
+
const baseClassName = context == null ? void 0 : context.getPrefixCls(`agentic-md-editor-toolbar`);
|
|
27
27
|
const { wrapSSR, hashId } = useStyle(baseClassName);
|
|
28
28
|
return wrapSSR(
|
|
29
29
|
/* @__PURE__ */ React.createElement(
|
|
@@ -25,7 +25,7 @@ export declare const slugify: (str: string) => string;
|
|
|
25
25
|
* @param name - The name of the file.
|
|
26
26
|
* @returns The media type of the file.
|
|
27
27
|
*/
|
|
28
|
-
export declare const getMediaType: (name?: string, alt?: string) => "document" | "image" | "
|
|
28
|
+
export declare const getMediaType: (name?: string, alt?: string) => "document" | "image" | "audio" | "video" | "markdown" | "other" | "attachment";
|
|
29
29
|
/**
|
|
30
30
|
* Retrieves the bounding rectangle of the current selection.
|
|
31
31
|
* @returns The bounding rectangle of the selection, or null if no selection exists.
|
|
@@ -13,7 +13,7 @@ type ModalEvent<K extends keyof HookAPI> = {
|
|
|
13
13
|
type: K;
|
|
14
14
|
params: Parameters<HookAPI[K]>[0];
|
|
15
15
|
};
|
|
16
|
-
export declare const modal$: Subject<ModalEvent<"
|
|
16
|
+
export declare const modal$: Subject<ModalEvent<"info" | "error" | "warning" | "confirm" | "success">>;
|
|
17
17
|
export declare const encodeHtml: (str: string) => string;
|
|
18
18
|
export { isMarkdown } from './isMarkdown';
|
|
19
19
|
export declare function debounce(func: {
|
|
@@ -62,7 +62,7 @@ var AttachmentFileList = ({
|
|
|
62
62
|
onClearFileMap
|
|
63
63
|
}) => {
|
|
64
64
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
65
|
-
const prefix = context == null ? void 0 : context.getPrefixCls("md-editor-attachment-list");
|
|
65
|
+
const prefix = context == null ? void 0 : context.getPrefixCls("agentic-md-editor-attachment-list");
|
|
66
66
|
const { wrapSSR, hashId } = useStyle(prefix);
|
|
67
67
|
const [imgSrc, setImgSrc] = React.useState(void 0);
|
|
68
68
|
const fileList = Array.from((fileMap == null ? void 0 : fileMap.values()) || []);
|
|
@@ -205,7 +205,7 @@ var ButtonContent = ({ title }) => {
|
|
|
205
205
|
};
|
|
206
206
|
var AttachmentButton = ({ disabled, uploadImage, title, supportedFormat, render }) => {
|
|
207
207
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
208
|
-
const prefix = context == null ? void 0 : context.getPrefixCls("md-editor-attachment-button");
|
|
208
|
+
const prefix = context == null ? void 0 : context.getPrefixCls("agentic-md-editor-attachment-button");
|
|
209
209
|
const { wrapSSR, hashId } = useStyle(prefix);
|
|
210
210
|
const format = supportedFormat || SupportedFileFormats.image;
|
|
211
211
|
const content = /* @__PURE__ */ React.createElement(ButtonContent, { title });
|