@ant-design/agentic-ui 2.30.10 → 2.30.11
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/ChatLayout/style.js +16 -13
- package/dist/Components/ActionIconBox/index.js +4 -0
- package/dist/Components/Button/IconButton/style.js +1 -1
- package/dist/Components/Button/ToggleButton/style.js +1 -1
- package/dist/History/style.js +2 -2
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +2 -1
- package/dist/MarkdownEditor/editor/Editor.js +22 -6
- package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +27 -5
- package/dist/MarkdownEditor/editor/style.js +7 -3
- package/dist/MarkdownEditor/editor/tools/JinjaTemplatePanel/index.js +2 -2
- package/dist/MarkdownEditor/types.d.ts +10 -0
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileIcon.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +3 -3
- package/dist/MarkdownInputField/FileMapView/style.js +3 -2
- package/dist/MarkdownInputField/SkillModeBar/style.js +1 -1
- package/dist/MarkdownInputField/style.js +1 -1
- package/dist/MarkdownRenderer/MarkdownRenderer.js +3 -2
- package/dist/MarkdownRenderer/index.d.ts +1 -1
- package/dist/MarkdownRenderer/markdownReactShared.d.ts +35 -28
- package/dist/MarkdownRenderer/markdownReactShared.js +179 -58
- package/dist/MarkdownRenderer/streaming/useStreamingMarkdownReact.js +3 -2
- package/dist/MarkdownRenderer/types.d.ts +21 -0
- package/dist/MarkdownRenderer/useStreaming.js +40 -13
- package/dist/ThoughtChainList/style.js +1 -1
- package/dist/ToolUseBarThink/style.js +1 -1
- package/dist/Workspace/Browser/index.d.ts +6 -0
- package/dist/Workspace/Browser/index.js +22 -13
- package/dist/Workspace/Browser/style.js +14 -15
- package/dist/Workspace/File/FileComponent.js +4 -4
- package/dist/Workspace/File/PreviewComponent.js +4 -4
- package/dist/Workspace/File/style.js +33 -39
- package/dist/Workspace/RealtimeFollow/style.js +78 -85
- package/dist/Workspace/style.js +41 -53
- package/package.json +1 -1
package/dist/ChatLayout/style.js
CHANGED
|
@@ -52,6 +52,9 @@ function _object_spread_props(target, source) {
|
|
|
52
52
|
}
|
|
53
53
|
import { MOBILE_BREAKPOINT, MOBILE_PADDING } from "../Constants/mobile";
|
|
54
54
|
import { resetComponent, useEditorStyleRegister } from "../Hooks/useStyle";
|
|
55
|
+
var RADIUS_XL = 'var(--radius-xl, var(--radius-card-lg, 16px))';
|
|
56
|
+
var COLOR_GRAY_BG_ACTIVE = 'var(--color-gray-bg-active, var(--color-gray-control-fill-active, rgba(20, 22, 28, 0.12)))';
|
|
57
|
+
var COLOR_GRAY_BORDER_DEFAULT = 'var(--color-gray-border-default, var(--color-gray-border-light, rgba(20, 22, 28, 0.12)))';
|
|
55
58
|
var genStyle = function genStyle(token) {
|
|
56
59
|
return _define_property({}, token.componentCls, _define_property({
|
|
57
60
|
display: 'flex',
|
|
@@ -59,10 +62,10 @@ var genStyle = function genStyle(token) {
|
|
|
59
62
|
height: '100%',
|
|
60
63
|
width: '100%',
|
|
61
64
|
position: 'relative',
|
|
62
|
-
borderTopLeftRadius:
|
|
63
|
-
borderTopRightRadius:
|
|
64
|
-
borderBottomLeftRadius:
|
|
65
|
-
borderBottomRightRadius:
|
|
65
|
+
borderTopLeftRadius: RADIUS_XL,
|
|
66
|
+
borderTopRightRadius: RADIUS_XL,
|
|
67
|
+
borderBottomLeftRadius: RADIUS_XL,
|
|
68
|
+
borderBottomRightRadius: RADIUS_XL,
|
|
66
69
|
backgroundColor: 'var(--color-gray-bg-page-light)',
|
|
67
70
|
'&-header': {
|
|
68
71
|
display: 'flex',
|
|
@@ -73,8 +76,8 @@ var genStyle = function genStyle(token) {
|
|
|
73
76
|
minHeight: '48px',
|
|
74
77
|
flexShrink: 0,
|
|
75
78
|
zIndex: 10,
|
|
76
|
-
borderTopLeftRadius:
|
|
77
|
-
borderTopRightRadius:
|
|
79
|
+
borderTopLeftRadius: RADIUS_XL,
|
|
80
|
+
borderTopRightRadius: RADIUS_XL,
|
|
78
81
|
'&-left': {
|
|
79
82
|
display: 'flex',
|
|
80
83
|
alignItems: 'center',
|
|
@@ -104,7 +107,7 @@ var genStyle = function genStyle(token) {
|
|
|
104
107
|
color: 'var(--color-gray-text-default)'
|
|
105
108
|
},
|
|
106
109
|
'&:active': {
|
|
107
|
-
backgroundColor:
|
|
110
|
+
backgroundColor: COLOR_GRAY_BG_ACTIVE
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
113
|
},
|
|
@@ -129,7 +132,7 @@ var genStyle = function genStyle(token) {
|
|
|
129
132
|
color: 'var(--color-gray-text-default)'
|
|
130
133
|
},
|
|
131
134
|
'&:active': {
|
|
132
|
-
backgroundColor:
|
|
135
|
+
backgroundColor: COLOR_GRAY_BG_ACTIVE
|
|
133
136
|
}
|
|
134
137
|
},
|
|
135
138
|
'&-collapse-btn': {
|
|
@@ -150,7 +153,7 @@ var genStyle = function genStyle(token) {
|
|
|
150
153
|
color: 'var(--color-gray-text-default)'
|
|
151
154
|
},
|
|
152
155
|
'&:active': {
|
|
153
|
-
backgroundColor:
|
|
156
|
+
backgroundColor: COLOR_GRAY_BG_ACTIVE
|
|
154
157
|
}
|
|
155
158
|
}
|
|
156
159
|
}
|
|
@@ -159,7 +162,7 @@ var genStyle = function genStyle(token) {
|
|
|
159
162
|
position: 'relative',
|
|
160
163
|
zIndex: 1,
|
|
161
164
|
width: '100%',
|
|
162
|
-
paddingBottom:
|
|
165
|
+
paddingBottom: RADIUS_XL,
|
|
163
166
|
flex: 1,
|
|
164
167
|
overflow: 'hidden',
|
|
165
168
|
display: 'flex',
|
|
@@ -181,7 +184,7 @@ var genStyle = function genStyle(token) {
|
|
|
181
184
|
backgroundColor: 'var(--color-gray-border-light)',
|
|
182
185
|
borderRadius: '3px',
|
|
183
186
|
'&:hover': {
|
|
184
|
-
backgroundColor:
|
|
187
|
+
backgroundColor: COLOR_GRAY_BORDER_DEFAULT
|
|
185
188
|
}
|
|
186
189
|
},
|
|
187
190
|
'> div': {
|
|
@@ -202,8 +205,8 @@ var genStyle = function genStyle(token) {
|
|
|
202
205
|
position: 'absolute',
|
|
203
206
|
bottom: 0,
|
|
204
207
|
zIndex: 100,
|
|
205
|
-
borderBottomLeftRadius:
|
|
206
|
-
borderBottomRightRadius:
|
|
208
|
+
borderBottomLeftRadius: RADIUS_XL,
|
|
209
|
+
borderBottomRightRadius: RADIUS_XL
|
|
207
210
|
},
|
|
208
211
|
'&-footer-background': {
|
|
209
212
|
position: 'absolute',
|
|
@@ -357,6 +357,7 @@ import { useStyle } from "./style";
|
|
|
357
357
|
switch(_state.label){
|
|
358
358
|
case 0:
|
|
359
359
|
e.preventDefault();
|
|
360
|
+
e.stopPropagation();
|
|
360
361
|
if (!props.onClick) return [
|
|
361
362
|
2
|
|
362
363
|
];
|
|
@@ -413,6 +414,7 @@ import { useStyle } from "./style";
|
|
|
413
414
|
5
|
|
414
415
|
];
|
|
415
416
|
e.preventDefault();
|
|
417
|
+
e.stopPropagation();
|
|
416
418
|
if (!props.onClick) return [
|
|
417
419
|
2
|
|
418
420
|
];
|
|
@@ -481,6 +483,7 @@ import { useStyle } from "./style";
|
|
|
481
483
|
switch(_state.label){
|
|
482
484
|
case 0:
|
|
483
485
|
e.preventDefault();
|
|
486
|
+
e.stopPropagation();
|
|
484
487
|
if (!props.onClick) return [
|
|
485
488
|
2
|
|
486
489
|
];
|
|
@@ -537,6 +540,7 @@ import { useStyle } from "./style";
|
|
|
537
540
|
5
|
|
538
541
|
];
|
|
539
542
|
e.preventDefault();
|
|
543
|
+
e.stopPropagation();
|
|
540
544
|
if (!props.onClick) return [
|
|
541
545
|
2
|
|
542
546
|
];
|
|
@@ -65,7 +65,7 @@ var genStyle = function genStyle(token) {
|
|
|
65
65
|
border: 'none',
|
|
66
66
|
borderRadius: 'var(--radius-control-base, 6px)',
|
|
67
67
|
cursor: 'pointer',
|
|
68
|
-
fontFamily: 'var(--font-family-base)',
|
|
68
|
+
fontFamily: 'var(--font-family-base, var(--font-family-text, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif))',
|
|
69
69
|
fontSize: 'var(--font-size-base, 14px)',
|
|
70
70
|
fontWeight: 'var(--font-weight-medium, 500)',
|
|
71
71
|
lineHeight: 'var(--line-height-base, 1.5)',
|
|
@@ -62,7 +62,7 @@ var genStyle = function genStyle(token) {
|
|
|
62
62
|
alignItems: 'center',
|
|
63
63
|
padding: '5px 12px',
|
|
64
64
|
cursor: 'pointer',
|
|
65
|
-
fontFamily: 'var(--font-family-base)',
|
|
65
|
+
fontFamily: 'var(--font-family-base, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif)',
|
|
66
66
|
fontSize: 'var(--font-size-base, 14px)',
|
|
67
67
|
fontWeight: 'var(--font-weight-medium, 500)',
|
|
68
68
|
lineHeight: 'var(--line-height-base, 1.5)',
|
package/dist/History/style.js
CHANGED
|
@@ -241,10 +241,10 @@ var genStyle = function genStyle(token) {
|
|
|
241
241
|
transform: 'translateX(0)'
|
|
242
242
|
},
|
|
243
243
|
'95%': {
|
|
244
|
-
transform: 'translateX(var(--scroll-width))'
|
|
244
|
+
transform: 'translateX(var(--scroll-width, 0px))'
|
|
245
245
|
},
|
|
246
246
|
'100%': {
|
|
247
|
-
transform: 'translateX(var(--scroll-width))'
|
|
247
|
+
transform: 'translateX(var(--scroll-width, 0px))'
|
|
248
248
|
}
|
|
249
249
|
}), // 为超长文本添加滚动效果
|
|
250
250
|
_define_property(_obj2, '[data-overflow="true"]', {
|
|
@@ -441,7 +441,8 @@ var I18nBoundary = function I18nBoundary(param) {
|
|
|
441
441
|
}, contentStyle),
|
|
442
442
|
prefixCls: baseClassName,
|
|
443
443
|
fncProps: props.fncProps,
|
|
444
|
-
linkConfig: props.linkConfig
|
|
444
|
+
linkConfig: props.linkConfig,
|
|
445
|
+
eleRender: props.eleRender
|
|
445
446
|
}), children))));
|
|
446
447
|
}
|
|
447
448
|
var _obj1;
|
|
@@ -959,7 +959,7 @@ var defaultAllowedTypes = [
|
|
|
959
959
|
};
|
|
960
960
|
/**
|
|
961
961
|
* 处理输入法开始事件
|
|
962
|
-
*/ var onCompositionStart = function onCompositionStart(
|
|
962
|
+
*/ var onCompositionStart = function onCompositionStart() {
|
|
963
963
|
var _markdownEditorRef_current_selection;
|
|
964
964
|
if (markdownContainerRef.current) {
|
|
965
965
|
markdownContainerRef.current.setAttribute('data-composition', '');
|
|
@@ -979,8 +979,18 @@ var defaultAllowedTypes = [
|
|
|
979
979
|
}
|
|
980
980
|
}
|
|
981
981
|
}
|
|
982
|
-
|
|
983
|
-
|
|
982
|
+
// 注意:不在此处调用 e.preventDefault()。
|
|
983
|
+
// 移动端(Android GBoard / iOS 软键盘)所有输入都经过组合事件,
|
|
984
|
+
// 调用 preventDefault 会阻断浏览器将字符写入 contenteditable,
|
|
985
|
+
// 导致 Slate 模型永远为空,占位符无法消失。
|
|
986
|
+
};
|
|
987
|
+
/**
|
|
988
|
+
* 部分 Android WebView(如微信)可能跳过 compositionstart 直接触发
|
|
989
|
+
* compositionupdate,此处兜底确保 data-composition 始终被设置。
|
|
990
|
+
*/ var onCompositionUpdate = function onCompositionUpdate() {
|
|
991
|
+
if (markdownContainerRef.current && !markdownContainerRef.current.hasAttribute('data-composition')) {
|
|
992
|
+
markdownContainerRef.current.setAttribute('data-composition', '');
|
|
993
|
+
store.inputComposition = true;
|
|
984
994
|
}
|
|
985
995
|
};
|
|
986
996
|
/**
|
|
@@ -988,9 +998,6 @@ var defaultAllowedTypes = [
|
|
|
988
998
|
*/ var onCompositionEnd = function onCompositionEnd() {
|
|
989
999
|
var _markdownEditorRef_current_selection;
|
|
990
1000
|
store.inputComposition = false;
|
|
991
|
-
if (markdownContainerRef.current) {
|
|
992
|
-
markdownContainerRef.current.removeAttribute('data-composition');
|
|
993
|
-
}
|
|
994
1001
|
var focusPath = ((_markdownEditorRef_current_selection = markdownEditorRef.current.selection) === null || _markdownEditorRef_current_selection === void 0 ? void 0 : _markdownEditorRef_current_selection.focus.path) || [];
|
|
995
1002
|
if (focusPath.length > 0) {
|
|
996
1003
|
var _markdownEditorRef_current_selection1;
|
|
@@ -1005,6 +1012,14 @@ var defaultAllowedTypes = [
|
|
|
1005
1012
|
}
|
|
1006
1013
|
}
|
|
1007
1014
|
}
|
|
1015
|
+
// 延迟到下一帧移除 data-composition,确保 Slate 完成模型更新、
|
|
1016
|
+
// React 完成重渲染(isEmpty 变为 false、empty class 移除)后
|
|
1017
|
+
// 再解除占位符隐藏,避免竞态导致占位符短暂闪现。
|
|
1018
|
+
requestAnimationFrame(function() {
|
|
1019
|
+
if (markdownContainerRef.current) {
|
|
1020
|
+
markdownContainerRef.current.removeAttribute('data-composition');
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1008
1023
|
};
|
|
1009
1024
|
var elementRenderElement = useRefFunction(function(eleProps) {
|
|
1010
1025
|
var _props_lazy;
|
|
@@ -1227,6 +1242,7 @@ var defaultAllowedTypes = [
|
|
|
1227
1242
|
autoCorrect: "off",
|
|
1228
1243
|
autoCapitalize: "none",
|
|
1229
1244
|
onCompositionStart: onCompositionStart,
|
|
1245
|
+
onCompositionUpdate: onCompositionUpdate,
|
|
1230
1246
|
onCompositionEnd: onCompositionEnd,
|
|
1231
1247
|
className: classNames(props.className, baseClassName, (_obj = {}, _define_property(_obj, "".concat(baseClassName, "-").concat(readonlyCls), readonlyCls), _define_property(_obj, "".concat(baseClassName, "-report"), props.reportMode), _define_property(_obj, "".concat(baseClassName, "-edit"), !readonly), _define_property(_obj, "".concat(baseClassName, "-compact"), props.compact), _obj), hashId),
|
|
1232
1248
|
style: props.style,
|
|
@@ -97,7 +97,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
97
97
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
98
98
|
}
|
|
99
99
|
import classNames from "clsx";
|
|
100
|
-
import React, { useContext } from "react";
|
|
100
|
+
import React, { useContext, useEffect, useState } from "react";
|
|
101
101
|
import { Node } from "slate";
|
|
102
102
|
import { I18nContext } from "../../../../I18n";
|
|
103
103
|
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
@@ -115,6 +115,28 @@ export var Paragraph = function Paragraph(props) {
|
|
|
115
115
|
var _useEditorStore = useEditorStore(), store = _useEditorStore.store, markdownEditorRef = _useEditorStore.markdownEditorRef, markdownContainerRef = _useEditorStore.markdownContainerRef, readonly = _useEditorStore.readonly, editorProps = _useEditorStore.editorProps;
|
|
116
116
|
var locale = useContext(I18nContext).locale;
|
|
117
117
|
var _useSelStatus = _sliced_to_array(useSelStatus(props.element), 1), selected = _useSelStatus[0];
|
|
118
|
+
// 将 store.inputComposition(可变对象属性)同步到 React state,
|
|
119
|
+
// 使 useMemo 能在组合输入状态变化时重新评估 isEmpty,
|
|
120
|
+
// 避免竞态导致占位符在组合结束后短暂闪现。
|
|
121
|
+
var _useState = _sliced_to_array(useState(false), 2), isComposing = _useState[0], setIsComposing = _useState[1];
|
|
122
|
+
useEffect(function() {
|
|
123
|
+
var container = markdownContainerRef.current;
|
|
124
|
+
if (!container) return;
|
|
125
|
+
var observer = new MutationObserver(function() {
|
|
126
|
+
setIsComposing(container.hasAttribute('data-composition'));
|
|
127
|
+
});
|
|
128
|
+
observer.observe(container, {
|
|
129
|
+
attributes: true,
|
|
130
|
+
attributeFilter: [
|
|
131
|
+
'data-composition'
|
|
132
|
+
]
|
|
133
|
+
});
|
|
134
|
+
return function() {
|
|
135
|
+
return observer.disconnect();
|
|
136
|
+
};
|
|
137
|
+
}, [
|
|
138
|
+
markdownContainerRef
|
|
139
|
+
]);
|
|
118
140
|
return React.useMemo(function() {
|
|
119
141
|
var _props_element_children_every, _props_element_children, _props_element, _markdownEditorRef_current, _props_children;
|
|
120
142
|
var str = Node.string(props.element).trim();
|
|
@@ -129,10 +151,9 @@ export var Paragraph = function Paragraph(props) {
|
|
|
129
151
|
var hasOnlyTextNodes = (_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_every = _props_element_children.every) === null || _props_element_children_every === void 0 ? void 0 : _props_element_children_every.call(_props_element_children, function(child) {
|
|
130
152
|
return !child.type && !child.code && !child.tag;
|
|
131
153
|
});
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
var isEmpty = !str && ((_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : _markdownEditorRef_current.children.length) === 1 && hasOnlyTextNodes ? true : undefined;
|
|
154
|
+
// 组合输入进行中时,Slate 模型尚未更新(字符还在 IME 候选区),
|
|
155
|
+
// 此时强制视为非空以隐藏占位符,避免用户输入时占位符仍然可见。
|
|
156
|
+
var isEmpty = !str && !isComposing && ((_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : _markdownEditorRef_current.children.length) === 1 && hasOnlyTextNodes ? true : undefined;
|
|
136
157
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, props.attributes), {
|
|
137
158
|
"data-be": 'paragraph',
|
|
138
159
|
"data-drag-el": true,
|
|
@@ -155,6 +176,7 @@ export var Paragraph = function Paragraph(props) {
|
|
|
155
176
|
align,
|
|
156
177
|
readonly,
|
|
157
178
|
selected,
|
|
179
|
+
isComposing,
|
|
158
180
|
(_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : _markdownEditorRef_current.children.length,
|
|
159
181
|
editorProps.titlePlaceholderContent
|
|
160
182
|
]);
|
|
@@ -203,7 +203,7 @@ var genStyle = function genStyle(token) {
|
|
|
203
203
|
width: '8px',
|
|
204
204
|
height: '8px'
|
|
205
205
|
}), _define_property(_obj, '::-webkit-scrollbar-thumb', {
|
|
206
|
-
backgroundColor: 'var(--color-gray-text-tertiary)',
|
|
206
|
+
backgroundColor: 'var(--color-gray-text-tertiary, var(--color-gray-text-light))',
|
|
207
207
|
borderRadius: '20px'
|
|
208
208
|
}), _define_property(_obj, '&-edit', {
|
|
209
209
|
'> div.empty:first-child': {
|
|
@@ -222,7 +222,11 @@ var genStyle = function genStyle(token) {
|
|
|
222
222
|
fontSize: '1em',
|
|
223
223
|
lineHeight: '21px',
|
|
224
224
|
wordBreak: 'break-word',
|
|
225
|
-
whiteSpace: 'wrap'
|
|
225
|
+
whiteSpace: 'wrap',
|
|
226
|
+
// 防止占位符伪元素响应触摸/点击事件,避免在移动端
|
|
227
|
+
// 竞态窗口内占位符遮挡用户对实际文字的交互。
|
|
228
|
+
pointerEvents: 'none',
|
|
229
|
+
userSelect: 'none'
|
|
226
230
|
}
|
|
227
231
|
},
|
|
228
232
|
'> div.empty:first-child [data-slate-node="text"]': {
|
|
@@ -366,7 +370,7 @@ var genStyle = function genStyle(token) {
|
|
|
366
370
|
fontSize: '0.9rem',
|
|
367
371
|
lineHeight: 'var(--line-height-base)',
|
|
368
372
|
letterSpacing: 'var(--letter-spacing-base)',
|
|
369
|
-
fontFamily: 'var(--font-family-base)'
|
|
373
|
+
fontFamily: 'var(--font-family-base, var(--font-family-text))'
|
|
370
374
|
},
|
|
371
375
|
'ul, ol': {
|
|
372
376
|
margin: 0
|
|
@@ -337,12 +337,12 @@ export var JinjaTemplatePanel = function JinjaTemplatePanel() {
|
|
|
337
337
|
}, loading ? /*#__PURE__*/ React.createElement("div", {
|
|
338
338
|
style: {
|
|
339
339
|
padding: 12,
|
|
340
|
-
color: 'var(--color-text-secondary)'
|
|
340
|
+
color: 'var(--color-text-secondary, var(--color-gray-text-secondary, rgba(0,0,0,0.45)))'
|
|
341
341
|
}
|
|
342
342
|
}, locale.loading) : items.length === 0 ? notFoundContent !== null && notFoundContent !== void 0 ? notFoundContent : /*#__PURE__*/ React.createElement("div", {
|
|
343
343
|
style: {
|
|
344
344
|
padding: 12,
|
|
345
|
-
color: 'var(--color-text-secondary)'
|
|
345
|
+
color: 'var(--color-text-secondary, var(--color-gray-text-secondary, rgba(0,0,0,0.45)))'
|
|
346
346
|
}
|
|
347
347
|
}, locale['jinja.panel.noTemplates']) : items.map(function(item, i) {
|
|
348
348
|
return /*#__PURE__*/ React.createElement("div", {
|
|
@@ -637,4 +637,14 @@ export type MarkdownEditorProps = {
|
|
|
637
637
|
* @description 当同时传入时,`renderMode` 优先
|
|
638
638
|
*/
|
|
639
639
|
renderType?: RenderMode;
|
|
640
|
+
/**
|
|
641
|
+
* 自定义元素渲染函数(仅 `renderMode: 'markdown'` 时生效)
|
|
642
|
+
* @description 拦截并自定义 MarkdownRenderer 中任意块级/行内元素的渲染结果。
|
|
643
|
+
* 与 Slate 模式的 `eleItemRender` 对应,允许替换段落、标题、列表、图片等元素。
|
|
644
|
+
* 返回 `undefined` 时回退到默认渲染。
|
|
645
|
+
* @param props - 元素属性(tagName、node、children 等)
|
|
646
|
+
* @param defaultDom - 默认渲染结果
|
|
647
|
+
* @returns 自定义渲染节点,或 undefined 时回退到 defaultDom
|
|
648
|
+
*/
|
|
649
|
+
eleRender?: (props: import('../MarkdownRenderer/types').MarkdownRendererEleProps, defaultDom: React.ReactNode) => React.ReactNode;
|
|
640
650
|
};
|
|
@@ -108,7 +108,7 @@ var VideoThumbnail = function VideoThumbnail(param) {
|
|
|
108
108
|
style: _object_spread_props(_object_spread({}, style), {
|
|
109
109
|
position: 'relative',
|
|
110
110
|
overflow: 'hidden',
|
|
111
|
-
borderRadius: 'var(--radius-base)',
|
|
111
|
+
borderRadius: 'var(--radius-base, 4px)',
|
|
112
112
|
flexShrink: 0
|
|
113
113
|
})
|
|
114
114
|
}, /*#__PURE__*/ React.createElement("video", {
|
|
@@ -83,8 +83,8 @@ var genStyle = function genStyle(token) {
|
|
|
83
83
|
height: 'var(--padding-1x)'
|
|
84
84
|
},
|
|
85
85
|
'&::-webkit-scrollbar-thumb': {
|
|
86
|
-
background: 'var(--color-gray-border-default)',
|
|
87
|
-
borderRadius: 'var(--radius-base)'
|
|
86
|
+
background: 'var(--color-gray-border-default, var(--color-gray-border-light))',
|
|
87
|
+
borderRadius: 'var(--radius-base, var(--radius-control-xs, 4px))'
|
|
88
88
|
},
|
|
89
89
|
'&::-webkit-scrollbar-track': {
|
|
90
90
|
background: 'transparent'
|
|
@@ -141,7 +141,7 @@ var genStyle = function genStyle(token) {
|
|
|
141
141
|
background: 'var(--color-gray-bg-card-white)',
|
|
142
142
|
boxSizing: 'border-box',
|
|
143
143
|
boxShadow: 'var(--shadow-control-base)',
|
|
144
|
-
borderRadius: 'var(--radius-base)',
|
|
144
|
+
borderRadius: 'var(--radius-base, var(--radius-control-xs, 4px))',
|
|
145
145
|
border: 'none',
|
|
146
146
|
overflow: 'hidden',
|
|
147
147
|
img: {
|
|
@@ -80,7 +80,8 @@ var genStyle = function genStyle(token) {
|
|
|
80
80
|
padding: 0,
|
|
81
81
|
maxWidth: 'calc(285px * 3 + 4px * 2)',
|
|
82
82
|
'& > :only-child': {
|
|
83
|
-
marginTop: 8
|
|
83
|
+
marginTop: 8,
|
|
84
|
+
padding: 2
|
|
84
85
|
}
|
|
85
86
|
},
|
|
86
87
|
'&::-webkit-scrollbar': {
|
|
@@ -271,7 +272,7 @@ var genStyle = function genStyle(token) {
|
|
|
271
272
|
background: 'var(--color-gray-bg-card-white)',
|
|
272
273
|
boxSizing: 'border-box',
|
|
273
274
|
boxShadow: 'var(--shadow-control-base)',
|
|
274
|
-
borderRadius: 'var(--radius-base)',
|
|
275
|
+
borderRadius: 'var(--radius-base, 4px)',
|
|
275
276
|
border: 'none',
|
|
276
277
|
overflow: 'hidden',
|
|
277
278
|
img: {
|
|
@@ -99,7 +99,7 @@ var genStyle = function genStyle(token) {
|
|
|
99
99
|
borderRadius: 'var(--radius-control-sm)'
|
|
100
100
|
},
|
|
101
101
|
'&:active': {
|
|
102
|
-
backgroundColor: 'var(--color-gray-control-fill-pressed)',
|
|
102
|
+
backgroundColor: 'var(--color-gray-control-fill-pressed, var(--color-gray-control-fill-secondary-active))',
|
|
103
103
|
outline: 'none',
|
|
104
104
|
border: 'none'
|
|
105
105
|
},
|
|
@@ -172,7 +172,7 @@ var genStyle = function genStyle(token) {
|
|
|
172
172
|
maxHeight: 400,
|
|
173
173
|
height: '100%',
|
|
174
174
|
overflowY: 'visible',
|
|
175
|
-
scrollbarColor: 'var(--color-gray-text-tertiary) transparent',
|
|
175
|
+
scrollbarColor: 'var(--color-gray-text-tertiary, #505c716b) transparent',
|
|
176
176
|
scrollbarWidth: 'thin',
|
|
177
177
|
'&&-disabled': {
|
|
178
178
|
backgroundColor: 'rgba(0,0,0,0.04)',
|
|
@@ -236,7 +236,7 @@ var SCHEMA_LANGUAGES = new Set([
|
|
|
236
236
|
* - Markdown → hast → React 元素树(hast-util-to-jsx-runtime)
|
|
237
237
|
* - 特殊块(code / mermaid / chart / katex)通过组件映射拦截渲染
|
|
238
238
|
*/ var InternalMarkdownRenderer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
239
|
-
var content = props.content, _props_streaming = props.streaming, streaming = _props_streaming === void 0 ? false : _props_streaming, isFinished = props.isFinished, queueOptions = props.queueOptions, plugins = props.plugins, remarkPlugins = props.remarkPlugins, htmlConfig = props.htmlConfig, className = props.className, style = props.style, customPrefixCls = props.prefixCls, linkConfig = props.linkConfig, streamingParagraphAnimation = props.streamingParagraphAnimation, apaasify = props.apaasify;
|
|
239
|
+
var content = props.content, _props_streaming = props.streaming, streaming = _props_streaming === void 0 ? false : _props_streaming, isFinished = props.isFinished, queueOptions = props.queueOptions, plugins = props.plugins, remarkPlugins = props.remarkPlugins, htmlConfig = props.htmlConfig, className = props.className, style = props.style, customPrefixCls = props.prefixCls, linkConfig = props.linkConfig, streamingParagraphAnimation = props.streamingParagraphAnimation, apaasify = props.apaasify, eleRender = props.eleRender;
|
|
240
240
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
241
241
|
// 复用 MarkdownEditor 的 CSS 前缀和样式,保持渲染一致性
|
|
242
242
|
var prefixCls = getPrefixCls('agentic-md-editor', customPrefixCls);
|
|
@@ -358,7 +358,8 @@ var SCHEMA_LANGUAGES = new Set([
|
|
|
358
358
|
linkConfig: linkConfig,
|
|
359
359
|
streaming: streaming,
|
|
360
360
|
streamingParagraphAnimation: streamingParagraphAnimation,
|
|
361
|
-
contentRevisionSource: streaming ? displayedContent : undefined
|
|
361
|
+
contentRevisionSource: streaming ? displayedContent : undefined,
|
|
362
|
+
eleRender: eleRender
|
|
362
363
|
});
|
|
363
364
|
return wrapVarSSR(wrapSSR(wrapContentSSR(/*#__PURE__*/ React.createElement("div", {
|
|
364
365
|
ref: containerRef,
|
|
@@ -6,7 +6,7 @@ export { ChartBlockRenderer } from './renderers/ChartRenderer';
|
|
|
6
6
|
export { CodeBlockRenderer } from './renderers/CodeRenderer';
|
|
7
7
|
export { MermaidBlockRenderer } from './renderers/MermaidRenderer';
|
|
8
8
|
export { SchemaBlockRenderer } from './renderers/SchemaRenderer';
|
|
9
|
-
export type { CharacterQueueOptions, MarkdownRendererProps, MarkdownRendererRef, RenderMode, RendererBlockProps, } from './types';
|
|
9
|
+
export type { CharacterQueueOptions, MarkdownRendererEleProps, MarkdownRendererProps, MarkdownRendererRef, RenderMode, RendererBlockProps, } from './types';
|
|
10
10
|
export type { UseMarkdownToReactOptions } from './markdownReactShared';
|
|
11
11
|
export { markdownToReactSync, useMarkdownToReact } from './useMarkdownToReact';
|
|
12
12
|
export { useStreamingMarkdownReact } from './streaming/useStreamingMarkdownReact';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Processor } from 'unified';
|
|
3
3
|
import { type MarkdownRemarkPlugin, type MarkdownToHtmlConfig } from '../MarkdownEditor/editor/utils/markdownToHtml';
|
|
4
|
-
import type { RendererBlockProps } from './types';
|
|
4
|
+
import type { MarkdownRendererEleProps, RendererBlockProps } from './types';
|
|
5
5
|
declare const createHastProcessor: (extraRemarkPlugins?: MarkdownRemarkPlugin[], config?: MarkdownToHtmlConfig) => Processor;
|
|
6
6
|
/**
|
|
7
7
|
* 构建与 MarkdownEditor Readonly 组件对齐的 hast→React 组件映射。
|
|
@@ -12,40 +12,40 @@ declare const createHastProcessor: (extraRemarkPlugins?: MarkdownRemarkPlugin[],
|
|
|
12
12
|
declare const buildEditorAlignedComponents: (prefixCls: string, userComponents: Record<string, React.ComponentType<RendererBlockProps>>, streaming?: boolean, linkConfig?: {
|
|
13
13
|
openInNewTab?: boolean | undefined;
|
|
14
14
|
onClick?: ((url?: string) => boolean | void) | undefined;
|
|
15
|
-
} | undefined, streamingParagraphAnimation?: boolean) => {
|
|
16
|
-
p: (props: any) => React.
|
|
17
|
-
h1: (props: any) => React.
|
|
18
|
-
h2: (props: any) => React.
|
|
19
|
-
h3: (props: any) => React.
|
|
20
|
-
h4: (props: any) => React.
|
|
21
|
-
h5: (props: any) => React.
|
|
22
|
-
h6: (props: any) => React.
|
|
23
|
-
blockquote: (props: any) => React.
|
|
24
|
-
ul: (props: any) => React.
|
|
25
|
-
ol: (props: any) => React.
|
|
26
|
-
li: (props: any) => React.
|
|
27
|
-
table: (props: any) => React.
|
|
15
|
+
} | undefined, streamingParagraphAnimation?: boolean, eleRender?: ((props: MarkdownRendererEleProps, defaultDom: React.ReactNode) => React.ReactNode) | undefined) => {
|
|
16
|
+
p: (props: any) => React.ReactNode;
|
|
17
|
+
h1: (props: any) => React.ReactNode;
|
|
18
|
+
h2: (props: any) => React.ReactNode;
|
|
19
|
+
h3: (props: any) => React.ReactNode;
|
|
20
|
+
h4: (props: any) => React.ReactNode;
|
|
21
|
+
h5: (props: any) => React.ReactNode;
|
|
22
|
+
h6: (props: any) => React.ReactNode;
|
|
23
|
+
blockquote: (props: any) => React.ReactNode;
|
|
24
|
+
ul: (props: any) => React.ReactNode;
|
|
25
|
+
ol: (props: any) => React.ReactNode;
|
|
26
|
+
li: (props: any) => React.ReactNode;
|
|
27
|
+
table: (props: any) => React.ReactNode;
|
|
28
28
|
thead: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
29
29
|
tbody: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
30
30
|
tr: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
31
31
|
th: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
32
32
|
td: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
33
33
|
input: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
34
|
-
a: (props: any) => React.
|
|
35
|
-
strong: (props: any) => React.
|
|
36
|
-
em: (props: any) => React.
|
|
37
|
-
del: (props: any) => React.
|
|
34
|
+
a: (props: any) => React.ReactNode;
|
|
35
|
+
strong: (props: any) => React.ReactNode;
|
|
36
|
+
em: (props: any) => React.ReactNode;
|
|
37
|
+
del: (props: any) => React.ReactNode;
|
|
38
38
|
code: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
39
|
-
mark: (props: any) => React.
|
|
40
|
-
kbd: (props: any) => React.
|
|
41
|
-
sub: (props: any) => React.
|
|
42
|
-
pre: (props: any) => React.
|
|
43
|
-
img: (props: any) => React.
|
|
44
|
-
video: (props: any) => React.
|
|
45
|
-
audio: (props: any) => React.
|
|
46
|
-
iframe: (props: any) => React.
|
|
47
|
-
hr: (props: any) => React.
|
|
48
|
-
sup: (props: any) => React.
|
|
39
|
+
mark: (props: any) => React.ReactNode;
|
|
40
|
+
kbd: (props: any) => React.ReactNode;
|
|
41
|
+
sub: (props: any) => React.ReactNode;
|
|
42
|
+
pre: (props: any) => React.ReactNode;
|
|
43
|
+
img: (props: any) => React.ReactNode;
|
|
44
|
+
video: (props: any) => React.ReactNode;
|
|
45
|
+
audio: (props: any) => React.ReactNode;
|
|
46
|
+
iframe: (props: any) => React.ReactNode;
|
|
47
|
+
hr: (props: any) => React.ReactNode;
|
|
48
|
+
sup: (props: any) => React.ReactNode;
|
|
49
49
|
span: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
50
50
|
section: (props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
51
51
|
think: (props: any) => React.FunctionComponentElement<import("../ToolUseBarThink").ToolUseBarThinkProps>;
|
|
@@ -89,5 +89,12 @@ export interface UseMarkdownToReactOptions {
|
|
|
89
89
|
* 与 `content`(常为 useStreaming 输出的可解析串)分离,避免占位符与正文切换时误判为非前缀修订。
|
|
90
90
|
*/
|
|
91
91
|
contentRevisionSource?: string;
|
|
92
|
+
/**
|
|
93
|
+
* 自定义元素渲染拦截函数(markdown 渲染模式)。
|
|
94
|
+
* 允许在默认渲染结果基础上包装、替换任意元素。
|
|
95
|
+
* 返回 undefined 时回退到默认渲染。
|
|
96
|
+
*/
|
|
97
|
+
eleRender?: (props: MarkdownRendererEleProps, defaultDom: React.ReactNode) => React.ReactNode;
|
|
92
98
|
}
|
|
93
99
|
export { buildEditorAlignedComponents, createHastProcessor, markLastParagraphStreamingTail, renderMarkdownBlock, splitMarkdownBlocks, };
|
|
100
|
+
export type { MarkdownRendererEleProps };
|