@ant-design/agentic-ui 2.14.1 → 2.16.0
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/Bubble/BubbleBeforeNode.js +9 -9
- package/dist/Bubble/List/PureBubbleList.js +1 -1
- package/dist/Bubble/MessagesContent/EXCEPTION.js +1 -1
- package/dist/ChatLayout/style.js +16 -17
- package/dist/Constants/mobile.d.ts +3 -0
- package/dist/Constants/mobile.js +7 -0
- package/dist/Hooks/useLanguage.d.ts +2 -0
- package/dist/I18n/locales.d.ts +2 -0
- package/dist/I18n/locales.js +4 -0
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +1 -1
- package/dist/MarkdownEditor/editor/Editor.js +16 -8
- package/dist/MarkdownEditor/editor/code.css +2 -2
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition.js +2 -1
- package/dist/MarkdownEditor/editor/elements/FootnoteReference.js +2 -1
- package/dist/MarkdownEditor/editor/elements/Head.d.ts +1 -0
- package/dist/MarkdownEditor/editor/elements/Head.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Image/index.js +19 -7
- package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +2 -1
- package/dist/MarkdownEditor/editor/elements/LinkCard/style.js +1 -1
- package/dist/MarkdownEditor/editor/elements/List/ListItem.js +1 -0
- package/dist/MarkdownEditor/editor/elements/List/style.js +2 -2
- package/dist/MarkdownEditor/editor/elements/Media.js +22 -10
- package/dist/MarkdownEditor/editor/elements/Paragraph.js +2 -1
- package/dist/MarkdownEditor/editor/elements/Schema.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/Table.js +25 -16
- package/dist/MarkdownEditor/editor/elements/Table/Td/style.js +5 -2
- package/dist/MarkdownEditor/editor/elements/Table/index.js +0 -2
- package/dist/MarkdownEditor/editor/elements/Table/style.js +7 -8
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +5 -3
- package/dist/MarkdownEditor/editor/elements/TagPopup/style.js +2 -2
- package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +8 -19
- package/dist/MarkdownEditor/editor/store.js +3 -3
- package/dist/MarkdownEditor/editor/style.js +41 -6
- package/dist/MarkdownEditor/editor/tools/DragHandle.js +3 -3
- package/dist/MarkdownEditor/style.js +8 -2
- package/dist/MarkdownEditor/types.d.ts +1 -1
- package/dist/MarkdownEditor/utils/exportHtml.js +1 -1
- package/dist/MarkdownInputField/MarkdownInputField.d.ts +7 -7
- package/dist/MarkdownInputField/MarkdownInputField.js +11 -35
- package/dist/MarkdownInputField/SendButton/index.js +17 -3
- package/dist/MarkdownInputField/style.js +23 -2
- package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundaryExample.js +1 -1
- package/dist/Plugins/chart/index.js +2 -2
- package/dist/Plugins/code/components/CodeContainer.js +2 -3
- package/dist/Plugins/katex/InlineKatex.js +1 -1
- package/dist/Plugins/katex/Katex.js +1 -1
- package/dist/Plugins/mermaid/index.js +1 -1
- package/dist/ThoughtChainList/index.js +21 -2
- package/dist/ThoughtChainList/style.js +1 -0
- package/dist/Utils/loadCSS.js +6 -6
- package/dist/WelcomeMessage/index.js +21 -2
- package/dist/Workspace/Task/index.js +1 -1
- package/package.json +2 -2
|
@@ -71,15 +71,15 @@ var canRenderThoughtChain = function(placement, role, thoughtChainEnabled) {
|
|
|
71
71
|
if (thoughtChainEnabled === false) return false;
|
|
72
72
|
return true;
|
|
73
73
|
};
|
|
74
|
-
/**
|
|
75
|
-
* BubbleBeforeNode 组件
|
|
76
|
-
*
|
|
77
|
-
* 在聊天气泡之前渲染思维链或任务列表,显示AI的思考过程
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```tsx
|
|
81
|
-
* <BubbleBeforeNode bubble={bubbleData} />
|
|
82
|
-
* ```
|
|
74
|
+
/**
|
|
75
|
+
* BubbleBeforeNode 组件
|
|
76
|
+
*
|
|
77
|
+
* 在聊天气泡之前渲染思维链或任务列表,显示AI的思考过程
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* <BubbleBeforeNode bubble={bubbleData} />
|
|
82
|
+
* ```
|
|
83
83
|
*/ export var BubbleBeforeNode = function(param) {
|
|
84
84
|
var bubble = param.bubble, className = param.className, style = param.style;
|
|
85
85
|
var _context_thoughtChain, _originData_extra, _context_thoughtChain1, _context_thoughtChain2;
|
|
@@ -55,8 +55,8 @@ import { useContext, useMemo } from "react";
|
|
|
55
55
|
import { ConfigProvider } from "antd";
|
|
56
56
|
import cx from "classnames";
|
|
57
57
|
import React from "react";
|
|
58
|
-
import { PureAIBubble, PureUserBubble } from "../PureBubble";
|
|
59
58
|
import { BubbleConfigContext } from "../BubbleConfigProvide";
|
|
59
|
+
import { PureAIBubble, PureUserBubble } from "../PureBubble";
|
|
60
60
|
import { useStyle } from "./style";
|
|
61
61
|
export var PureBubbleList = function(props) {
|
|
62
62
|
var bubbleList = props.bubbleList, bubbleListRef = props.bubbleListRef, bubbleRenderConfig = props.bubbleRenderConfig, className = props.className, classNames = props.classNames, docListProps = props.docListProps, isLoading = props.isLoading, markdownRenderConfig = props.markdownRenderConfig, onAvatarClick = props.onAvatarClick, onCancelLike = props.onCancelLike, onDisLike = props.onDisLike, onDoubleClick = props.onDoubleClick, onLike = props.onLike, onReply = props.onReply, onScroll = props.onScroll, onTouchMove = props.onTouchMove, onWheel = props.onWheel, shouldShowCopy = props.shouldShowCopy, shouldShowVoice = props.shouldShowVoice, style = props.style, styles = props.styles, userMeta = props.userMeta, assistantMeta = props.assistantMeta;
|
package/dist/ChatLayout/style.js
CHANGED
|
@@ -50,10 +50,10 @@ function _object_spread_props(target, source) {
|
|
|
50
50
|
}
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
|
+
import { MOBILE_BREAKPOINT, MOBILE_PADDING } from "../Constants/mobile";
|
|
53
54
|
import { resetComponent, useEditorStyleRegister } from "../Hooks/useStyle";
|
|
54
|
-
var MOBILE_PADDING = 'var(--padding-1x)';
|
|
55
55
|
var genStyle = function(token) {
|
|
56
|
-
return _define_property({}, token.componentCls, {
|
|
56
|
+
return _define_property({}, token.componentCls, _define_property({
|
|
57
57
|
display: 'flex',
|
|
58
58
|
flexDirection: 'column',
|
|
59
59
|
height: '100%',
|
|
@@ -199,24 +199,23 @@ var genStyle = function(token) {
|
|
|
199
199
|
zIndex: 100,
|
|
200
200
|
borderBottomLeftRadius: 'var(--radius-xl)',
|
|
201
201
|
borderBottomRightRadius: 'var(--radius-xl)'
|
|
202
|
+
}
|
|
203
|
+
}, "@media (max-width: ".concat(MOBILE_BREAKPOINT, ")"), {
|
|
204
|
+
'&-header': {
|
|
205
|
+
padding: "0 ".concat(MOBILE_PADDING)
|
|
202
206
|
},
|
|
203
|
-
'
|
|
204
|
-
'&-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
'
|
|
209
|
-
paddingTop: MOBILE_PADDING,
|
|
210
|
-
paddingLeft: MOBILE_PADDING,
|
|
211
|
-
paddingRight: MOBILE_PADDING,
|
|
212
|
-
paddingBottom: '144px'
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
'&-footer': {
|
|
216
|
-
padding: MOBILE_PADDING
|
|
207
|
+
'&-content': {
|
|
208
|
+
'&-scrollable': {
|
|
209
|
+
paddingTop: MOBILE_PADDING,
|
|
210
|
+
paddingLeft: MOBILE_PADDING,
|
|
211
|
+
paddingRight: MOBILE_PADDING,
|
|
212
|
+
paddingBottom: '144px'
|
|
217
213
|
}
|
|
214
|
+
},
|
|
215
|
+
'&-footer': {
|
|
216
|
+
padding: MOBILE_PADDING
|
|
218
217
|
}
|
|
219
|
-
});
|
|
218
|
+
}));
|
|
220
219
|
};
|
|
221
220
|
/**
|
|
222
221
|
* ChatLayout 样式 Hook
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var MOBILE_PADDING_MIN = '4px';
|
|
2
|
+
var MOBILE_PADDING_MAX = '12px';
|
|
3
|
+
var MOBILE_PADDING_SCALE = '2vw';
|
|
4
|
+
var MOBILE_TABLE_MIN_CELL_WIDTH = 96;
|
|
5
|
+
export var MOBILE_PADDING = "clamp(".concat(MOBILE_PADDING_MIN, ", ").concat(MOBILE_PADDING_SCALE, ", ").concat(MOBILE_PADDING_MAX, ")");
|
|
6
|
+
export var MOBILE_BREAKPOINT = '768px';
|
|
7
|
+
export var MOBILE_TABLE_MIN_COLUMN_WIDTH = MOBILE_TABLE_MIN_CELL_WIDTH;
|
|
@@ -350,6 +350,8 @@ export declare function useLanguage(): {
|
|
|
350
350
|
'input.selectFile': string;
|
|
351
351
|
'input.openGallery': string;
|
|
352
352
|
'input.openFile': string;
|
|
353
|
+
'input.sendButtonTooltip.send': string;
|
|
354
|
+
'input.sendButtonTooltip.newline': string;
|
|
353
355
|
'common.name': string;
|
|
354
356
|
'common.updateTime': string;
|
|
355
357
|
'common.type': string;
|
package/dist/I18n/locales.d.ts
CHANGED
|
@@ -314,6 +314,8 @@ export declare const cnLabels: {
|
|
|
314
314
|
'input.selectFile': string;
|
|
315
315
|
'input.openGallery': string;
|
|
316
316
|
'input.openFile': string;
|
|
317
|
+
'input.sendButtonTooltip.send': string;
|
|
318
|
+
'input.sendButtonTooltip.newline': string;
|
|
317
319
|
'common.name': string;
|
|
318
320
|
'common.updateTime': string;
|
|
319
321
|
'common.type': string;
|
package/dist/I18n/locales.js
CHANGED
|
@@ -333,6 +333,8 @@
|
|
|
333
333
|
'input.selectFile': '选择文件',
|
|
334
334
|
'input.openGallery': '打开相册',
|
|
335
335
|
'input.openFile': '打开文件',
|
|
336
|
+
'input.sendButtonTooltip.send': '按 Enter 键发送',
|
|
337
|
+
'input.sendButtonTooltip.newline': '按 Shift+Enter 键换行',
|
|
336
338
|
// Other translations
|
|
337
339
|
'common.name': '名称',
|
|
338
340
|
'common.updateTime': '更新时间',
|
|
@@ -695,6 +697,8 @@
|
|
|
695
697
|
'input.selectFile': 'Select File',
|
|
696
698
|
'input.openGallery': 'Open Gallery',
|
|
697
699
|
'input.openFile': 'Open File',
|
|
700
|
+
'input.sendButtonTooltip.send': 'Press Enter to send',
|
|
701
|
+
'input.sendButtonTooltip.newline': 'Press Shift+Enter for new line',
|
|
698
702
|
// Other translations
|
|
699
703
|
'common.name': 'Name',
|
|
700
704
|
'common.updateTime': 'Update Time',
|
|
@@ -408,8 +408,8 @@ var composeEditors = function(editor, plugins) {
|
|
|
408
408
|
extra: toolBar.extra,
|
|
409
409
|
min: toolBar.min
|
|
410
410
|
})) : readonly ? null : null, /*#__PURE__*/ React.createElement("div", {
|
|
411
|
+
className: "".concat(baseClassName, "-content"),
|
|
411
412
|
style: _object_spread({
|
|
412
|
-
padding: '4px 20px',
|
|
413
413
|
overflow: 'auto',
|
|
414
414
|
display: 'flex',
|
|
415
415
|
height: !readonly && (toolBar === null || toolBar === void 0 ? void 0 : toolBar.enable) ? "calc(100% - 56px)" : '100%',
|
|
@@ -923,8 +923,10 @@ var defaultAllowedTypes = [
|
|
|
923
923
|
/**
|
|
924
924
|
* 处理输入法开始事件
|
|
925
925
|
*/ var onCompositionStart = function(e) {
|
|
926
|
-
var
|
|
927
|
-
(
|
|
926
|
+
var _markdownEditorRef_current_selection;
|
|
927
|
+
if (markdownContainerRef.current) {
|
|
928
|
+
markdownContainerRef.current.setAttribute('data-composition', '');
|
|
929
|
+
}
|
|
928
930
|
store.inputComposition = true;
|
|
929
931
|
var focusPath = ((_markdownEditorRef_current_selection = markdownEditorRef.current.selection) === null || _markdownEditorRef_current_selection === void 0 ? void 0 : _markdownEditorRef_current_selection.focus.path) || [];
|
|
930
932
|
if (focusPath.length > 0) {
|
|
@@ -933,8 +935,10 @@ var defaultAllowedTypes = [
|
|
|
933
935
|
if (node) {
|
|
934
936
|
var dom = ReactEditor.toDOMNode(markdownEditorRef.current, node);
|
|
935
937
|
if (dom) {
|
|
936
|
-
var
|
|
937
|
-
|
|
938
|
+
var tagInput = dom.querySelector('[data-tag-popup-input]');
|
|
939
|
+
if (tagInput) {
|
|
940
|
+
tagInput.setAttribute('data-composition', '');
|
|
941
|
+
}
|
|
938
942
|
}
|
|
939
943
|
}
|
|
940
944
|
}
|
|
@@ -945,9 +949,11 @@ var defaultAllowedTypes = [
|
|
|
945
949
|
/**
|
|
946
950
|
* 处理输入法结束事件
|
|
947
951
|
*/ var onCompositionEnd = function() {
|
|
948
|
-
var
|
|
952
|
+
var _markdownEditorRef_current_selection;
|
|
949
953
|
store.inputComposition = false;
|
|
950
|
-
(
|
|
954
|
+
if (markdownContainerRef.current) {
|
|
955
|
+
markdownContainerRef.current.removeAttribute('data-composition');
|
|
956
|
+
}
|
|
951
957
|
var focusPath = ((_markdownEditorRef_current_selection = markdownEditorRef.current.selection) === null || _markdownEditorRef_current_selection === void 0 ? void 0 : _markdownEditorRef_current_selection.focus.path) || [];
|
|
952
958
|
if (focusPath.length > 0) {
|
|
953
959
|
var _markdownEditorRef_current_selection1;
|
|
@@ -955,8 +961,10 @@ var defaultAllowedTypes = [
|
|
|
955
961
|
if (node) {
|
|
956
962
|
var dom = ReactEditor.toDOMNode(markdownEditorRef.current, node);
|
|
957
963
|
if (dom) {
|
|
958
|
-
var
|
|
959
|
-
|
|
964
|
+
var tagInput = dom.querySelector('[data-tag-popup-input]');
|
|
965
|
+
if (tagInput) {
|
|
966
|
+
tagInput.removeAttribute('data-composition');
|
|
967
|
+
}
|
|
960
968
|
}
|
|
961
969
|
}
|
|
962
970
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
margin-top: 8px;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.ace-container
|
|
8
|
+
.ace-container[data-frontmatter]:before {
|
|
9
9
|
top: 3px;
|
|
10
10
|
content: 'Front Matter';
|
|
11
11
|
width: 100%;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
color: var(--color-gray-text-secondary);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.ace-container
|
|
22
|
+
.ace-container[data-frontmatter]:is(.dark *):before {
|
|
23
23
|
color: var(--color-gray-text-secondary);
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -73,7 +73,8 @@ export var FootnoteDefinition = function(props) {
|
|
|
73
73
|
gap: 4
|
|
74
74
|
},
|
|
75
75
|
"data-be": 'footnoteDefinition',
|
|
76
|
-
|
|
76
|
+
"data-drag-el": true,
|
|
77
|
+
className: !str ? 'empty' : undefined,
|
|
77
78
|
onDragStart: function(e) {
|
|
78
79
|
return store.dragStart(e, markdownContainerRef.current);
|
|
79
80
|
}
|
|
@@ -109,7 +109,8 @@ export var FootnoteReference = function(props) {
|
|
|
109
109
|
return /*#__PURE__*/ React.createElement("p", _object_spread_props(_object_spread({}, props.attributes), {
|
|
110
110
|
"data-be": 'paragraph',
|
|
111
111
|
"data-testid": "footnote-reference",
|
|
112
|
-
|
|
112
|
+
"data-drag-el": true,
|
|
113
|
+
className: !str ? 'empty' : undefined,
|
|
113
114
|
onDragStart: function(e) {
|
|
114
115
|
return store.dragStart(e, markdownContainerRef.current);
|
|
115
116
|
},
|
|
@@ -8,6 +8,7 @@ export declare function Head({ element, attributes, children, }: ElementProps<He
|
|
|
8
8
|
onDragStart: (e: React.DragEvent<Element>) => any;
|
|
9
9
|
"data-empty": string | undefined;
|
|
10
10
|
"data-align": ("center" | "left" | "right") | undefined;
|
|
11
|
+
"data-drag-el": boolean;
|
|
11
12
|
className: string;
|
|
12
13
|
'data-slate-node': "element";
|
|
13
14
|
'data-slate-inline'?: true | undefined;
|
|
@@ -126,7 +126,7 @@ export function Head(param) {
|
|
|
126
126
|
id: slugify(str)
|
|
127
127
|
}, _define_property(_obj, 'data-be', 'head'), _define_property(_obj, 'data-head', slugify(Node.string(element) || '')), _define_property(_obj, 'data-title', (path === null || path === void 0 ? void 0 : path[0]) === 0), _define_property(_obj, "onDragStart", function(e) {
|
|
128
128
|
return store.dragStart(e, markdownContainerRef.current);
|
|
129
|
-
}), _define_property(_obj, 'data-empty', !str && selected ? 'true' : undefined), _define_property(_obj, 'data-align', element.align), _define_property(_obj,
|
|
129
|
+
}), _define_property(_obj, 'data-empty', !str && selected ? 'true' : undefined), _define_property(_obj, 'data-align', element.align), _define_property(_obj, 'data-drag-el', true), _define_property(_obj, "className", classNames({
|
|
130
130
|
empty: !str,
|
|
131
131
|
typewriter: isLast && typewriter
|
|
132
132
|
})), _obj)), /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(DragHandle, null), children));
|
|
@@ -388,7 +388,9 @@ import { getMediaType } from "../../utils/dom";
|
|
|
388
388
|
borderRadius: 4,
|
|
389
389
|
overflow: 'hidden',
|
|
390
390
|
width: size.width,
|
|
391
|
-
height: size.height
|
|
391
|
+
height: size.height,
|
|
392
|
+
maxWidth: '100%',
|
|
393
|
+
boxSizing: 'border-box'
|
|
392
394
|
}
|
|
393
395
|
}, loading ? /*#__PURE__*/ React.createElement("div", {
|
|
394
396
|
style: {
|
|
@@ -441,7 +443,9 @@ import { getMediaType } from "../../utils/dom";
|
|
|
441
443
|
var width = e.target.naturalWidth;
|
|
442
444
|
var height = e.target.naturalHeight;
|
|
443
445
|
radio.current = width / height;
|
|
444
|
-
|
|
446
|
+
var containerWidth = document.documentElement.clientWidth || window.innerWidth || 600;
|
|
447
|
+
var maxAllowedWidth = Math.min(containerWidth * 0.9, 600);
|
|
448
|
+
width = Math.min((defaultSize === null || defaultSize === void 0 ? void 0 : defaultSize.width) || 400, maxAllowedWidth);
|
|
445
449
|
setSize({
|
|
446
450
|
width: width,
|
|
447
451
|
height: width / radio.current
|
|
@@ -606,7 +610,9 @@ export function EditorImage(param) {
|
|
|
606
610
|
referrerPolicy: 'no-referrer',
|
|
607
611
|
draggable: false,
|
|
608
612
|
style: {
|
|
609
|
-
maxWidth:
|
|
613
|
+
maxWidth: '100%',
|
|
614
|
+
height: 'auto',
|
|
615
|
+
display: 'block'
|
|
610
616
|
},
|
|
611
617
|
width: element.width,
|
|
612
618
|
height: element.height
|
|
@@ -619,8 +625,8 @@ export function EditorImage(param) {
|
|
|
619
625
|
state().loadSuccess
|
|
620
626
|
]);
|
|
621
627
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
|
|
622
|
-
className: 'ant-agentic-md-editor-drag-el',
|
|
623
628
|
"data-be": "image",
|
|
629
|
+
"data-drag-el": true,
|
|
624
630
|
"data-testid": "image-container",
|
|
625
631
|
style: {
|
|
626
632
|
cursor: 'pointer',
|
|
@@ -628,7 +634,10 @@ export function EditorImage(param) {
|
|
|
628
634
|
userSelect: 'none',
|
|
629
635
|
WebkitUserSelect: 'none',
|
|
630
636
|
MozUserSelect: 'none',
|
|
631
|
-
msUserSelect: 'none'
|
|
637
|
+
msUserSelect: 'none',
|
|
638
|
+
width: '100%',
|
|
639
|
+
maxWidth: '100%',
|
|
640
|
+
boxSizing: 'border-box'
|
|
632
641
|
},
|
|
633
642
|
draggable: false,
|
|
634
643
|
onContextMenu: function(e) {
|
|
@@ -692,12 +701,15 @@ export function EditorImage(param) {
|
|
|
692
701
|
tabIndex: -1,
|
|
693
702
|
style: {
|
|
694
703
|
padding: 4,
|
|
695
|
-
display: 'flex'
|
|
704
|
+
display: 'flex',
|
|
705
|
+
width: '100%',
|
|
706
|
+
maxWidth: '100%',
|
|
707
|
+
boxSizing: 'border-box'
|
|
696
708
|
},
|
|
697
709
|
ref: htmlRef,
|
|
698
710
|
draggable: false,
|
|
699
711
|
contentEditable: false,
|
|
700
|
-
|
|
712
|
+
"data-be": "media-container"
|
|
701
713
|
}, imageDom, /*#__PURE__*/ React.createElement("div", {
|
|
702
714
|
style: {
|
|
703
715
|
display: 'none'
|
|
@@ -12,8 +12,9 @@ export function LinkCard(param) {
|
|
|
12
12
|
var _useStyle = useStyle(baseCls), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
13
13
|
var htmlRef = React.useRef(null);
|
|
14
14
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", attributes, /*#__PURE__*/ React.createElement("div", {
|
|
15
|
-
className: classNames(baseCls,
|
|
15
|
+
className: classNames(baseCls, hashId),
|
|
16
16
|
"data-be": "link-card",
|
|
17
|
+
"data-drag-el": true,
|
|
17
18
|
draggable: false,
|
|
18
19
|
onContextMenu: function(e) {
|
|
19
20
|
e.stopPropagation();
|
|
@@ -381,6 +381,7 @@ var MentionsUser = function(props) {
|
|
|
381
381
|
if (!isTask) return null;
|
|
382
382
|
return /*#__PURE__*/ React.createElement("span", {
|
|
383
383
|
contentEditable: false,
|
|
384
|
+
"data-check-item": true,
|
|
384
385
|
className: classNames("".concat(baseCls, "-check-item"), hashId)
|
|
385
386
|
}, /*#__PURE__*/ React.createElement(Checkbox, {
|
|
386
387
|
checked: element.checked,
|
|
@@ -68,11 +68,11 @@ var genStyle = function(token) {
|
|
|
68
68
|
paddingTop: '0 !important',
|
|
69
69
|
paddingBottom: '0 !important'
|
|
70
70
|
}
|
|
71
|
-
}, _define_property(_obj, "li:not(".concat(token.componentCls, "-task) > :first-child
|
|
71
|
+
}, _define_property(_obj, "li:not(".concat(token.componentCls, "-task) > :first-child [data-drag-handle]"), {
|
|
72
72
|
paddingLeft: '2px',
|
|
73
73
|
paddingRight: '12px',
|
|
74
74
|
left: '-44px !important'
|
|
75
|
-
}), _define_property(_obj, "li".concat(token.componentCls, "-task > :nth-child(2)
|
|
75
|
+
}), _define_property(_obj, "li".concat(token.componentCls, "-task > :nth-child(2) [data-drag-handle]"), {
|
|
76
76
|
paddingLeft: '2px',
|
|
77
77
|
paddingRight: '10px',
|
|
78
78
|
left: '-50px !important'
|
|
@@ -292,7 +292,9 @@ import { ImageAndError } from "./Image";
|
|
|
292
292
|
borderRadius: 4,
|
|
293
293
|
overflow: 'hidden',
|
|
294
294
|
width: size.width,
|
|
295
|
-
height: size.height
|
|
295
|
+
height: size.height,
|
|
296
|
+
maxWidth: '100%',
|
|
297
|
+
boxSizing: 'border-box'
|
|
296
298
|
}
|
|
297
299
|
}, loading ? /*#__PURE__*/ React.createElement("div", {
|
|
298
300
|
style: {
|
|
@@ -346,7 +348,9 @@ import { ImageAndError } from "./Image";
|
|
|
346
348
|
var width = e.target.naturalWidth;
|
|
347
349
|
var height = e.target.naturalHeight;
|
|
348
350
|
radio.current = width / height;
|
|
349
|
-
|
|
351
|
+
var containerWidth = document.documentElement.clientWidth || window.innerWidth || 600;
|
|
352
|
+
var maxAllowedWidth = Math.min(containerWidth * 0.9, 600);
|
|
353
|
+
width = Math.min(width, maxAllowedWidth);
|
|
350
354
|
setSize({
|
|
351
355
|
width: width,
|
|
352
356
|
height: width / radio.current
|
|
@@ -513,7 +517,9 @@ export function Media(param) {
|
|
|
513
517
|
crossOrigin: 'anonymous',
|
|
514
518
|
draggable: false,
|
|
515
519
|
style: {
|
|
516
|
-
maxWidth:
|
|
520
|
+
maxWidth: '100%',
|
|
521
|
+
height: 'auto',
|
|
522
|
+
display: 'block'
|
|
517
523
|
},
|
|
518
524
|
width: element.width,
|
|
519
525
|
height: element.height
|
|
@@ -562,9 +568,10 @@ export function Media(param) {
|
|
|
562
568
|
style: {
|
|
563
569
|
width: element.width ? "".concat(element.width, "px") : '100%',
|
|
564
570
|
height: element.height ? "".concat(element.height, "px") : 'auto',
|
|
565
|
-
maxWidth:
|
|
571
|
+
maxWidth: '100%',
|
|
566
572
|
borderRadius: '6px',
|
|
567
|
-
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)'
|
|
573
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
|
|
574
|
+
display: 'block'
|
|
568
575
|
},
|
|
569
576
|
src: ((_state = state()) === null || _state === void 0 ? void 0 : _state.url) || '',
|
|
570
577
|
preload: "metadata",
|
|
@@ -685,7 +692,7 @@ export function Media(param) {
|
|
|
685
692
|
fontSize: 12
|
|
686
693
|
}
|
|
687
694
|
}, element.otherProps.updateTime) : null))), /*#__PURE__*/ React.createElement("div", {
|
|
688
|
-
|
|
695
|
+
"data-icon-box": true,
|
|
689
696
|
style: {
|
|
690
697
|
padding: '0 18px'
|
|
691
698
|
}
|
|
@@ -707,8 +714,8 @@ export function Media(param) {
|
|
|
707
714
|
(_state1 = state()) === null || _state1 === void 0 ? void 0 : _state1.url
|
|
708
715
|
]);
|
|
709
716
|
return /*#__PURE__*/ React.createElement("div", attributes, /*#__PURE__*/ React.createElement("div", {
|
|
710
|
-
className: 'ant-agentic-md-editor-drag-el',
|
|
711
717
|
"data-be": "media",
|
|
718
|
+
"data-drag-el": true,
|
|
712
719
|
"data-testid": "media-container",
|
|
713
720
|
style: {
|
|
714
721
|
cursor: 'pointer',
|
|
@@ -718,7 +725,10 @@ export function Media(param) {
|
|
|
718
725
|
userSelect: 'none',
|
|
719
726
|
WebkitUserSelect: 'none',
|
|
720
727
|
MozUserSelect: 'none',
|
|
721
|
-
msUserSelect: 'none'
|
|
728
|
+
msUserSelect: 'none',
|
|
729
|
+
width: '100%',
|
|
730
|
+
maxWidth: '100%',
|
|
731
|
+
boxSizing: 'border-box'
|
|
722
732
|
},
|
|
723
733
|
draggable: false,
|
|
724
734
|
onContextMenu: function(e) {
|
|
@@ -771,12 +781,14 @@ export function Media(param) {
|
|
|
771
781
|
userSelect: 'none',
|
|
772
782
|
display: 'flex',
|
|
773
783
|
flexDirection: 'column',
|
|
774
|
-
width: mediaElement ? '100%' : undefined
|
|
784
|
+
width: mediaElement ? '100%' : undefined,
|
|
785
|
+
maxWidth: '100%',
|
|
786
|
+
boxSizing: 'border-box'
|
|
775
787
|
},
|
|
776
788
|
ref: htmlRef,
|
|
777
789
|
draggable: false,
|
|
778
790
|
contentEditable: false,
|
|
779
|
-
|
|
791
|
+
"data-be": "media-container"
|
|
780
792
|
}, mediaElement, imageDom, /*#__PURE__*/ React.createElement("div", {
|
|
781
793
|
style: {
|
|
782
794
|
display: 'none'
|
|
@@ -126,7 +126,8 @@ export var Paragraph = function(props) {
|
|
|
126
126
|
})) ? true : undefined;
|
|
127
127
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, props.attributes), {
|
|
128
128
|
"data-be": 'paragraph',
|
|
129
|
-
|
|
129
|
+
"data-drag-el": true,
|
|
130
|
+
className: classNames({
|
|
130
131
|
empty: isEmpty,
|
|
131
132
|
typewriter: isLast && typewriter
|
|
132
133
|
}),
|
|
@@ -125,7 +125,7 @@ import { useEditorStore } from "../store";
|
|
|
125
125
|
style: {
|
|
126
126
|
padding: '0.5em'
|
|
127
127
|
},
|
|
128
|
-
|
|
128
|
+
"data-agentar-card": true
|
|
129
129
|
}, /*#__PURE__*/ React.createElement(SchemaRenderer, {
|
|
130
130
|
debug: false,
|
|
131
131
|
fallbackContent: null,
|
|
@@ -94,7 +94,7 @@ import { parserSlateNodeToMarkdown } from "../../utils";
|
|
|
94
94
|
var columnCount = (element === null || element === void 0 ? void 0 : (_element_children = element.children) === null || _element_children === void 0 ? void 0 : (_element_children_ = _element_children[0]) === null || _element_children_ === void 0 ? void 0 : (_element_children__children = _element_children_.children) === null || _element_children__children === void 0 ? void 0 : _element_children__children.length) || 0;
|
|
95
95
|
if (columnCount === 0) return [];
|
|
96
96
|
// 使用固定宽度避免复杂计算
|
|
97
|
-
var defaultWidth =
|
|
97
|
+
var defaultWidth = 80;
|
|
98
98
|
return Array(columnCount).fill(defaultWidth);
|
|
99
99
|
}, [
|
|
100
100
|
element === null || element === void 0 ? void 0 : element.otherProps,
|
|
@@ -88,6 +88,7 @@ import classNames from "classnames";
|
|
|
88
88
|
import React, { useContext, useEffect, useMemo, useRef } from "react";
|
|
89
89
|
import { Node } from "slate";
|
|
90
90
|
import stringWidth from "string-width";
|
|
91
|
+
import { MOBILE_BREAKPOINT, MOBILE_TABLE_MIN_COLUMN_WIDTH } from "../../../../Constants/mobile";
|
|
91
92
|
import { useEditorStore } from "../../store";
|
|
92
93
|
import { ReadonlyTableComponent } from "./ReadonlyTableComponent";
|
|
93
94
|
import { TablePropsContext } from "./TableContext";
|
|
@@ -123,17 +124,19 @@ import useScrollShadow from "./useScrollShadow";
|
|
|
123
124
|
"hashId",
|
|
124
125
|
"children"
|
|
125
126
|
]);
|
|
126
|
-
var
|
|
127
|
+
var _props_element_children__children, _props_element_children_, _props_element_children, _props_element, _props_element_otherProps, _props_element1, _props_element_children1, _props_element2;
|
|
127
128
|
var _useEditorStore = useEditorStore(), readonly = _useEditorStore.readonly, markdownContainerRef = _useEditorStore.markdownContainerRef;
|
|
128
129
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
129
130
|
var tablePath = useContext(TablePropsContext).tablePath;
|
|
130
131
|
var baseCls = getPrefixCls('agentic-md-editor-content-table');
|
|
131
132
|
var tableTargetRef = useRef(null);
|
|
133
|
+
var columnCount = ((_props_element = props.element) === null || _props_element === void 0 ? void 0 : (_props_element_children = _props_element.children) === null || _props_element_children === void 0 ? void 0 : (_props_element_children_ = _props_element_children[0]) === null || _props_element_children_ === void 0 ? void 0 : (_props_element_children__children = _props_element_children_.children) === null || _props_element_children__children === void 0 ? void 0 : _props_element_children__children.length) || 0;
|
|
134
|
+
var mobileBreakpointValue = parseInt(MOBILE_BREAKPOINT, 10) || 768;
|
|
132
135
|
// 总是调用 hooks,避免条件调用
|
|
133
136
|
var _useScrollShadow = _sliced_to_array(useScrollShadow(), 2), tableRef = _useScrollShadow[0], scrollState = _useScrollShadow[1];
|
|
134
137
|
// 只在编辑模式下进行复杂的列宽计算
|
|
135
138
|
var colWidths = useMemo(function() {
|
|
136
|
-
var _props_element_otherProps, _props_element, _props_element_children, _props_element1, _tableRows__children, _tableRows_, _markdownContainerRef_current_querySelector, _markdownContainerRef_current
|
|
139
|
+
var _props_element_otherProps, _props_element, _props_element_children, _props_element1, _tableRows__children, _tableRows_, _markdownContainerRef_current_querySelector, _markdownContainerRef_current;
|
|
137
140
|
// readonly 模式下使用简化计算
|
|
138
141
|
if (readonly) {
|
|
139
142
|
var _props_element2, _props_element_children__children, _props_element_children_, _props_element_children1, _props_element3;
|
|
@@ -141,9 +144,9 @@ import useScrollShadow from "./useScrollShadow";
|
|
|
141
144
|
if (otherProps === null || otherProps === void 0 ? void 0 : otherProps.colWidths) {
|
|
142
145
|
return otherProps.colWidths;
|
|
143
146
|
}
|
|
144
|
-
var
|
|
145
|
-
if (
|
|
146
|
-
return Array(
|
|
147
|
+
var columnCount1 = ((_props_element3 = props.element) === null || _props_element3 === void 0 ? void 0 : (_props_element_children1 = _props_element3.children) === null || _props_element_children1 === void 0 ? void 0 : (_props_element_children_ = _props_element_children1[0]) === null || _props_element_children_ === void 0 ? void 0 : (_props_element_children__children = _props_element_children_.children) === null || _props_element_children__children === void 0 ? void 0 : _props_element_children__children.length) || 0;
|
|
148
|
+
if (columnCount1 === 0) return [];
|
|
149
|
+
return Array(columnCount1).fill(80); // 固定宽度
|
|
147
150
|
}
|
|
148
151
|
// 如果在props中存在,直接使用以避免计算
|
|
149
152
|
if ((_props_element = props.element) === null || _props_element === void 0 ? void 0 : (_props_element_otherProps = _props_element.otherProps) === null || _props_element_otherProps === void 0 ? void 0 : _props_element_otherProps.colWidths) {
|
|
@@ -155,13 +158,13 @@ import useScrollShadow from "./useScrollShadow";
|
|
|
155
158
|
if (!(tableRows === null || tableRows === void 0 ? void 0 : (_tableRows_ = tableRows[0]) === null || _tableRows_ === void 0 ? void 0 : (_tableRows__children = _tableRows_.children) === null || _tableRows__children === void 0 ? void 0 : _tableRows__children.length)) return [];
|
|
156
159
|
// 只获取一次容器宽度
|
|
157
160
|
var containerWidth = ((markdownContainerRef === null || markdownContainerRef === void 0 ? void 0 : (_markdownContainerRef_current = markdownContainerRef.current) === null || _markdownContainerRef_current === void 0 ? void 0 : (_markdownContainerRef_current_querySelector = _markdownContainerRef_current.querySelector('.ant-agentic-md-editor-content')) === null || _markdownContainerRef_current_querySelector === void 0 ? void 0 : _markdownContainerRef_current_querySelector.clientWidth) || 400) - 32 - 12;
|
|
158
|
-
var
|
|
159
|
-
var minColumnWidth = 60;
|
|
160
|
-
var
|
|
161
|
+
var isMobileLayout = containerWidth <= mobileBreakpointValue;
|
|
162
|
+
var minColumnWidth = isMobileLayout ? MOBILE_TABLE_MIN_COLUMN_WIDTH : 60;
|
|
163
|
+
var maxColumnWidth = isMobileLayout ? containerWidth : containerWidth / 4;
|
|
161
164
|
var rowsToSample = Math.min(5, tableRows.length);
|
|
162
165
|
// 一次性计算宽度
|
|
163
166
|
var calculatedWidths = Array.from({
|
|
164
|
-
length:
|
|
167
|
+
length: columnCount
|
|
165
168
|
}, function(_, colIndex) {
|
|
166
169
|
var _Math;
|
|
167
170
|
var cellWidths = [];
|
|
@@ -178,21 +181,21 @@ import useScrollShadow from "./useScrollShadow";
|
|
|
178
181
|
].concat(_to_consumable_array(cellWidths))), maxColumnWidth);
|
|
179
182
|
});
|
|
180
183
|
// 如果表格少于5行且总宽度超过容器宽度,则均匀分配宽度
|
|
181
|
-
if (tableRows.length < 5) {
|
|
184
|
+
if (tableRows.length < 5 && columnCount > 0) {
|
|
182
185
|
var totalWidth = calculatedWidths.reduce(function(sum, width) {
|
|
183
186
|
return sum + width;
|
|
184
187
|
}, 0);
|
|
185
188
|
if (totalWidth > containerWidth) {
|
|
186
|
-
var evenWidth = Math.max(minColumnWidth, Math.floor(containerWidth /
|
|
187
|
-
return Array(
|
|
189
|
+
var evenWidth = Math.max(minColumnWidth, Math.floor(containerWidth / columnCount));
|
|
190
|
+
return Array(columnCount).fill(evenWidth);
|
|
188
191
|
}
|
|
189
192
|
}
|
|
190
193
|
return calculatedWidths;
|
|
191
194
|
}, [
|
|
192
195
|
readonly,
|
|
193
|
-
(
|
|
194
|
-
(
|
|
195
|
-
|
|
196
|
+
(_props_element1 = props.element) === null || _props_element1 === void 0 ? void 0 : (_props_element_otherProps = _props_element1.otherProps) === null || _props_element_otherProps === void 0 ? void 0 : _props_element_otherProps.colWidths,
|
|
197
|
+
(_props_element2 = props.element) === null || _props_element2 === void 0 ? void 0 : (_props_element_children1 = _props_element2.children) === null || _props_element_children1 === void 0 ? void 0 : _props_element_children1.length,
|
|
198
|
+
columnCount,
|
|
196
199
|
markdownContainerRef
|
|
197
200
|
]);
|
|
198
201
|
// 只在编辑模式下添加resize事件监听
|
|
@@ -208,7 +211,13 @@ import useScrollShadow from "./useScrollShadow";
|
|
|
208
211
|
var dom = tableRef.current;
|
|
209
212
|
if (dom) {
|
|
210
213
|
setTimeout(function() {
|
|
211
|
-
|
|
214
|
+
var _markdownContainerRef_current_querySelector, _markdownContainerRef_current;
|
|
215
|
+
var containerWidthForBreakpoint = ((markdownContainerRef === null || markdownContainerRef === void 0 ? void 0 : (_markdownContainerRef_current = markdownContainerRef.current) === null || _markdownContainerRef_current === void 0 ? void 0 : (_markdownContainerRef_current_querySelector = _markdownContainerRef_current.querySelector('.ant-agentic-md-editor-content')) === null || _markdownContainerRef_current_querySelector === void 0 ? void 0 : _markdownContainerRef_current_querySelector.clientWidth) || 400) - 32 - 12;
|
|
216
|
+
var isMobileLayout = containerWidthForBreakpoint <= mobileBreakpointValue;
|
|
217
|
+
var computedMinColumnWidth = isMobileLayout ? MOBILE_TABLE_MIN_COLUMN_WIDTH : 60;
|
|
218
|
+
var fallbackMinWidth = Number(((minWidth || 200) * 0.95).toFixed(0));
|
|
219
|
+
var requiredMinWidth = Math.max(columnCount * computedMinColumnWidth, maxWidth, fallbackMinWidth, 200);
|
|
220
|
+
dom.style.minWidth = "".concat(requiredMinWidth, "px");
|
|
212
221
|
}, 200);
|
|
213
222
|
}
|
|
214
223
|
};
|