Skip to content

Commit

Permalink
fix: scroller is still here when has no preview area
Browse files Browse the repository at this point in the history
  • Loading branch information
imzbf committed Oct 24, 2023
1 parent f19f4f6 commit 26fc483
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
19 changes: 13 additions & 6 deletions packages/MdEditor/layouts/Content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,25 @@ export default defineComponent({

return () => {
return (
<div class={`${prefix}-content`} ref={contentRef}>
<div
class={`${prefix}-content${
props.setting.htmlPreview || props.setting.preview ? ' has-preview' : ''
}`}
ref={contentRef}
>
<div
class={`${prefix}-input-wrapper`}
style={inputWrapperStyle}
ref={inputWrapperRef}
/>

<div
class={`${prefix}-resize-operate`}
style={resizeOperateStyle}
ref={resizeRef}
/>
{(props.setting.htmlPreview || props.setting.preview) && (
<div
class={`${prefix}-resize-operate`}
style={resizeOperateStyle}
ref={resizeRef}
/>
)}

<ContentPreview
modelValue={props.modelValue}
Expand Down
8 changes: 6 additions & 2 deletions packages/MdEditor/styles/codeMirror.less
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@
}
}

.cm-scroller {
overflow-y: scroll;
.has-preview {
.cm-scroller {
overflow-y: scroll;
}
}

.cm-scroller {
// 当没有代码行号的时候,给编辑区一个10的外间距
.cm-content[contenteditable='true'] {
margin: 10px;
Expand Down

0 comments on commit 26fc483

Please sign in to comment.