@ant-design/agentic-ui 2.29.11 → 2.29.13
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/AILabel/style.d.ts +3 -0
- package/dist/AgentRunBar/style.d.ts +3 -0
- package/dist/AgenticLayout/style.d.ts +3 -0
- package/dist/AnswerAlert/style.d.ts +3 -0
- package/dist/BackTo/style.d.ts +3 -0
- package/dist/Bubble/List/style.d.ts +3 -0
- package/dist/Bubble/MessagesContent/VoiceButton/style.d.ts +3 -0
- package/dist/Bubble/MessagesContent/docInfoStyle.d.ts +3 -0
- package/dist/Bubble/MessagesContent/style.d.ts +3 -0
- package/dist/Bubble/style.d.ts +3 -0
- package/dist/ChatBootPage/ButtonTabGroupStyle.d.ts +3 -0
- package/dist/ChatBootPage/ButtonTabStyle.d.ts +6 -0
- package/dist/ChatBootPage/CaseReplyStyle.d.ts +3 -0
- package/dist/ChatBootPage/style.d.ts +3 -0
- package/dist/ChatLayout/style.d.ts +3 -0
- package/dist/Components/ActionIconBox/style.d.ts +3 -0
- package/dist/Components/ActionItemBox/ActionItemBox.d.ts +1 -1
- package/dist/Components/ActionItemBox/style.d.ts +3 -0
- package/dist/Components/Button/IconButton/style.d.ts +3 -0
- package/dist/Components/Button/SwitchButton/style.d.ts +3 -0
- package/dist/Components/Button/ToggleButton/style.d.ts +3 -0
- package/dist/Components/GradientText/index.d.ts +1 -1
- package/dist/Components/GradientText/style.d.ts +3 -0
- package/dist/Components/LayoutHeader/style.d.ts +3 -0
- package/dist/Components/Loading/Loading.d.ts +1 -1
- package/dist/Components/Loading/style.d.ts +3 -0
- package/dist/Components/SuggestionList/style.d.ts +3 -0
- package/dist/Components/TextAnimate/index.d.ts +1 -1
- package/dist/Components/TextAnimate/style.d.ts +3 -0
- package/dist/Components/TypingAnimation/index.d.ts +1 -1
- package/dist/Components/TypingAnimation/style.d.ts +3 -0
- package/dist/Components/VisualList/style.d.ts +3 -0
- package/dist/Components/lotties/TextLoading/style.d.ts +3 -0
- package/dist/Components/lotties/bubble-actions/Abstract/style.d.ts +3 -0
- package/dist/History/components/HistoryItem.js +3 -0
- package/dist/History/components/NewChatComponent.style.d.ts +3 -0
- package/dist/History/style.d.ts +3 -0
- package/dist/History/style.js +2 -2
- package/dist/Hooks/useLanguage.d.ts +1 -0
- package/dist/Hooks/useStyle/index.d.ts +3 -0
- package/dist/Hooks/useStyle/index.js +7 -4
- package/dist/I18n/locales.d.ts +1 -0
- package/dist/I18n/locales.js +2 -0
- package/dist/MarkdownEditor/editor/Editor.d.ts +1 -2
- package/dist/MarkdownEditor/editor/Editor.js +16 -5
- package/dist/MarkdownEditor/editor/components/CommentList/style.d.ts +3 -0
- package/dist/MarkdownEditor/editor/components/ContributorAvatar/style.d.ts +3 -0
- package/dist/MarkdownEditor/editor/components/LazyElement/style.d.ts +3 -0
- package/dist/MarkdownEditor/editor/components/fntTag/index.d.ts +1 -1
- package/dist/MarkdownEditor/editor/components/fntTag/style.d.ts +3 -0
- package/dist/MarkdownEditor/editor/elements/Blockquote/ReadonlyBlockquote.js +0 -5
- package/dist/MarkdownEditor/editor/elements/Blockquote/index.js +0 -10
- package/dist/MarkdownEditor/editor/elements/Break/ReadonlyBreak.js +0 -2
- package/dist/MarkdownEditor/editor/elements/Break/index.js +0 -2
- package/dist/MarkdownEditor/editor/elements/Card/ReadonlyCard.js +0 -6
- package/dist/MarkdownEditor/editor/elements/Card/index.js +0 -11
- package/dist/MarkdownEditor/editor/elements/Code/ReadonlyCode.js +4 -9
- package/dist/MarkdownEditor/editor/elements/Code/index.js +4 -9
- package/dist/MarkdownEditor/editor/elements/Comment/index.d.ts +0 -2
- package/dist/MarkdownEditor/editor/elements/Comment/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/CommentLeaf/index.d.ts +1 -2
- package/dist/MarkdownEditor/editor/elements/CommentLeaf/index.js +3 -9
- package/dist/MarkdownEditor/editor/elements/FncLeaf/index.d.ts +1 -2
- package/dist/MarkdownEditor/editor/elements/FncLeaf/index.js +2 -32
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition/ReadonlyFootnoteDefinition.js +0 -7
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition/index.js +0 -1
- package/dist/MarkdownEditor/editor/elements/FootnoteReference/ReadonlyFootnoteReference.js +0 -3
- package/dist/MarkdownEditor/editor/elements/FootnoteReference/index.js +0 -1
- package/dist/MarkdownEditor/editor/elements/Head/ReadonlyHead.js +0 -4
- package/dist/MarkdownEditor/editor/elements/Head/index.js +0 -9
- package/dist/MarkdownEditor/editor/elements/Hr/ReadonlyHr.js +0 -2
- package/dist/MarkdownEditor/editor/elements/Hr/index.js +0 -2
- package/dist/MarkdownEditor/editor/elements/Image/index.js +2 -31
- package/dist/MarkdownEditor/editor/elements/InlineKatex/ReadonlyInlineKatex.js +0 -5
- package/dist/MarkdownEditor/editor/elements/LinkCard/ReadonlyLinkCard.js +11 -25
- package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +11 -25
- package/dist/MarkdownEditor/editor/elements/List/List.d.ts +0 -3
- package/dist/MarkdownEditor/editor/elements/List/List.js +5 -36
- package/dist/MarkdownEditor/editor/elements/List/ListItem.js +4 -18
- package/dist/MarkdownEditor/editor/elements/List/ReadonlyList.js +4 -21
- package/dist/MarkdownEditor/editor/elements/List/ReadonlyListItem.js +3 -14
- package/dist/MarkdownEditor/editor/elements/Mermaid/ReadonlyMermaid.js +5 -12
- package/dist/MarkdownEditor/editor/elements/Mermaid/index.js +5 -12
- package/dist/MarkdownEditor/editor/elements/Paragraph/ReadonlyParagraph.js +0 -9
- package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +0 -1
- package/dist/MarkdownEditor/editor/elements/Schema/ReadonlySchema.js +0 -13
- package/dist/MarkdownEditor/editor/elements/Schema/index.js +0 -3
- package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.d.ts +0 -1
- package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +9 -7
- package/dist/MarkdownEditor/editor/elements/Table/SimpleTable.js +3 -48
- package/dist/MarkdownEditor/editor/elements/Table/Table.d.ts +1 -2
- package/dist/MarkdownEditor/editor/elements/Table/Table.js +8 -7
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndex/index.js +7 -9
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndexSpacer/index.js +7 -9
- package/dist/MarkdownEditor/editor/elements/Table/TableRowIndex/index.js +3 -5
- package/dist/MarkdownEditor/editor/elements/Table/Td/index.js +6 -8
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +8 -10
- package/dist/MarkdownEditor/editor/elements/index.d.ts +1 -1
- package/dist/MarkdownEditor/editor/elements/index.js +83 -105
- package/dist/MarkdownEditor/editor/parser/parse/parseTable.d.ts +3 -2
- package/dist/MarkdownEditor/editor/parser/parse/parseTable.js +14 -3
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +16 -6
- package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +4 -1
- package/dist/MarkdownEditor/editor/plugins/useOnchange.js +9 -2
- package/dist/MarkdownEditor/editor/store.js +7 -4
- package/dist/MarkdownEditor/editor/style.d.ts +3 -0
- package/dist/MarkdownEditor/editor/tools/ToolBar/FloatBar.js +1 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/ReadonlyBaseBar.d.ts +0 -1
- package/dist/MarkdownEditor/editor/tools/ToolBar/ReadonlyBaseBar.js +3 -4
- package/dist/MarkdownEditor/editor/tools/ToolBar/floatBarStyle.d.ts +3 -0
- package/dist/MarkdownEditor/editor/tools/ToolBar/toolBarStyle.d.ts +3 -0
- package/dist/MarkdownEditor/editor/tools/insertAutocompleteStyle.d.ts +3 -0
- package/dist/MarkdownEditor/style.d.ts +3 -0
- package/dist/MarkdownEditor/style.js +575 -3
- package/dist/MarkdownInputField/AttachmentButton/AttachmentButtonPopover.d.ts +3 -0
- package/dist/MarkdownInputField/AttachmentButton/AttachmentButtonPopover.js +47 -10
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.d.ts +3 -0
- package/dist/MarkdownInputField/AttachmentButton/index.d.ts +4 -0
- package/dist/MarkdownInputField/AttachmentButton/index.js +5 -3
- package/dist/MarkdownInputField/AttachmentButton/style.d.ts +3 -0
- package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.d.ts +1 -1
- package/dist/MarkdownInputField/BorderBeamAnimation.js +47 -25
- package/dist/MarkdownInputField/FileMapView/style.d.ts +3 -0
- package/dist/MarkdownInputField/RefinePromptButton/style.d.ts +3 -0
- package/dist/MarkdownInputField/SendButton/style.d.ts +3 -0
- package/dist/MarkdownInputField/SkillModeBar/style.d.ts +3 -0
- package/dist/MarkdownInputField/TopOperatingArea/style.d.ts +3 -0
- package/dist/MarkdownInputField/VoiceInput/style.d.ts +3 -0
- package/dist/MarkdownInputField/style.d.ts +3 -0
- package/dist/Plugins/chart/AreaChart/style.d.ts +3 -0
- package/dist/Plugins/chart/BarChart/style.d.ts +3 -0
- package/dist/Plugins/chart/ChartAttrToolBar/ChartAttrToolBarStyle.d.ts +3 -0
- package/dist/Plugins/chart/ChartStatistic/style.d.ts +3 -0
- package/dist/Plugins/chart/DonutChart/style.d.ts +3 -0
- package/dist/Plugins/chart/FunnelChart/style.d.ts +3 -0
- package/dist/Plugins/chart/LineChart/style.d.ts +3 -0
- package/dist/Plugins/chart/RadarChart/style.d.ts +3 -0
- package/dist/Plugins/chart/ScatterChart/style.d.ts +3 -0
- package/dist/Plugins/chart/components/ChartContainer/style.d.ts +3 -0
- package/dist/Plugins/chart/components/ChartFilter/style.d.ts +3 -0
- package/dist/Plugins/chart/components/ChartToolBar/style.d.ts +3 -0
- package/dist/Plugins/mermaid/MermaidFallback.d.ts +1 -2
- package/dist/Plugins/mermaid/MermaidRendererImpl.d.ts +1 -2
- package/dist/Plugins/mermaid/style.d.ts +3 -0
- package/dist/Plugins/mermaid/style.js +5 -2
- package/dist/Plugins/mermaid/utils.js +1 -1
- package/dist/Quote/style.d.ts +3 -0
- package/dist/Schema/SchemaEditor/style.d.ts +3 -0
- package/dist/TaskList/index.d.ts +1 -1
- package/dist/TaskList/style.d.ts +3 -0
- package/dist/ThoughtChainList/DotAni/index.d.ts +1 -2
- package/dist/ThoughtChainList/DotAni/style.d.ts +3 -0
- package/dist/ThoughtChainList/style.d.ts +3 -0
- package/dist/ToolUseBar/style.d.ts +3 -0
- package/dist/ToolUseBarThink/style.d.ts +3 -0
- package/dist/WelcomeMessage/style.d.ts +3 -0
- package/dist/Workspace/Browser/style.d.ts +3 -0
- package/dist/Workspace/File/style.d.ts +3 -0
- package/dist/Workspace/HtmlPreview/style.d.ts +3 -0
- package/dist/Workspace/RealtimeFollow/style.d.ts +3 -0
- package/dist/Workspace/Task/style.d.ts +3 -0
- package/dist/Workspace/style.d.ts +3 -0
- package/package.json +1 -1
- package/dist/MarkdownEditor/editor/elements/LinkCard/style.d.ts +0 -10
- package/dist/MarkdownEditor/editor/elements/LinkCard/style.js +0 -136
- package/dist/MarkdownEditor/editor/elements/List/style.d.ts +0 -10
- package/dist/MarkdownEditor/editor/elements/List/style.js +0 -139
- package/dist/MarkdownEditor/editor/elements/Mermaid/style.d.ts +0 -10
- package/dist/MarkdownEditor/editor/elements/Mermaid/style.js +0 -144
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndex/style.d.ts +0 -10
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndex/style.js +0 -131
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndexSpacer/style.d.ts +0 -10
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndexSpacer/style.js +0 -125
- package/dist/MarkdownEditor/editor/elements/Table/TableRowIndex/style.d.ts +0 -10
- package/dist/MarkdownEditor/editor/elements/Table/TableRowIndex/style.js +0 -74
- package/dist/MarkdownEditor/editor/elements/Table/Td/style.d.ts +0 -10
- package/dist/MarkdownEditor/editor/elements/Table/Td/style.js +0 -93
- package/dist/MarkdownEditor/editor/elements/Table/style.d.ts +0 -11
- package/dist/MarkdownEditor/editor/elements/Table/style.js +0 -255
- package/dist/MarkdownEditor/editor/elements/TagPopup/style.d.ts +0 -5
- package/dist/MarkdownEditor/editor/elements/TagPopup/style.js +0 -111
|
@@ -51,7 +51,6 @@ function _object_spread_props(target, source) {
|
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
53
|
import React from "react";
|
|
54
|
-
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
55
54
|
import { useEditorStore } from "../../store";
|
|
56
55
|
/**
|
|
57
56
|
* Blockquote 组件 - 引用块组件
|
|
@@ -85,21 +84,12 @@ import { useEditorStore } from "../../store";
|
|
|
85
84
|
* - 使用 memo 优化性能
|
|
86
85
|
* - 提供 data-be 属性用于标识
|
|
87
86
|
*/ export function Blockquote(props) {
|
|
88
|
-
var _props_element_children;
|
|
89
|
-
debugInfo('Blockquote - 渲染引用块', {
|
|
90
|
-
childrenCount: (_props_element_children = props.element.children) === null || _props_element_children === void 0 ? void 0 : _props_element_children.length
|
|
91
|
-
});
|
|
92
87
|
var _useEditorStore = useEditorStore(), store = _useEditorStore.store, markdownContainerRef = _useEditorStore.markdownContainerRef;
|
|
93
88
|
return React.useMemo(function() {
|
|
94
|
-
var _props_element_children;
|
|
95
|
-
debugInfo('Blockquote - useMemo 渲染', {
|
|
96
|
-
childrenCount: (_props_element_children = props.element.children) === null || _props_element_children === void 0 ? void 0 : _props_element_children.length
|
|
97
|
-
});
|
|
98
89
|
return /*#__PURE__*/ React.createElement("blockquote", _object_spread_props(_object_spread({
|
|
99
90
|
"data-be": 'blockquote'
|
|
100
91
|
}, props.attributes), {
|
|
101
92
|
onDragStart: function(e) {
|
|
102
|
-
debugInfo('Blockquote - 拖拽开始');
|
|
103
93
|
store.dragStart(e, markdownContainerRef.current);
|
|
104
94
|
}
|
|
105
95
|
}), props.children);
|
|
@@ -51,7 +51,6 @@ function _object_spread_props(target, source) {
|
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
53
|
import React from "react";
|
|
54
|
-
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
55
54
|
/**
|
|
56
55
|
* ReadonlyBreak 组件 - 只读换行预览组件
|
|
57
56
|
*
|
|
@@ -80,7 +79,6 @@ import { debugInfo } from "../../../../Utils/debugUtils";
|
|
|
80
79
|
* - 保持预览模式的视觉效果
|
|
81
80
|
*/ export var ReadonlyBreak = /*#__PURE__*/ React.memo(function(param) {
|
|
82
81
|
var attributes = param.attributes, children = param.children;
|
|
83
|
-
debugInfo('ReadonlyBreak - 渲染只读换行');
|
|
84
82
|
return /*#__PURE__*/ React.createElement("span", _object_spread_props(_object_spread({}, attributes), {
|
|
85
83
|
contentEditable: false
|
|
86
84
|
}), children, /*#__PURE__*/ React.createElement("br", null));
|
|
@@ -51,10 +51,8 @@ function _object_spread_props(target, source) {
|
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
53
|
import React from "react";
|
|
54
|
-
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
55
54
|
export var Break = function(param) {
|
|
56
55
|
var attributes = param.attributes, children = param.children;
|
|
57
|
-
debugInfo('Break - 渲染换行');
|
|
58
56
|
return /*#__PURE__*/ React.createElement("span", _object_spread_props(_object_spread({}, attributes), {
|
|
59
57
|
contentEditable: false
|
|
60
58
|
}), children, /*#__PURE__*/ React.createElement("br", null));
|
|
@@ -51,7 +51,6 @@ function _object_spread_props(target, source) {
|
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
53
|
import React from "react";
|
|
54
|
-
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
55
54
|
/**
|
|
56
55
|
* ReadonlyCard 组件 - 只读卡片预览组件
|
|
57
56
|
*
|
|
@@ -83,11 +82,6 @@ import { debugInfo } from "../../../../Utils/debugUtils";
|
|
|
83
82
|
* - 使用 React.memo 优化性能
|
|
84
83
|
* - 保持预览模式的视觉效果
|
|
85
84
|
*/ export var ReadonlyCard = /*#__PURE__*/ React.memo(function(props) {
|
|
86
|
-
var _props_element_children;
|
|
87
|
-
debugInfo('ReadonlyCard - 渲染只读卡片', {
|
|
88
|
-
block: props.element.block,
|
|
89
|
-
childrenCount: (_props_element_children = props.element.children) === null || _props_element_children === void 0 ? void 0 : _props_element_children.length
|
|
90
|
-
});
|
|
91
85
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, props.attributes), {
|
|
92
86
|
"data-be": 'card',
|
|
93
87
|
role: "button"
|
|
@@ -98,22 +98,11 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
98
98
|
}
|
|
99
99
|
import React from "react";
|
|
100
100
|
import { useSelStatus } from "../../../hooks/editor";
|
|
101
|
-
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
102
101
|
import { useEditorStore } from "../../store";
|
|
103
102
|
export var WarpCard = function(props) {
|
|
104
|
-
var _props_element_children;
|
|
105
|
-
debugInfo('WarpCard - 渲染卡片', {
|
|
106
|
-
block: props.element.block,
|
|
107
|
-
childrenCount: (_props_element_children = props.element.children) === null || _props_element_children === void 0 ? void 0 : _props_element_children.length
|
|
108
|
-
});
|
|
109
103
|
var _useSelStatus = _sliced_to_array(useSelStatus(props.element), 2), selected = _useSelStatus[0], path = _useSelStatus[1];
|
|
110
104
|
var readonly = useEditorStore().readonly;
|
|
111
105
|
return React.useMemo(function() {
|
|
112
|
-
debugInfo('WarpCard - useMemo 渲染', {
|
|
113
|
-
readonly: readonly,
|
|
114
|
-
selected: selected,
|
|
115
|
-
block: props.element.block
|
|
116
|
-
});
|
|
117
106
|
if (readonly) {
|
|
118
107
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, props.attributes), {
|
|
119
108
|
"data-be": 'card',
|
|
@@ -84,7 +84,7 @@ import { debugInfo } from "../../../../Utils/debugUtils";
|
|
|
84
84
|
* - 保持预览模式的视觉效果
|
|
85
85
|
*/ export var ReadonlyCode = /*#__PURE__*/ React.memo(function(param) {
|
|
86
86
|
var attributes = param.attributes, children = param.children, element = param.element;
|
|
87
|
-
var _element_value, _element_otherProps, _element_otherProps1, _element_otherProps2,
|
|
87
|
+
var _element_value, _element_otherProps, _element_otherProps1, _element_otherProps2, _element_otherProps3, _element_value1;
|
|
88
88
|
debugInfo('ReadonlyCode - 渲染只读代码块', {
|
|
89
89
|
language: element === null || element === void 0 ? void 0 : element.language,
|
|
90
90
|
valueLength: element === null || element === void 0 ? void 0 : (_element_value = element.value) === null || _element_value === void 0 ? void 0 : _element_value.length,
|
|
@@ -93,7 +93,7 @@ import { debugInfo } from "../../../../Utils/debugUtils";
|
|
|
93
93
|
});
|
|
94
94
|
// HTML 代码块处理
|
|
95
95
|
if ((element === null || element === void 0 ? void 0 : element.language) === 'html') {
|
|
96
|
-
var _element_otherProps4, _element_otherProps5, _element_otherProps6,
|
|
96
|
+
var _element_otherProps4, _element_otherProps5, _element_otherProps6, _element_value2;
|
|
97
97
|
debugInfo('ReadonlyCode - HTML 代码块', {
|
|
98
98
|
isConfig: element === null || element === void 0 ? void 0 : (_element_otherProps4 = element.otherProps) === null || _element_otherProps4 === void 0 ? void 0 : _element_otherProps4.isConfig
|
|
99
99
|
});
|
|
@@ -101,15 +101,10 @@ import { debugInfo } from "../../../../Utils/debugUtils";
|
|
|
101
101
|
style: {
|
|
102
102
|
display: (element === null || element === void 0 ? void 0 : (_element_otherProps5 = element.otherProps) === null || _element_otherProps5 === void 0 ? void 0 : _element_otherProps5.isConfig) ? 'none' : 'block'
|
|
103
103
|
}
|
|
104
|
-
}), (element === null || element === void 0 ? void 0 : (_element_otherProps6 = element.otherProps) === null || _element_otherProps6 === void 0 ? void 0 : _element_otherProps6.isConfig) ? '' : DOMPurify.sanitize(element === null || element === void 0 ? void 0 : (
|
|
104
|
+
}), (element === null || element === void 0 ? void 0 : (_element_otherProps6 = element.otherProps) === null || _element_otherProps6 === void 0 ? void 0 : _element_otherProps6.isConfig) ? '' : DOMPurify.sanitize(element === null || element === void 0 ? void 0 : (_element_value2 = element.value) === null || _element_value2 === void 0 ? void 0 : _element_value2.trim()));
|
|
105
105
|
}
|
|
106
106
|
// 检查代码块是否未闭合
|
|
107
107
|
var isUnclosed = (element === null || element === void 0 ? void 0 : (_element_otherProps2 = element.otherProps) === null || _element_otherProps2 === void 0 ? void 0 : _element_otherProps2.finished) === false;
|
|
108
|
-
debugInfo('ReadonlyCode - 普通代码块', {
|
|
109
|
-
language: element === null || element === void 0 ? void 0 : element.language,
|
|
110
|
-
isUnclosed: isUnclosed,
|
|
111
|
-
valueLength: element === null || element === void 0 ? void 0 : (_element_value1 = element.value) === null || _element_value1 === void 0 ? void 0 : _element_value1.length
|
|
112
|
-
});
|
|
113
108
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
|
|
114
109
|
"data-is-unclosed": isUnclosed,
|
|
115
110
|
"data-language": element === null || element === void 0 ? void 0 : element.language,
|
|
@@ -140,6 +135,6 @@ import { debugInfo } from "../../../../Utils/debugUtils";
|
|
|
140
135
|
boxShadow: 'var(--shadow-control-base)',
|
|
141
136
|
position: 'relative'
|
|
142
137
|
}
|
|
143
|
-
}), (element === null || element === void 0 ? void 0 : (
|
|
138
|
+
}), (element === null || element === void 0 ? void 0 : (_element_value1 = element.value) === null || _element_value1 === void 0 ? void 0 : _element_value1.trim()) || children);
|
|
144
139
|
});
|
|
145
140
|
ReadonlyCode.displayName = 'ReadonlyCode';
|
|
@@ -55,7 +55,7 @@ import React from "react";
|
|
|
55
55
|
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
56
56
|
export var Code = function(param) {
|
|
57
57
|
var attributes = param.attributes, children = param.children, element = param.element;
|
|
58
|
-
var _element_value, _element_otherProps, _element_otherProps1, _element_otherProps2,
|
|
58
|
+
var _element_value, _element_otherProps, _element_otherProps1, _element_otherProps2, _element_otherProps3, _element_value1;
|
|
59
59
|
debugInfo('Code - 渲染代码块', {
|
|
60
60
|
language: element === null || element === void 0 ? void 0 : element.language,
|
|
61
61
|
valueLength: element === null || element === void 0 ? void 0 : (_element_value = element.value) === null || _element_value === void 0 ? void 0 : _element_value.length,
|
|
@@ -63,7 +63,7 @@ export var Code = function(param) {
|
|
|
63
63
|
finished: element === null || element === void 0 ? void 0 : (_element_otherProps1 = element.otherProps) === null || _element_otherProps1 === void 0 ? void 0 : _element_otherProps1.finished
|
|
64
64
|
});
|
|
65
65
|
if ((element === null || element === void 0 ? void 0 : element.language) === 'html') {
|
|
66
|
-
var _element_otherProps4, _element_otherProps5, _element_otherProps6,
|
|
66
|
+
var _element_otherProps4, _element_otherProps5, _element_otherProps6, _element_value2;
|
|
67
67
|
debugInfo('Code - HTML 代码块', {
|
|
68
68
|
isConfig: element === null || element === void 0 ? void 0 : (_element_otherProps4 = element.otherProps) === null || _element_otherProps4 === void 0 ? void 0 : _element_otherProps4.isConfig
|
|
69
69
|
});
|
|
@@ -71,15 +71,10 @@ export var Code = function(param) {
|
|
|
71
71
|
style: {
|
|
72
72
|
display: (element === null || element === void 0 ? void 0 : (_element_otherProps5 = element.otherProps) === null || _element_otherProps5 === void 0 ? void 0 : _element_otherProps5.isConfig) ? 'none' : 'block'
|
|
73
73
|
}
|
|
74
|
-
}), (element === null || element === void 0 ? void 0 : (_element_otherProps6 = element.otherProps) === null || _element_otherProps6 === void 0 ? void 0 : _element_otherProps6.isConfig) ? '' : DOMPurify.sanitize(element === null || element === void 0 ? void 0 : (
|
|
74
|
+
}), (element === null || element === void 0 ? void 0 : (_element_otherProps6 = element.otherProps) === null || _element_otherProps6 === void 0 ? void 0 : _element_otherProps6.isConfig) ? '' : DOMPurify.sanitize(element === null || element === void 0 ? void 0 : (_element_value2 = element.value) === null || _element_value2 === void 0 ? void 0 : _element_value2.trim()));
|
|
75
75
|
}
|
|
76
76
|
// 检查代码块是否未闭合
|
|
77
77
|
var isUnclosed = (element === null || element === void 0 ? void 0 : (_element_otherProps2 = element.otherProps) === null || _element_otherProps2 === void 0 ? void 0 : _element_otherProps2.finished) === false;
|
|
78
|
-
debugInfo('Code - 普通代码块', {
|
|
79
|
-
language: element === null || element === void 0 ? void 0 : element.language,
|
|
80
|
-
isUnclosed: isUnclosed,
|
|
81
|
-
valueLength: element === null || element === void 0 ? void 0 : (_element_value1 = element.value) === null || _element_value1 === void 0 ? void 0 : _element_value1.length
|
|
82
|
-
});
|
|
83
78
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
|
|
84
79
|
"data-is-unclosed": isUnclosed,
|
|
85
80
|
"data-language": element === null || element === void 0 ? void 0 : element.language,
|
|
@@ -110,5 +105,5 @@ export var Code = function(param) {
|
|
|
110
105
|
boxShadow: 'var(--shadow-control-base)',
|
|
111
106
|
position: 'relative'
|
|
112
107
|
}
|
|
113
|
-
}), (element === null || element === void 0 ? void 0 : (
|
|
108
|
+
}), (element === null || element === void 0 ? void 0 : (_element_value1 = element.value) === null || _element_value1 === void 0 ? void 0 : _element_value1.trim()) || children);
|
|
114
109
|
};
|
|
@@ -47,7 +47,7 @@ import React, { useContext, useMemo } from "react";
|
|
|
47
47
|
"data-be": "comment-text",
|
|
48
48
|
"data-testid": "comment-view",
|
|
49
49
|
id: props.id,
|
|
50
|
-
className: classNames(
|
|
50
|
+
className: classNames(_define_property({}, "".concat(mdEditorBaseClass, "-comment-").concat(type), type)),
|
|
51
51
|
style: {
|
|
52
52
|
position: 'relative'
|
|
53
53
|
},
|
|
@@ -4,8 +4,7 @@ import { MarkdownEditorProps } from '../../../types';
|
|
|
4
4
|
interface CommentLeafProps {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
leaf: RenderLeafProps['leaf'];
|
|
7
|
-
hashId: string;
|
|
8
7
|
comment: MarkdownEditorProps['comment'];
|
|
9
8
|
}
|
|
10
|
-
export declare const CommentLeaf: React.MemoExoticComponent<({ children, leaf,
|
|
9
|
+
export declare const CommentLeaf: React.MemoExoticComponent<({ children, leaf, comment, }: CommentLeafProps) => React.JSX.Element>;
|
|
11
10
|
export {};
|
|
@@ -6,11 +6,11 @@ import { CommentView } from "../Comment";
|
|
|
6
6
|
* 比较函数,用于优化 CommentLeaf 组件的渲染性能
|
|
7
7
|
*/ var areCommentLeafPropsEqual = function(prevProps, nextProps) {
|
|
8
8
|
// 首先进行快速引用比较
|
|
9
|
-
if (prevProps.leaf === nextProps.leaf && prevProps.children === nextProps.children && prevProps.
|
|
9
|
+
if (prevProps.leaf === nextProps.leaf && prevProps.children === nextProps.children && prevProps.comment === nextProps.comment) {
|
|
10
10
|
return true;
|
|
11
11
|
}
|
|
12
12
|
// 比较基本 props
|
|
13
|
-
if (prevProps.
|
|
13
|
+
if (prevProps.children !== nextProps.children || prevProps.comment !== nextProps.comment) {
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
16
|
// 比较 leaf 对象的关键属性
|
|
@@ -28,7 +28,7 @@ import { CommentView } from "../Comment";
|
|
|
28
28
|
* CommentLeaf 组件:专门处理 comment(评论)类型的叶子节点
|
|
29
29
|
* 这是一个包装器组件,用于包裹需要显示评论的 DOM 元素
|
|
30
30
|
*/ var CommentLeafComponent = function(param) {
|
|
31
|
-
var children = param.children, leaf = param.leaf,
|
|
31
|
+
var children = param.children, leaf = param.leaf, comment = param.comment;
|
|
32
32
|
var setShowComment = useEditorStore().setShowComment;
|
|
33
33
|
// 使用 useMemo 优化计算逻辑(必须在所有条件返回之前调用)
|
|
34
34
|
var commentId = useMemo(function() {
|
|
@@ -42,13 +42,8 @@ import { CommentView } from "../Comment";
|
|
|
42
42
|
leaf === null || leaf === void 0 ? void 0 : leaf.comment,
|
|
43
43
|
leaf === null || leaf === void 0 ? void 0 : leaf.data
|
|
44
44
|
]);
|
|
45
|
-
debugInfo('CommentLeaf - 渲染评论节点', {
|
|
46
|
-
hasComment: !!leaf.comment,
|
|
47
|
-
commentId: leaf === null || leaf === void 0 ? void 0 : leaf.id
|
|
48
|
-
});
|
|
49
45
|
// 如果没有评论,直接返回子元素
|
|
50
46
|
if (!leaf.comment) {
|
|
51
|
-
debugInfo('CommentLeaf - 无评论,直接返回子元素');
|
|
52
47
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, children);
|
|
53
48
|
}
|
|
54
49
|
debugInfo('CommentLeaf - 返回带评论的 DOM', {
|
|
@@ -59,7 +54,6 @@ import { CommentView } from "../Comment";
|
|
|
59
54
|
return /*#__PURE__*/ React.createElement(CommentView, {
|
|
60
55
|
id: commentId,
|
|
61
56
|
comment: comment,
|
|
62
|
-
hashId: hashId,
|
|
63
57
|
selection: leaf === null || leaf === void 0 ? void 0 : leaf.selection,
|
|
64
58
|
commentItem: commentItem,
|
|
65
59
|
setShowComment: setShowComment
|
|
@@ -2,7 +2,6 @@ import React, { CSSProperties } from 'react';
|
|
|
2
2
|
import { RenderLeafProps } from 'slate-react';
|
|
3
3
|
import { MarkdownEditorProps } from '../../../types';
|
|
4
4
|
interface FncLeafProps extends RenderLeafProps {
|
|
5
|
-
hashId: string;
|
|
6
5
|
fncProps: MarkdownEditorProps['fncProps'];
|
|
7
6
|
linkConfig?: MarkdownEditorProps['linkConfig'];
|
|
8
7
|
style?: CSSProperties;
|
|
@@ -11,5 +10,5 @@ interface FncLeafProps extends RenderLeafProps {
|
|
|
11
10
|
/**
|
|
12
11
|
* FncLeaf 组件:专门处理 fnc(函数调用)和 fnd(函数定义)类型的叶子节点
|
|
13
12
|
*/
|
|
14
|
-
export declare const FncLeaf: ({ attributes, children, leaf,
|
|
13
|
+
export declare const FncLeaf: ({ attributes, children, leaf, fncProps, linkConfig, style, prefixClassName, }: FncLeafProps) => React.JSX.Element;
|
|
15
14
|
export {};
|
|
@@ -54,30 +54,21 @@ import { ConfigProvider } from "antd";
|
|
|
54
54
|
import classNames from "classnames";
|
|
55
55
|
import React, { useCallback, useContext, useMemo } from "react";
|
|
56
56
|
import { isMobileDevice } from "../../../../MarkdownInputField/AttachmentButton/utils";
|
|
57
|
-
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
58
57
|
import { dragStart } from "../index";
|
|
59
58
|
/**
|
|
60
59
|
* FncLeaf 组件:专门处理 fnc(函数调用)和 fnd(函数定义)类型的叶子节点
|
|
61
60
|
*/ export var FncLeaf = function(param) {
|
|
62
|
-
var attributes = param.attributes, children = param.children, leaf = param.leaf,
|
|
63
|
-
var _leaf_text;
|
|
61
|
+
var attributes = param.attributes, children = param.children, leaf = param.leaf, fncProps = param.fncProps, linkConfig = param.linkConfig, _param_style = param.style, style = _param_style === void 0 ? {} : _param_style, _param_prefixClassName = param.prefixClassName, prefixClassName = _param_prefixClassName === void 0 ? '' : _param_prefixClassName;
|
|
64
62
|
var context = useContext(ConfigProvider.ConfigContext);
|
|
65
63
|
var mdEditorBaseClass = context === null || context === void 0 ? void 0 : context.getPrefixCls('agentic-md-editor-content');
|
|
66
64
|
var isMobile = isMobileDevice();
|
|
67
65
|
var hasFnc = leaf.fnc || leaf.identifier;
|
|
68
|
-
debugInfo('FncLeaf - 渲染 fnc 节点', {
|
|
69
|
-
hasFnc: !!leaf.fnc,
|
|
70
|
-
hasIdentifier: !!leaf.identifier,
|
|
71
|
-
hasFnd: !!leaf.fnd,
|
|
72
|
-
text: (_leaf_text = leaf.text) === null || _leaf_text === void 0 ? void 0 : _leaf_text.substring(0, 50)
|
|
73
|
-
});
|
|
74
66
|
// 使用 useMemo 优化 className 计算
|
|
75
67
|
var fncClassName = useMemo(function() {
|
|
76
68
|
var _obj;
|
|
77
|
-
return classNames(prefixClassName === null || prefixClassName === void 0 ? void 0 : prefixClassName.trim(),
|
|
69
|
+
return classNames(prefixClassName === null || prefixClassName === void 0 ? void 0 : prefixClassName.trim(), (_obj = {}, _define_property(_obj, "".concat(mdEditorBaseClass, "-fnc"), leaf.fnc), _define_property(_obj, "".concat(mdEditorBaseClass, "-fnd"), leaf.fnd), _obj));
|
|
78
70
|
}, [
|
|
79
71
|
prefixClassName,
|
|
80
|
-
hashId,
|
|
81
72
|
mdEditorBaseClass,
|
|
82
73
|
leaf.fnc,
|
|
83
74
|
leaf.fnd
|
|
@@ -121,15 +112,8 @@ import { dragStart } from "../index";
|
|
|
121
112
|
]);
|
|
122
113
|
// 使用 useCallback 优化 onClick 处理函数
|
|
123
114
|
var handleClick = useCallback(function(e) {
|
|
124
|
-
debugInfo('FncLeaf - onClick 事件', {
|
|
125
|
-
isMobile: isMobile,
|
|
126
|
-
hasFnc: hasFnc,
|
|
127
|
-
detail: e.detail,
|
|
128
|
-
hasUrl: !!leaf.url
|
|
129
|
-
});
|
|
130
115
|
// 在手机上,如果是 fnc,阻止点击事件(使用长按代替)
|
|
131
116
|
if (isMobile && hasFnc) {
|
|
132
|
-
debugInfo('FncLeaf - 移动端阻止 fnc 点击');
|
|
133
117
|
e.preventDefault();
|
|
134
118
|
return;
|
|
135
119
|
}
|
|
@@ -137,29 +121,19 @@ import { dragStart } from "../index";
|
|
|
137
121
|
e.preventDefault();
|
|
138
122
|
e.stopPropagation();
|
|
139
123
|
if (fncProps === null || fncProps === void 0 ? void 0 : fncProps.onOriginUrlClick) {
|
|
140
|
-
debugInfo('FncLeaf - 触发 fnc 点击');
|
|
141
124
|
fncProps.onOriginUrlClick(leaf === null || leaf === void 0 ? void 0 : leaf.identifier);
|
|
142
125
|
}
|
|
143
126
|
// 如果同时有 URL,也要处理 URL 打开逻辑
|
|
144
127
|
if (leaf.url) {
|
|
145
128
|
if (linkConfig === null || linkConfig === void 0 ? void 0 : linkConfig.onClick) {
|
|
146
129
|
var res = linkConfig.onClick(leaf.url);
|
|
147
|
-
debugInfo('FncLeaf - 链接点击处理', {
|
|
148
|
-
result: res
|
|
149
|
-
});
|
|
150
130
|
if (res === false) {
|
|
151
131
|
return false;
|
|
152
132
|
}
|
|
153
133
|
}
|
|
154
134
|
if ((linkConfig === null || linkConfig === void 0 ? void 0 : linkConfig.openInNewTab) !== false) {
|
|
155
|
-
debugInfo('FncLeaf - 新标签页打开链接', {
|
|
156
|
-
url: leaf.url
|
|
157
|
-
});
|
|
158
135
|
window.open(leaf.url, '_blank');
|
|
159
136
|
} else {
|
|
160
|
-
debugInfo('FncLeaf - 当前窗口打开链接', {
|
|
161
|
-
url: leaf.url
|
|
162
|
-
});
|
|
163
137
|
window.location.href = leaf.url;
|
|
164
138
|
}
|
|
165
139
|
}
|
|
@@ -196,10 +170,6 @@ import { dragStart } from "../index";
|
|
|
196
170
|
// 如果提供了自定义渲染函数,使用它
|
|
197
171
|
if ((fncProps === null || fncProps === void 0 ? void 0 : fncProps.render) && (leaf.fnc || leaf.identifier)) {
|
|
198
172
|
var _fncProps_render;
|
|
199
|
-
debugInfo('FncLeaf - 使用 fnc 自定义渲染', {
|
|
200
|
-
hasFnc: !!leaf.fnc,
|
|
201
|
-
hasIdentifier: !!leaf.identifier
|
|
202
|
-
});
|
|
203
173
|
dom = /*#__PURE__*/ React.createElement(React.Fragment, null, (_fncProps_render = fncProps.render) === null || _fncProps_render === void 0 ? void 0 : _fncProps_render.call(fncProps, _object_spread_props(_object_spread({}, leaf), {
|
|
204
174
|
children: customRenderChildren
|
|
205
175
|
}), dom));
|
package/dist/MarkdownEditor/editor/elements/FootnoteDefinition/ReadonlyFootnoteDefinition.js
CHANGED
|
@@ -86,16 +86,9 @@ import { useEditorStore } from "../../store";
|
|
|
86
86
|
* - 使用 React.memo 优化性能
|
|
87
87
|
* - 保持预览模式的视觉效果
|
|
88
88
|
*/ export var ReadonlyFootnoteDefinition = /*#__PURE__*/ React.memo(function(props) {
|
|
89
|
-
debugInfo('ReadonlyFootnoteDefinition - 渲染只读脚注定义', {
|
|
90
|
-
identifier: props.element.identifier,
|
|
91
|
-
url: props.element.url
|
|
92
|
-
});
|
|
93
89
|
var store = useEditorStore().store;
|
|
94
90
|
var element = props.element;
|
|
95
91
|
useMemo(function() {
|
|
96
|
-
debugInfo('ReadonlyFootnoteDefinition - 更新脚注定义映射', {
|
|
97
|
-
identifier: element.identifier
|
|
98
|
-
});
|
|
99
92
|
store.footnoteDefinitionMap = store.footnoteDefinitionMap.set(element.identifier, element);
|
|
100
93
|
}, [
|
|
101
94
|
element
|
|
@@ -89,7 +89,6 @@ export var FootnoteDefinition = function(props) {
|
|
|
89
89
|
"data-drag-el": true,
|
|
90
90
|
className: !str ? 'empty' : undefined,
|
|
91
91
|
onDragStart: function(e) {
|
|
92
|
-
debugInfo('FootnoteDefinition - 拖拽开始');
|
|
93
92
|
store.dragStart(e, markdownContainerRef.current);
|
|
94
93
|
}
|
|
95
94
|
}), /*#__PURE__*/ React.createElement(DragHandle, null), element.identifier, ".", /*#__PURE__*/ React.createElement("span", {
|
|
@@ -84,9 +84,6 @@ import { debugInfo } from "../../../../Utils/debugUtils";
|
|
|
84
84
|
* - 使用 React.memo 优化性能
|
|
85
85
|
* - 保持预览模式的视觉效果
|
|
86
86
|
*/ export var ReadonlyFootnoteReference = /*#__PURE__*/ React.memo(function(props) {
|
|
87
|
-
debugInfo('ReadonlyFootnoteReference - 渲染只读脚注引用', {
|
|
88
|
-
identifier: props.element.identifier
|
|
89
|
-
});
|
|
90
87
|
var str = Node.string(props.element);
|
|
91
88
|
debugInfo('ReadonlyFootnoteReference - 渲染', {
|
|
92
89
|
identifier: props.element.identifier,
|
|
@@ -121,7 +121,6 @@ export var FootnoteReference = function(props) {
|
|
|
121
121
|
"data-drag-el": true,
|
|
122
122
|
className: !str ? 'empty' : undefined,
|
|
123
123
|
onDragStart: function(e) {
|
|
124
|
-
debugInfo('FootnoteReference - 拖拽开始');
|
|
125
124
|
store.dragStart(e, markdownContainerRef.current);
|
|
126
125
|
},
|
|
127
126
|
"data-empty": !str && selected ? 'true' : undefined
|
|
@@ -95,10 +95,6 @@ import { slugify } from "../../utils/dom";
|
|
|
95
95
|
align: element.align
|
|
96
96
|
});
|
|
97
97
|
var str = Node.string(element);
|
|
98
|
-
debugInfo('ReadonlyHead - 渲染', {
|
|
99
|
-
level: element.level,
|
|
100
|
-
str: str === null || str === void 0 ? void 0 : str.substring(0, 50)
|
|
101
|
-
});
|
|
102
98
|
var _obj;
|
|
103
99
|
return /*#__PURE__*/ createElement("h".concat(element.level), _object_spread_props(_object_spread({}, attributes), (_obj = {
|
|
104
100
|
id: slugify(str)
|
|
@@ -116,19 +116,10 @@ export function Head(param) {
|
|
|
116
116
|
var _useSelStatus = _sliced_to_array(useSelStatus(element), 2), selected = _useSelStatus[0], path = _useSelStatus[1];
|
|
117
117
|
var str = Node.string(element);
|
|
118
118
|
return React.useMemo(function() {
|
|
119
|
-
debugInfo('Head - useMemo 渲染', {
|
|
120
|
-
level: element.level,
|
|
121
|
-
selected: selected,
|
|
122
|
-
path: path,
|
|
123
|
-
str: str === null || str === void 0 ? void 0 : str.substring(0, 50)
|
|
124
|
-
});
|
|
125
119
|
var _obj;
|
|
126
120
|
return /*#__PURE__*/ createElement("h".concat(element.level), _object_spread_props(_object_spread({}, attributes), (_obj = {
|
|
127
121
|
id: slugify(str)
|
|
128
122
|
}, _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) {
|
|
129
|
-
debugInfo('Head - 拖拽开始', {
|
|
130
|
-
level: element.level
|
|
131
|
-
});
|
|
132
123
|
store.dragStart(e, markdownContainerRef.current);
|
|
133
124
|
}), _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, "style", {
|
|
134
125
|
textAlign: element.align
|
|
@@ -51,7 +51,6 @@ function _object_spread_props(target, source) {
|
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
53
|
import React from "react";
|
|
54
|
-
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
55
54
|
/**
|
|
56
55
|
* ReadonlyHr 组件 - 只读分割线预览组件
|
|
57
56
|
*
|
|
@@ -80,7 +79,6 @@ import { debugInfo } from "../../../../Utils/debugUtils";
|
|
|
80
79
|
* - 保持预览模式的视觉效果
|
|
81
80
|
*/ export var ReadonlyHr = /*#__PURE__*/ React.memo(function(param) {
|
|
82
81
|
var attributes = param.attributes, children = param.children;
|
|
83
|
-
debugInfo('ReadonlyHr - 渲染只读分割线');
|
|
84
82
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
|
|
85
83
|
contentEditable: false,
|
|
86
84
|
className: 'select-none',
|
|
@@ -51,10 +51,8 @@ function _object_spread_props(target, source) {
|
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
53
|
import React from "react";
|
|
54
|
-
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
55
54
|
export var Hr = function(param) {
|
|
56
55
|
var attributes = param.attributes, children = param.children;
|
|
57
|
-
debugInfo('Hr - 渲染分割线');
|
|
58
56
|
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
|
|
59
57
|
contentEditable: false,
|
|
60
58
|
className: 'select-none',
|
|
@@ -264,12 +264,12 @@ import { BlockOutlined, DeleteFilled, LoadingOutlined } from "@ant-design/icons"
|
|
|
264
264
|
import { Image, Modal, Popover, Skeleton, Space } from "antd";
|
|
265
265
|
import React, { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
266
266
|
import { useRefFunction } from "../../../../Hooks/useRefFunction";
|
|
267
|
-
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
268
267
|
import { useDebounceFn } from "@ant-design/pro-components";
|
|
269
268
|
import { Rnd } from "react-rnd";
|
|
270
269
|
import { Path, Transforms } from "slate";
|
|
271
270
|
import { ActionIconBox } from "../../../../Components/ActionIconBox";
|
|
272
271
|
import { I18nContext } from "../../../../I18n";
|
|
272
|
+
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
273
273
|
import { useSelStatus } from "../../../hooks/editor";
|
|
274
274
|
import { MediaErrorLink } from "../../components/MediaErrorLink";
|
|
275
275
|
import { useEditorStore } from "../../store";
|
|
@@ -456,14 +456,7 @@ export var ReadonlyImage = function(param) {
|
|
|
456
456
|
};
|
|
457
457
|
export function EditorImage(param) {
|
|
458
458
|
var element = param.element, attributes = param.attributes, children = param.children;
|
|
459
|
-
var
|
|
460
|
-
debugInfo('EditorImage - 渲染图片', {
|
|
461
|
-
url: element === null || element === void 0 ? void 0 : (_element_url = element.url) === null || _element_url === void 0 ? void 0 : _element_url.substring(0, 100),
|
|
462
|
-
alt: element === null || element === void 0 ? void 0 : element.alt,
|
|
463
|
-
width: element === null || element === void 0 ? void 0 : element.width,
|
|
464
|
-
height: element === null || element === void 0 ? void 0 : element.height,
|
|
465
|
-
finished: element === null || element === void 0 ? void 0 : element.finished
|
|
466
|
-
});
|
|
459
|
+
var _state;
|
|
467
460
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
468
461
|
var _useSelStatus = _sliced_to_array(useSelStatus(element), 2), _ = _useSelStatus[0], path = _useSelStatus[1];
|
|
469
462
|
var markdownEditorRef = useEditorStore().markdownEditorRef;
|
|
@@ -506,23 +499,17 @@ export function EditorImage(param) {
|
|
|
506
499
|
setState({
|
|
507
500
|
url: realUrl
|
|
508
501
|
});
|
|
509
|
-
debugInfo('EditorImage - 设置图片类型和URL', {
|
|
510
|
-
type: state().type,
|
|
511
|
-
url: realUrl === null || realUrl === void 0 ? void 0 : realUrl.substring(0, 100)
|
|
512
|
-
});
|
|
513
502
|
if (state().type === 'image' || state().type === 'other') {
|
|
514
503
|
img = document.createElement('img');
|
|
515
504
|
img.referrerPolicy = 'no-referrer';
|
|
516
505
|
img.crossOrigin = 'anonymous';
|
|
517
506
|
img.src = realUrl;
|
|
518
507
|
img.onerror = function() {
|
|
519
|
-
debugInfo('EditorImage - 图片加载失败');
|
|
520
508
|
setState({
|
|
521
509
|
loadSuccess: false
|
|
522
510
|
});
|
|
523
511
|
};
|
|
524
512
|
img.onload = function() {
|
|
525
|
-
debugInfo('EditorImage - 图片加载成功');
|
|
526
513
|
setState({
|
|
527
514
|
loadSuccess: true
|
|
528
515
|
});
|
|
@@ -562,16 +549,10 @@ export function EditorImage(param) {
|
|
|
562
549
|
]);
|
|
563
550
|
var imageDom = useMemo(function() {
|
|
564
551
|
var _state;
|
|
565
|
-
debugInfo('EditorImage - 生成图片 DOM', {
|
|
566
|
-
finished: element.finished,
|
|
567
|
-
showAsText: showAsText,
|
|
568
|
-
loadSuccess: state().loadSuccess
|
|
569
|
-
});
|
|
570
552
|
// 检查是否为不完整的图片(finished 状态)
|
|
571
553
|
if (element.finished === false) {
|
|
572
554
|
// 如果 5 秒后仍未完成,显示为文本
|
|
573
555
|
if (showAsText) {
|
|
574
|
-
debugInfo('EditorImage - 显示为文本(超时)');
|
|
575
556
|
return /*#__PURE__*/ React.createElement("div", {
|
|
576
557
|
style: {
|
|
577
558
|
padding: '8px 12px',
|
|
@@ -583,7 +564,6 @@ export function EditorImage(param) {
|
|
|
583
564
|
}, element.alt || element.url || '图片链接');
|
|
584
565
|
}
|
|
585
566
|
// 5 秒内显示 loading 状态的占位符
|
|
586
|
-
debugInfo('EditorImage - 显示加载占位符');
|
|
587
567
|
return /*#__PURE__*/ React.createElement(Skeleton.Image, {
|
|
588
568
|
active: true
|
|
589
569
|
});
|
|
@@ -591,7 +571,6 @@ export function EditorImage(param) {
|
|
|
591
571
|
// 如果图片加载失败,显示为链接
|
|
592
572
|
if (!state().loadSuccess) {
|
|
593
573
|
var _state1, _state2;
|
|
594
|
-
debugInfo('EditorImage - 显示错误链接');
|
|
595
574
|
return /*#__PURE__*/ React.createElement(MediaErrorLink, {
|
|
596
575
|
url: (_state1 = state()) === null || _state1 === void 0 ? void 0 : _state1.url,
|
|
597
576
|
fallbackUrl: element === null || element === void 0 ? void 0 : element.url,
|
|
@@ -603,10 +582,6 @@ export function EditorImage(param) {
|
|
|
603
582
|
});
|
|
604
583
|
}
|
|
605
584
|
// 编辑模式:使用可调整大小的图片
|
|
606
|
-
debugInfo('EditorImage - 使用可调整大小的图片', {
|
|
607
|
-
width: element.width,
|
|
608
|
-
height: element.height
|
|
609
|
-
});
|
|
610
585
|
return /*#__PURE__*/ React.createElement(ResizeImage, {
|
|
611
586
|
defaultSize: {
|
|
612
587
|
width: Number(element.width) || element.width || 400,
|
|
@@ -615,15 +590,11 @@ export function EditorImage(param) {
|
|
|
615
590
|
selected: state().selected,
|
|
616
591
|
src: (_state = state()) === null || _state === void 0 ? void 0 : _state.url,
|
|
617
592
|
onResizeStart: function() {
|
|
618
|
-
debugInfo('EditorImage - 开始调整大小');
|
|
619
593
|
setState({
|
|
620
594
|
selected: true
|
|
621
595
|
});
|
|
622
596
|
},
|
|
623
597
|
onResizeStop: function(size) {
|
|
624
|
-
debugInfo('EditorImage - 调整大小完成', {
|
|
625
|
-
size: size
|
|
626
|
-
});
|
|
627
598
|
if (!(markdownEditorRef === null || markdownEditorRef === void 0 ? void 0 : markdownEditorRef.current)) return;
|
|
628
599
|
Transforms.setNodes(markdownEditorRef.current, size, {
|
|
629
600
|
at: path
|
|
@@ -51,7 +51,6 @@ function _object_spread_props(target, source) {
|
|
|
51
51
|
return target;
|
|
52
52
|
}
|
|
53
53
|
import React from "react";
|
|
54
|
-
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
55
54
|
/**
|
|
56
55
|
* ReadonlyInlineKatex 组件 - 只读行内数学公式预览组件
|
|
57
56
|
*
|
|
@@ -82,10 +81,6 @@ import { debugInfo } from "../../../../Utils/debugUtils";
|
|
|
82
81
|
* - 保持预览模式的视觉效果
|
|
83
82
|
*/ export var ReadonlyInlineKatex = /*#__PURE__*/ React.memo(function(param) {
|
|
84
83
|
var attributes = param.attributes, children = param.children, element = param.element;
|
|
85
|
-
var _element_value;
|
|
86
|
-
debugInfo('ReadonlyInlineKatex - 渲染只读行内数学公式', {
|
|
87
|
-
valueLength: element === null || element === void 0 ? void 0 : (_element_value = element.value) === null || _element_value === void 0 ? void 0 : _element_value.length
|
|
88
|
-
});
|
|
89
84
|
return /*#__PURE__*/ React.createElement("code", _object_spread_props(_object_spread({}, attributes), {
|
|
90
85
|
style: {
|
|
91
86
|
background: 'rgb(242, 241, 241)',
|