Skip to content

Commit 173b369

Browse files
committed
fix: 优化配置对象的处理逻辑,确保兼容性和稳定性
1 parent 17f1563 commit 173b369

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ const parseTableOrChart = (table: Table, preNode: RootContent): CardNode => {
218218
}) as TableRowNode[];
219219

220220
const otherProps = {
221-
...config,
221+
...(config.config ? config : { config }),
222222
columns,
223223
dataSource: dataSource.map((item) => {
224224
delete item?.chartType;

src/plugins/chart/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ export const ChartElement: React.FC<RenderElementProps> = (props) => {
131131
const columns = (node as TableNode).otherProps?.columns || [];
132132

133133
const [columnLength, setColumnLength] = React.useState(2);
134-
135134
const config = [node.otherProps?.config || node.otherProps].flat(1);
136135
const htmlRef = React.useRef<HTMLDivElement>(null);
137136
const [minWidth, setMinWidth] = React.useState(256);
@@ -282,6 +281,7 @@ export const ChartElement: React.FC<RenderElementProps> = (props) => {
282281
return dom;
283282
});
284283
}
284+
285285
return (
286286
<ChartRender
287287
key={index}

0 commit comments

Comments
 (0)