@ant-design/agentic-ui 2.29.7 → 2.29.8
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/components/FooterBackgroundLottie/index.js +1 -1
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Blockquote/ReadonlyBlockquote.d.ts +33 -0
- package/dist/MarkdownEditor/editor/elements/Blockquote/ReadonlyBlockquote.js +69 -0
- package/dist/MarkdownEditor/editor/elements/Break/ReadonlyBreak.d.ts +30 -0
- package/dist/MarkdownEditor/editor/elements/Break/ReadonlyBreak.js +88 -0
- package/dist/MarkdownEditor/editor/elements/Card/ReadonlyCard.d.ts +34 -0
- package/dist/MarkdownEditor/editor/elements/Card/ReadonlyCard.js +96 -0
- package/dist/MarkdownEditor/editor/elements/Code/ReadonlyCode.d.ts +33 -0
- package/dist/MarkdownEditor/editor/elements/Code/ReadonlyCode.js +145 -0
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition/ReadonlyFootnoteDefinition.d.ts +34 -0
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition/ReadonlyFootnoteDefinition.js +125 -0
- package/dist/MarkdownEditor/editor/elements/FootnoteReference/ReadonlyFootnoteReference.d.ts +34 -0
- package/dist/MarkdownEditor/editor/elements/FootnoteReference/ReadonlyFootnoteReference.js +101 -0
- package/dist/MarkdownEditor/editor/elements/Head/ReadonlyHead.d.ts +35 -0
- package/dist/MarkdownEditor/editor/elements/Head/ReadonlyHead.js +111 -0
- package/dist/MarkdownEditor/editor/elements/Head/index.d.ts +3 -0
- package/dist/MarkdownEditor/editor/elements/Head/index.js +3 -1
- package/dist/MarkdownEditor/editor/elements/Hr/ReadonlyHr.d.ts +30 -0
- package/dist/MarkdownEditor/editor/elements/Hr/ReadonlyHr.js +95 -0
- package/dist/MarkdownEditor/editor/elements/Image/ReadonlyEditorImage.d.ts +35 -0
- package/dist/MarkdownEditor/editor/elements/Image/ReadonlyEditorImage.js +426 -0
- package/dist/MarkdownEditor/editor/elements/Image/index.js +38 -50
- package/dist/MarkdownEditor/editor/elements/InlineKatex/ReadonlyInlineKatex.d.ts +32 -0
- package/dist/MarkdownEditor/editor/elements/InlineKatex/ReadonlyInlineKatex.js +100 -0
- package/dist/MarkdownEditor/editor/elements/Katex/ReadonlyKatex.d.ts +32 -0
- package/dist/MarkdownEditor/editor/elements/Katex/ReadonlyKatex.js +110 -0
- package/dist/MarkdownEditor/editor/elements/LinkCard/ReadonlyLinkCard.d.ts +40 -0
- package/dist/MarkdownEditor/editor/elements/LinkCard/ReadonlyLinkCard.js +215 -0
- package/dist/MarkdownEditor/editor/elements/List/List.js +27 -12
- package/dist/MarkdownEditor/editor/elements/List/ReadonlyList.d.ts +33 -0
- package/dist/MarkdownEditor/editor/elements/List/ReadonlyList.js +93 -0
- package/dist/MarkdownEditor/editor/elements/List/ReadonlyListItem.d.ts +35 -0
- package/dist/MarkdownEditor/editor/elements/List/ReadonlyListItem.js +138 -0
- package/dist/MarkdownEditor/editor/elements/Media/ReadonlyMedia.d.ts +36 -0
- package/dist/MarkdownEditor/editor/elements/Media/ReadonlyMedia.js +600 -0
- package/dist/MarkdownEditor/editor/elements/Mermaid/ReadonlyMermaid.d.ts +32 -0
- package/dist/MarkdownEditor/editor/elements/Mermaid/ReadonlyMermaid.js +101 -0
- package/dist/MarkdownEditor/editor/elements/Paragraph/ReadonlyParagraph.d.ts +35 -0
- package/dist/MarkdownEditor/editor/elements/Paragraph/ReadonlyParagraph.js +109 -0
- package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +2 -1
- package/dist/MarkdownEditor/editor/elements/Schema/ReadonlySchema.d.ts +33 -0
- package/dist/MarkdownEditor/editor/elements/Schema/ReadonlySchema.js +163 -0
- package/dist/MarkdownEditor/editor/elements/index.d.ts +20 -1
- package/dist/MarkdownEditor/editor/elements/index.js +65 -29
- package/dist/MarkdownEditor/editor/parser/parse/parseBlockElements.js +18 -10
- package/dist/MarkdownEditor/editor/parser/parserSlateNodeToMarkdown.js +64 -21
- package/dist/MarkdownEditor/editor/plugins/elements.js +60 -6
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/backspace.js +97 -39
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/tab.d.ts +14 -0
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/tab.js +117 -90
- package/dist/MarkdownEditor/editor/plugins/index.d.ts +8 -0
- package/dist/MarkdownEditor/editor/plugins/index.js +8 -0
- package/dist/MarkdownEditor/editor/plugins/insertParsedHtmlNodes.d.ts +12 -6
- package/dist/MarkdownEditor/editor/plugins/insertParsedHtmlNodes.js +67 -42
- package/dist/MarkdownEditor/editor/plugins/utils.d.ts +31 -0
- package/dist/MarkdownEditor/editor/plugins/utils.js +75 -0
- package/dist/MarkdownEditor/editor/plugins/withCardPlugin.d.ts +15 -0
- package/dist/MarkdownEditor/editor/plugins/withCardPlugin.js +329 -0
- package/dist/MarkdownEditor/editor/plugins/withCodeTagPlugin.d.ts +11 -0
- package/dist/MarkdownEditor/editor/plugins/withCodeTagPlugin.js +299 -0
- package/dist/MarkdownEditor/editor/plugins/withInlineNodes.d.ts +12 -0
- package/dist/MarkdownEditor/editor/plugins/withInlineNodes.js +17 -0
- package/dist/MarkdownEditor/editor/plugins/withLinkAndMediaPlugin.d.ts +11 -0
- package/dist/MarkdownEditor/editor/plugins/withLinkAndMediaPlugin.js +70 -0
- package/dist/MarkdownEditor/editor/plugins/withListsPlugin.d.ts +23 -0
- package/dist/MarkdownEditor/editor/plugins/withListsPlugin.js +204 -0
- package/dist/MarkdownEditor/editor/plugins/withMarkdown.d.ts +9 -12
- package/dist/MarkdownEditor/editor/plugins/withMarkdown.js +17 -764
- package/dist/MarkdownEditor/editor/plugins/withSchemaPlugin.d.ts +11 -0
- package/dist/MarkdownEditor/editor/plugins/withSchemaPlugin.js +55 -0
- package/dist/MarkdownEditor/editor/plugins/withVoidNodes.d.ts +12 -0
- package/dist/MarkdownEditor/editor/plugins/withVoidNodes.js +17 -0
- package/dist/MarkdownEditor/editor/store.js +1 -1
- package/dist/MarkdownEditor/editor/utils/docx/module.js +41 -8
- package/dist/MarkdownEditor/editor/utils/editorCommands.d.ts +97 -0
- package/dist/MarkdownEditor/editor/utils/editorCommands.js +966 -0
- package/dist/MarkdownEditor/editor/utils/editorUtils.js +2 -2
- package/dist/MarkdownEditor/editor/utils/keyboard.js +15 -391
- package/dist/MarkdownEditor/el.d.ts +12 -5
- package/dist/MarkdownInputField/MarkdownInputField.js +10 -23
- package/dist/MarkdownInputField/style.js +9 -4
- package/package.json +8 -8
|
@@ -312,7 +312,7 @@ var composeEditors = function(editor, plugins) {
|
|
|
312
312
|
if (item.type === 'p' && item.children.length === 0) {
|
|
313
313
|
return false;
|
|
314
314
|
}
|
|
315
|
-
if (item.type === 'list' && item.children.length === 0) {
|
|
315
|
+
if ((item.type === 'list' || item.type === 'bulleted-list' || item.type === 'numbered-list') && item.children.length === 0) {
|
|
316
316
|
return false;
|
|
317
317
|
}
|
|
318
318
|
if (item.type === 'listItem' && item.children.length === 0) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BlockQuoteNode, ElementProps } from '../../../el';
|
|
3
|
+
/**
|
|
4
|
+
* ReadonlyBlockquote 组件 - 只读引用块预览组件
|
|
5
|
+
*
|
|
6
|
+
* 专门针对 readonly 模式优化的引用块组件,移除了拖拽功能。
|
|
7
|
+
* 简化渲染逻辑,提升预览模式性能。
|
|
8
|
+
*
|
|
9
|
+
* @component
|
|
10
|
+
* @description 只读引用块预览组件,用于预览模式下的引用块渲染
|
|
11
|
+
* @param {ElementProps<BlockQuoteNode>} props - 组件属性
|
|
12
|
+
* @param {BlockQuoteNode} props.element - 引用块节点元素
|
|
13
|
+
* @param {React.ReactNode} props.children - 子组件内容
|
|
14
|
+
* @param {Object} props.attributes - 元素属性
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <ReadonlyBlockquote
|
|
19
|
+
* element={blockquoteNode}
|
|
20
|
+
* attributes={attributes}
|
|
21
|
+
* >
|
|
22
|
+
* 引用内容
|
|
23
|
+
* </ReadonlyBlockquote>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @returns {React.ReactElement} 渲染的只读引用块组件
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* - 移除拖拽相关事件处理
|
|
30
|
+
* - 使用 React.memo 优化性能
|
|
31
|
+
* - 保持预览模式的视觉效果
|
|
32
|
+
*/
|
|
33
|
+
export declare const ReadonlyBlockquote: React.FC<ElementProps<BlockQuoteNode>>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
import React from "react";
|
|
30
|
+
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
31
|
+
/**
|
|
32
|
+
* ReadonlyBlockquote 组件 - 只读引用块预览组件
|
|
33
|
+
*
|
|
34
|
+
* 专门针对 readonly 模式优化的引用块组件,移除了拖拽功能。
|
|
35
|
+
* 简化渲染逻辑,提升预览模式性能。
|
|
36
|
+
*
|
|
37
|
+
* @component
|
|
38
|
+
* @description 只读引用块预览组件,用于预览模式下的引用块渲染
|
|
39
|
+
* @param {ElementProps<BlockQuoteNode>} props - 组件属性
|
|
40
|
+
* @param {BlockQuoteNode} props.element - 引用块节点元素
|
|
41
|
+
* @param {React.ReactNode} props.children - 子组件内容
|
|
42
|
+
* @param {Object} props.attributes - 元素属性
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* <ReadonlyBlockquote
|
|
47
|
+
* element={blockquoteNode}
|
|
48
|
+
* attributes={attributes}
|
|
49
|
+
* >
|
|
50
|
+
* 引用内容
|
|
51
|
+
* </ReadonlyBlockquote>
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @returns {React.ReactElement} 渲染的只读引用块组件
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* - 移除拖拽相关事件处理
|
|
58
|
+
* - 使用 React.memo 优化性能
|
|
59
|
+
* - 保持预览模式的视觉效果
|
|
60
|
+
*/ export var ReadonlyBlockquote = /*#__PURE__*/ React.memo(function(props) {
|
|
61
|
+
var _props_element_children;
|
|
62
|
+
debugInfo('ReadonlyBlockquote - 渲染只读引用块', {
|
|
63
|
+
childrenCount: (_props_element_children = props.element.children) === null || _props_element_children === void 0 ? void 0 : _props_element_children.length
|
|
64
|
+
});
|
|
65
|
+
return /*#__PURE__*/ React.createElement("blockquote", _object_spread({
|
|
66
|
+
"data-be": 'blockquote'
|
|
67
|
+
}, props.attributes), props.children);
|
|
68
|
+
});
|
|
69
|
+
ReadonlyBlockquote.displayName = 'ReadonlyBlockquote';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RenderElementProps } from 'slate-react';
|
|
3
|
+
/**
|
|
4
|
+
* ReadonlyBreak 组件 - 只读换行预览组件
|
|
5
|
+
*
|
|
6
|
+
* 专门针对 readonly 模式优化的换行组件。
|
|
7
|
+
* 简化渲染逻辑,提升预览模式性能。
|
|
8
|
+
*
|
|
9
|
+
* @component
|
|
10
|
+
* @description 只读换行预览组件,用于预览模式下的换行渲染
|
|
11
|
+
* @param {RenderElementProps} props - 组件属性
|
|
12
|
+
* @param {React.ReactNode} props.children - 子组件内容
|
|
13
|
+
* @param {Object} props.attributes - 元素属性
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <ReadonlyBreak
|
|
18
|
+
* attributes={attributes}
|
|
19
|
+
* >
|
|
20
|
+
* 内容
|
|
21
|
+
* </ReadonlyBreak>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @returns {React.ReactElement} 渲染的只读换行组件
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* - 使用 React.memo 优化性能
|
|
28
|
+
* - 保持预览模式的视觉效果
|
|
29
|
+
*/
|
|
30
|
+
export declare const ReadonlyBreak: React.FC<RenderElementProps>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
import React from "react";
|
|
54
|
+
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
55
|
+
/**
|
|
56
|
+
* ReadonlyBreak 组件 - 只读换行预览组件
|
|
57
|
+
*
|
|
58
|
+
* 专门针对 readonly 模式优化的换行组件。
|
|
59
|
+
* 简化渲染逻辑,提升预览模式性能。
|
|
60
|
+
*
|
|
61
|
+
* @component
|
|
62
|
+
* @description 只读换行预览组件,用于预览模式下的换行渲染
|
|
63
|
+
* @param {RenderElementProps} props - 组件属性
|
|
64
|
+
* @param {React.ReactNode} props.children - 子组件内容
|
|
65
|
+
* @param {Object} props.attributes - 元素属性
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* <ReadonlyBreak
|
|
70
|
+
* attributes={attributes}
|
|
71
|
+
* >
|
|
72
|
+
* 内容
|
|
73
|
+
* </ReadonlyBreak>
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @returns {React.ReactElement} 渲染的只读换行组件
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* - 使用 React.memo 优化性能
|
|
80
|
+
* - 保持预览模式的视觉效果
|
|
81
|
+
*/ export var ReadonlyBreak = /*#__PURE__*/ React.memo(function(param) {
|
|
82
|
+
var attributes = param.attributes, children = param.children;
|
|
83
|
+
debugInfo('ReadonlyBreak - 渲染只读换行');
|
|
84
|
+
return /*#__PURE__*/ React.createElement("span", _object_spread_props(_object_spread({}, attributes), {
|
|
85
|
+
contentEditable: false
|
|
86
|
+
}), children, /*#__PURE__*/ React.createElement("br", null));
|
|
87
|
+
});
|
|
88
|
+
ReadonlyBreak.displayName = 'ReadonlyBreak';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RenderElementProps } from 'slate-react';
|
|
3
|
+
/**
|
|
4
|
+
* ReadonlyCard 组件 - 只读卡片预览组件
|
|
5
|
+
*
|
|
6
|
+
* 专门针对 readonly 模式优化的卡片组件,移除了选择状态和交互功能。
|
|
7
|
+
* 简化渲染逻辑,提升预览模式性能。
|
|
8
|
+
*
|
|
9
|
+
* @component
|
|
10
|
+
* @description 只读卡片预览组件,用于预览模式下的卡片渲染
|
|
11
|
+
* @param {RenderElementProps} props - 组件属性
|
|
12
|
+
* @param {any} props.element - 卡片节点元素
|
|
13
|
+
* @param {React.ReactNode} props.children - 子组件内容
|
|
14
|
+
* @param {Object} props.attributes - 元素属性
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <ReadonlyCard
|
|
19
|
+
* element={cardNode}
|
|
20
|
+
* attributes={attributes}
|
|
21
|
+
* >
|
|
22
|
+
* 卡片内容
|
|
23
|
+
* </ReadonlyCard>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @returns {React.ReactElement} 渲染的只读卡片组件
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* - 移除选择状态管理
|
|
30
|
+
* - 移除交互功能(tabIndex、aria-selected 等)
|
|
31
|
+
* - 使用 React.memo 优化性能
|
|
32
|
+
* - 保持预览模式的视觉效果
|
|
33
|
+
*/
|
|
34
|
+
export declare const ReadonlyCard: React.FC<RenderElementProps>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
import React from "react";
|
|
54
|
+
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
55
|
+
/**
|
|
56
|
+
* ReadonlyCard 组件 - 只读卡片预览组件
|
|
57
|
+
*
|
|
58
|
+
* 专门针对 readonly 模式优化的卡片组件,移除了选择状态和交互功能。
|
|
59
|
+
* 简化渲染逻辑,提升预览模式性能。
|
|
60
|
+
*
|
|
61
|
+
* @component
|
|
62
|
+
* @description 只读卡片预览组件,用于预览模式下的卡片渲染
|
|
63
|
+
* @param {RenderElementProps} props - 组件属性
|
|
64
|
+
* @param {any} props.element - 卡片节点元素
|
|
65
|
+
* @param {React.ReactNode} props.children - 子组件内容
|
|
66
|
+
* @param {Object} props.attributes - 元素属性
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```tsx
|
|
70
|
+
* <ReadonlyCard
|
|
71
|
+
* element={cardNode}
|
|
72
|
+
* attributes={attributes}
|
|
73
|
+
* >
|
|
74
|
+
* 卡片内容
|
|
75
|
+
* </ReadonlyCard>
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @returns {React.ReactElement} 渲染的只读卡片组件
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* - 移除选择状态管理
|
|
82
|
+
* - 移除交互功能(tabIndex、aria-selected 等)
|
|
83
|
+
* - 使用 React.memo 优化性能
|
|
84
|
+
* - 保持预览模式的视觉效果
|
|
85
|
+
*/ 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
|
+
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, props.attributes), {
|
|
92
|
+
"data-be": 'card',
|
|
93
|
+
role: "button"
|
|
94
|
+
}), props.children);
|
|
95
|
+
});
|
|
96
|
+
ReadonlyCard.displayName = 'ReadonlyCard';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RenderElementProps } from 'slate-react';
|
|
3
|
+
/**
|
|
4
|
+
* ReadonlyCode 组件 - 只读代码块预览组件
|
|
5
|
+
*
|
|
6
|
+
* 专门针对 readonly 模式优化的代码块组件,移除了编辑相关功能。
|
|
7
|
+
* 简化渲染逻辑,提升预览模式性能。
|
|
8
|
+
*
|
|
9
|
+
* @component
|
|
10
|
+
* @description 只读代码块预览组件,用于预览模式下的代码块渲染
|
|
11
|
+
* @param {RenderElementProps} props - 组件属性
|
|
12
|
+
* @param {any} props.element - 代码块节点元素
|
|
13
|
+
* @param {React.ReactNode} props.children - 子组件内容
|
|
14
|
+
* @param {Object} props.attributes - 元素属性
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <ReadonlyCode
|
|
19
|
+
* element={codeNode}
|
|
20
|
+
* attributes={attributes}
|
|
21
|
+
* >
|
|
22
|
+
* 代码内容
|
|
23
|
+
* </ReadonlyCode>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @returns {React.ReactElement} 渲染的只读代码块组件
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* - 简化渲染逻辑,移除编辑相关功能
|
|
30
|
+
* - 使用 React.memo 优化性能
|
|
31
|
+
* - 保持预览模式的视觉效果
|
|
32
|
+
*/
|
|
33
|
+
export declare const ReadonlyCode: React.FC<RenderElementProps>;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
import DOMPurify from "dompurify";
|
|
54
|
+
import React from "react";
|
|
55
|
+
import { debugInfo } from "../../../../Utils/debugUtils";
|
|
56
|
+
/**
|
|
57
|
+
* ReadonlyCode 组件 - 只读代码块预览组件
|
|
58
|
+
*
|
|
59
|
+
* 专门针对 readonly 模式优化的代码块组件,移除了编辑相关功能。
|
|
60
|
+
* 简化渲染逻辑,提升预览模式性能。
|
|
61
|
+
*
|
|
62
|
+
* @component
|
|
63
|
+
* @description 只读代码块预览组件,用于预览模式下的代码块渲染
|
|
64
|
+
* @param {RenderElementProps} props - 组件属性
|
|
65
|
+
* @param {any} props.element - 代码块节点元素
|
|
66
|
+
* @param {React.ReactNode} props.children - 子组件内容
|
|
67
|
+
* @param {Object} props.attributes - 元素属性
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```tsx
|
|
71
|
+
* <ReadonlyCode
|
|
72
|
+
* element={codeNode}
|
|
73
|
+
* attributes={attributes}
|
|
74
|
+
* >
|
|
75
|
+
* 代码内容
|
|
76
|
+
* </ReadonlyCode>
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @returns {React.ReactElement} 渲染的只读代码块组件
|
|
80
|
+
*
|
|
81
|
+
* @remarks
|
|
82
|
+
* - 简化渲染逻辑,移除编辑相关功能
|
|
83
|
+
* - 使用 React.memo 优化性能
|
|
84
|
+
* - 保持预览模式的视觉效果
|
|
85
|
+
*/ export var ReadonlyCode = /*#__PURE__*/ React.memo(function(param) {
|
|
86
|
+
var attributes = param.attributes, children = param.children, element = param.element;
|
|
87
|
+
var _element_value, _element_otherProps, _element_otherProps1, _element_otherProps2, _element_value1, _element_otherProps3, _element_value2;
|
|
88
|
+
debugInfo('ReadonlyCode - 渲染只读代码块', {
|
|
89
|
+
language: element === null || element === void 0 ? void 0 : element.language,
|
|
90
|
+
valueLength: element === null || element === void 0 ? void 0 : (_element_value = element.value) === null || _element_value === void 0 ? void 0 : _element_value.length,
|
|
91
|
+
isConfig: element === null || element === void 0 ? void 0 : (_element_otherProps = element.otherProps) === null || _element_otherProps === void 0 ? void 0 : _element_otherProps.isConfig,
|
|
92
|
+
finished: element === null || element === void 0 ? void 0 : (_element_otherProps1 = element.otherProps) === null || _element_otherProps1 === void 0 ? void 0 : _element_otherProps1.finished
|
|
93
|
+
});
|
|
94
|
+
// HTML 代码块处理
|
|
95
|
+
if ((element === null || element === void 0 ? void 0 : element.language) === 'html') {
|
|
96
|
+
var _element_otherProps4, _element_otherProps5, _element_otherProps6, _element_value3;
|
|
97
|
+
debugInfo('ReadonlyCode - HTML 代码块', {
|
|
98
|
+
isConfig: element === null || element === void 0 ? void 0 : (_element_otherProps4 = element.otherProps) === null || _element_otherProps4 === void 0 ? void 0 : _element_otherProps4.isConfig
|
|
99
|
+
});
|
|
100
|
+
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
|
|
101
|
+
style: {
|
|
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
|
+
}
|
|
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_value3 = element.value) === null || _element_value3 === void 0 ? void 0 : _element_value3.trim()));
|
|
105
|
+
}
|
|
106
|
+
// 检查代码块是否未闭合
|
|
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
|
+
return /*#__PURE__*/ React.createElement("div", _object_spread_props(_object_spread({}, attributes), {
|
|
114
|
+
"data-is-unclosed": isUnclosed,
|
|
115
|
+
"data-language": element === null || element === void 0 ? void 0 : element.language,
|
|
116
|
+
style: (element === null || element === void 0 ? void 0 : element.language) === 'html' ? {
|
|
117
|
+
display: (element === null || element === void 0 ? void 0 : (_element_otherProps3 = element.otherProps) === null || _element_otherProps3 === void 0 ? void 0 : _element_otherProps3.isConfig) ? 'none' : 'block'
|
|
118
|
+
} : {
|
|
119
|
+
height: '240px',
|
|
120
|
+
minWidth: '398px',
|
|
121
|
+
maxWidth: '800px',
|
|
122
|
+
minHeight: '240px',
|
|
123
|
+
display: 'flex',
|
|
124
|
+
flexDirection: 'column',
|
|
125
|
+
alignItems: 'center',
|
|
126
|
+
alignSelf: 'stretch',
|
|
127
|
+
zIndex: 5,
|
|
128
|
+
color: 'rgb(27, 27, 27)',
|
|
129
|
+
padding: '1em',
|
|
130
|
+
margin: '1em 0',
|
|
131
|
+
fontSize: '0.8em',
|
|
132
|
+
lineHeight: '1.5',
|
|
133
|
+
overflowX: 'auto',
|
|
134
|
+
whiteSpace: 'pre-wrap',
|
|
135
|
+
wordBreak: 'break-all',
|
|
136
|
+
fontFamily: "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",
|
|
137
|
+
wordWrap: 'break-word',
|
|
138
|
+
borderRadius: '12px',
|
|
139
|
+
background: '#FFFFFF',
|
|
140
|
+
boxShadow: 'var(--shadow-control-base)',
|
|
141
|
+
position: 'relative'
|
|
142
|
+
}
|
|
143
|
+
}), (element === null || element === void 0 ? void 0 : (_element_value2 = element.value) === null || _element_value2 === void 0 ? void 0 : _element_value2.trim()) || children);
|
|
144
|
+
});
|
|
145
|
+
ReadonlyCode.displayName = 'ReadonlyCode';
|
package/dist/MarkdownEditor/editor/elements/FootnoteDefinition/ReadonlyFootnoteDefinition.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ElementProps, FootnoteDefinitionNode } from '../../../el';
|
|
3
|
+
/**
|
|
4
|
+
* ReadonlyFootnoteDefinition 组件 - 只读脚注定义预览组件
|
|
5
|
+
*
|
|
6
|
+
* 专门针对 readonly 模式优化的脚注定义组件,移除了拖拽功能。
|
|
7
|
+
* 简化渲染逻辑,提升预览模式性能。
|
|
8
|
+
*
|
|
9
|
+
* @component
|
|
10
|
+
* @description 只读脚注定义预览组件,用于预览模式下的脚注定义渲染
|
|
11
|
+
* @param {ElementProps<FootnoteDefinitionNode>} props - 组件属性
|
|
12
|
+
* @param {FootnoteDefinitionNode} props.element - 脚注定义节点元素
|
|
13
|
+
* @param {React.ReactNode} props.children - 子组件内容
|
|
14
|
+
* @param {Object} props.attributes - 元素属性
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <ReadonlyFootnoteDefinition
|
|
19
|
+
* element={footnoteDefinitionNode}
|
|
20
|
+
* attributes={attributes}
|
|
21
|
+
* >
|
|
22
|
+
* 脚注内容
|
|
23
|
+
* </ReadonlyFootnoteDefinition>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @returns {React.ReactElement} 渲染的只读脚注定义组件
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* - 移除拖拽手柄(DragHandle)
|
|
30
|
+
* - 移除拖拽相关事件处理
|
|
31
|
+
* - 使用 React.memo 优化性能
|
|
32
|
+
* - 保持预览模式的视觉效果
|
|
33
|
+
*/
|
|
34
|
+
export declare const ReadonlyFootnoteDefinition: React.FC<ElementProps<FootnoteDefinitionNode>>;
|