Skip to content

Commit dda529b

Browse files
committedAug 30, 2023
website: update home example.
1 parent 5599909 commit dda529b

File tree

1 file changed

+31
-22
lines changed

1 file changed

+31
-22
lines changed
 

‎www/src/pages/home/Example.tsx

+31-22
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,19 @@ const Tools = styled.div`
3636
}
3737
`;
3838

39-
const CodemirrorWarpper = styled(CodeMirror)`
40-
box-shadow: 0 0 0 1px rgb(16 22 26 / 10%), 0 0 0 rgb(16 22 26 / 0%), 0 1px 1px rgb(16 22 26 / 20%);
39+
const CodemirrorWarpper = styled.div`
40+
box-shadow:
41+
0 0 0 1px rgb(16 22 26 / 10%),
42+
0 0 0 rgb(16 22 26 / 0%),
43+
0 1px 1px rgb(16 22 26 / 20%);
4144
margin: 0 auto;
4245
text-align: left;
4346
max-width: 995px;
4447
overflow: auto;
4548
border-radius: 5px;
49+
margin-top: -30px;
50+
z-index: 10;
51+
position: relative;
4652
`;
4753

4854
const Warpper = styled.div`
@@ -88,26 +94,29 @@ export default function Example() {
8894
}, []);
8995
return (
9096
<Warpper className="wmde-markdown-var">
91-
<CodemirrorWarpper
92-
value={code}
93-
height={`${height} !important`}
94-
theme={alls[theme as keyof typeof alls] || theme}
95-
editable={editable}
96-
extensions={extensions}
97-
autoFocus={autofocus}
98-
basicSetup={basicSetup}
99-
placeholder={placeholder}
100-
onChange={(val) => {
101-
// https://github.com/uiwjs/react-codemirror/issues/449
102-
// setCode(val)
103-
}}
104-
style={{
105-
maxWidth: '995px',
106-
margin: '-18px auto 0 auto',
107-
position: 'relative',
108-
zIndex: 999,
109-
}}
110-
/>
97+
<CodemirrorWarpper>
98+
<CodeMirror
99+
value={code}
100+
height={`${height} !important`}
101+
// @ts-ignore
102+
theme={alls[theme as keyof typeof alls] || theme}
103+
editable={editable}
104+
extensions={extensions}
105+
autoFocus={autofocus}
106+
basicSetup={basicSetup}
107+
placeholder={placeholder}
108+
onChange={(val) => {
109+
// https://github.com/uiwjs/react-codemirror/issues/449
110+
// setCode(val)
111+
}}
112+
style={{
113+
maxWidth: '995px',
114+
margin: '-18px auto 0 auto',
115+
position: 'relative',
116+
zIndex: 999,
117+
}}
118+
/>
119+
</CodemirrorWarpper>
111120
<MarkdownDocument>
112121
<Tools>
113122
<Select

0 commit comments

Comments
 (0)
Please sign in to comment.