Skip to content

Commit

Permalink
为Markdown编辑器添加editorStyle属性,优化样式处理
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Dec 18, 2024
1 parent adf3841 commit 5670956
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/MarkdownEditor/editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,11 @@ export const MEditor = observer(
reportMode
? {
fontSize: 16,
...editorProps.style,
}
: {
fontSize: 14,
...editorProps.style,
}
}
onMouseDown={checkEnd}
Expand Down
3 changes: 3 additions & 0 deletions src/MarkdownEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export type MarkdownEditorProps = {
*/
style?: React.CSSProperties;
contentStyle?: React.CSSProperties;
editorStyle?: React.CSSProperties;
/**
* 是否显示目录
*/
Expand Down Expand Up @@ -258,6 +259,7 @@ export const MarkdownEditor: React.FC<MarkdownEditorProps> = (props) => {
readonly,
style,
contentStyle,
editorStyle,
height,
...rest
} = props;
Expand Down Expand Up @@ -418,6 +420,7 @@ export const MarkdownEditor: React.FC<MarkdownEditorProps> = (props) => {
prefixCls={baseClassName}
note={instance.current!}
{...rest}
style={editorStyle}
instance={instance}
/>
{readonly ? (
Expand Down
4 changes: 4 additions & 0 deletions src/Slides/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export function Slides(props: { initValue: string }) {
margin: 0,
width: '100%',
}}
editorStyle={{
maxHeight: '80vh',
overflow: 'auto',
}}
contentStyle={{
width: '100%',
padding: 0,
Expand Down

0 comments on commit 5670956

Please sign in to comment.