Skip to content

Commit

Permalink
优化图表组件,禁用内容编辑并增加用户选择样式
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Dec 18, 2024
1 parent 36e0c5c commit 53f754f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/MarkdownEditor/editor/elements/chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,9 @@ export const Chart: React.FC<RenderElementProps> = (props) => {
display: 'flex',
flexWrap: 'wrap',
gap: 8,
userSelect: 'none',
}}
contentEditable={false}
onClick={(e) => {
e.stopPropagation();
}}
Expand Down Expand Up @@ -717,12 +719,8 @@ export const Chart: React.FC<RenderElementProps> = (props) => {
style={{
margin: 12,
borderRadius: 16,
border:
// 只有一个图表时不显示边框,用消息框自己的
config.length < 2 &&
store?.editor?.children?.length < 2
? 'none'
: '1px solid #eee',
overflow: 'auto',
border: '1px solid #eee',
}}
>
<table contentEditable={readonly ? false : true}>
Expand Down Expand Up @@ -800,9 +798,16 @@ export const Chart: React.FC<RenderElementProps> = (props) => {
margin: 'auto',
minWidth: 300,
flex: 1,
userSelect: 'none',
}}
contentEditable={false}
>
<div contentEditable={false}>
<div
style={{
userSelect: 'none',
}}
contentEditable={false}
>
<ChartAttr
title={
item.title || config.at(index)?.title || ''
Expand All @@ -828,7 +833,9 @@ export const Chart: React.FC<RenderElementProps> = (props) => {
return (
<div
key={index}
contentEditable={false}
style={{
userSelect: 'none',
border:
// 只有一个图表时不显示边框,用消息框自己的
config.length < 2 &&
Expand All @@ -845,6 +852,9 @@ export const Chart: React.FC<RenderElementProps> = (props) => {
}}
>
<div
style={{
userSelect: 'none',
}}
contentEditable={false}
onClick={(e) => {
e.stopPropagation();
Expand Down

1 comment on commit 53f754f

@vercel
Copy link

@vercel vercel bot commented on 53f754f Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.