Skip to content

Commit ec18778

Browse files
committedJun 6, 2023
website: update CodeMirror height style.
1 parent 159444d commit ec18778

File tree

17 files changed

+39
-37
lines changed

17 files changed

+39
-37
lines changed
 

‎www/src/components/Warpper.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import styled from 'styled-components';
22
import BackToUp from '@uiw/react-back-to-top';
33
import { useRef, useState, useEffect, FC, PropsWithChildren } from 'react';
4+
import { ScrollRestoration } from 'react-router-dom';
45

56
const Container = styled.div`
67
width: 100%;
@@ -20,6 +21,7 @@ export const Warpper: FC<PropsWithChildren<{}>> = (props) => {
2021
<BackToUp element={element} style={{ position: 'fixed' }}>
2122
Top
2223
</BackToUp>
24+
<ScrollRestoration />
2325
</Container>
2426
);
2527
};

‎www/src/components/useMdData.tsx

-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ export const useMdData = (path: MdDataHandle) => {
1111
});
1212
const [loading, setLoading] = useState(false);
1313

14-
useEffect(() => {
15-
const $main = document.getElementsByTagName('main') as HTMLCollectionOf<HTMLDivElement>;
16-
$main[0] && $main[0].scrollTo(0, 0);
17-
}, [path]);
18-
1914
useEffect(() => {
2015
setLoading(() => true);
2116
const getMd = async () => {

‎www/src/pages/examples/Example431.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const PageExample431 = () => {
1111
<CodeMirror
1212
value={`console.log('hello')`}
1313
theme="none"
14-
height="400px"
14+
height="400px !important"
1515
width="100%"
1616
style={{ margin: '0 0 23px 0', flex: 1 }}
1717
extensions={[langs.markdown()]}

‎www/src/pages/extensions/basic-setup/example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const BasicSetupExample = (props: BasicSetupExampleProps) => {
3838
value={props.source}
3939
theme={theme}
4040
basicSetup={basicSetup}
41-
height="300px"
41+
height="300px !important"
4242
style={{ margin: '0 0 23px 0' }}
4343
extensions={[langs.markdown()]}
4444
/>

‎www/src/pages/extensions/classname/example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const ClassNameExample: FC<PropsWithChildren<{ source?: string }>> = ({ s
2121
<CodeMirror
2222
value={source}
2323
theme={theme}
24-
height="300px"
24+
height="300px !important"
2525
style={{ margin: '0 0 23px 0' }}
2626
extensions={[
2727
langs.markdown(),

‎www/src/pages/extensions/color/example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const ColorExample = () => {
2323
<CodeMirror
2424
value={codeSample}
2525
theme={theme}
26-
height="400px"
26+
height="400px !important"
2727
// editable={readOnly}
2828
// readOnly={readOnly}
2929
{...porps}

‎www/src/pages/extensions/events/example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const EventsExample: FC<PropsWithChildren<{ source?: string }>> = ({ sour
2121
<CodeMirror
2222
value={source}
2323
theme={theme}
24-
height="200px"
24+
height="200px !important"
2525
style={{ margin: '0 0 23px 0' }}
2626
extensions={[
2727
langs.markdown(),

‎www/src/pages/extensions/hyper-link/example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const HyperLinkExample = () => {
1313
<CodeMirror
1414
value={markdownString}
1515
theme={theme}
16-
height="300px"
16+
height="300px !important"
1717
style={{ margin: '0 0 23px 0' }}
1818
extensions={[langs.markdown(), hyperLink]}
1919
/>

‎www/src/pages/extensions/langs/example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const LangsExample: FC<PropsWithChildren<{ source?: string }>> = (props)
3333
<CodeMirror
3434
value={source}
3535
theme={theme}
36-
height="300px"
36+
height="300px !important"
3737
style={{ margin: '0 0 23px 0' }}
3838
extensions={[loadLanguage(language)!].filter(Boolean)}
3939
/>

‎www/src/pages/extensions/line-numbers-relative/example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const LineNumbersRelativeExample: FC<PropsWithChildren<{ source?: string
1212
<CodeMirror
1313
value={source}
1414
theme={theme}
15-
height="300px"
15+
height="300px !important"
1616
style={{ margin: '0 0 23px 0' }}
1717
extensions={[langs.markdown(), lineNumbersRelative]}
1818
/>

‎www/src/pages/extensions/mentions/example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const MentionsExample: FC<PropsWithChildren<{ source?: string }>> = ({ so
5858
<CodeMirror
5959
value={source}
6060
theme={theme}
61-
height="300px"
61+
height="300px !important"
6262
style={{ margin: '0 0 23px 0' }}
6363
extensions={[langs.markdown(), mentions(users)]}
6464
/>

‎www/src/pages/extensions/themes/example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const ThemesAllExample: FC<PropsWithChildren<{ source?: string }>> = ({ s
3030
<CodeMirror
3131
value={source}
3232
theme={themeCurrent as ReactCodeMirrorProps['theme']}
33-
height="300px"
33+
height="300px !important"
3434
style={{ margin: '0 0 23px 0' }}
3535
extensions={[langs.markdown()]}
3636
/>

‎www/src/pages/extensions/zebra-stripes/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const ZebraStripesExample: FC<PropsWithChildren<{ source?: string }>> = (
2222
<CodeMirror
2323
value={source}
2424
theme={theme}
25-
height="300px"
25+
height="300px !important"
2626
style={{ margin: '0 0 23px 0' }}
2727
extensions={[langs.markdown(), zebra]}
2828
/>
@@ -39,7 +39,7 @@ export const ZebraStripesExample: FC<PropsWithChildren<{ source?: string }>> = (
3939
<CodeMirror
4040
value={source}
4141
theme={theme}
42-
height="300px"
42+
height="300px !important"
4343
style={{ margin: '0 0 23px 0' }}
4444
extensions={[
4545
langs.markdown(),

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default function Example() {
9090
<Warpper className="wmde-markdown-var">
9191
<CodemirrorWarpper
9292
value={code}
93-
height={height}
93+
height={`${height} !important`}
9494
theme={alls[theme as keyof typeof alls] || theme}
9595
editable={editable}
9696
extensions={extensions}

‎www/src/pages/theme/editor/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function ThemeEditor() {
8181
selectionMatch: '#D6D6D6',
8282
gutterBackground: '#FFFFFF',
8383
gutterForeground: '#4D4D4C',
84-
gutterBorder: '#ddd',
84+
gutterBorder: '#dddddd',
8585
gutterActiveForeground: '',
8686
lineHighlight: '#EFEFEF',
8787
});
@@ -220,7 +220,7 @@ export function ThemeEditor() {
220220
theme={myTheme}
221221
extensions={[extension, color]}
222222
value={lang === 'code' ? themeCode({ ...settings, ...styles, dark: theme }) : code}
223-
height="100%"
223+
height="100% !important"
224224
style={{ minHeight: '100%' }}
225225
/>
226226
)}

‎www/src/pages/theme/home/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function ThemesHome() {
8484
<Title>{toTitleCase(name)}</Title>
8585
<CodeEditor
8686
value={codeString}
87-
height="165px"
87+
height="165px !important"
8888
theme={themeData[name as keyof typeof themeData]}
8989
extensions={[color, langs.jsx()]}
9090
/>

‎www/src/pages/theme/themes/Sample.tsx

+21-16
Original file line numberDiff line numberDiff line change
@@ -39,37 +39,42 @@ export const Sample: FC<PropsWithoutRef<SampleProps>> = ({ theme, ...props }) =>
3939
return (
4040
<Warpper {...props}>
4141
<Title>JavaScript</Title>
42-
<CodeMirror value={jsStr} height="300px" theme={theme} extensions={[color, langs.javascript()]} />
42+
<CodeMirror value={jsStr} height="300px !important" theme={theme} extensions={[color, langs.javascript()]} />
4343
<Title>JSX</Title>
44-
<CodeMirror value={jsxStr} height="300px" theme={theme} extensions={[color, langs.jsx()]} />
44+
<CodeMirror value={jsxStr} height="300px !important" theme={theme} extensions={[color, langs.jsx()]} />
4545
<Title>TypeScript</Title>
46-
<CodeMirror value={typescriptStr} height="300px" theme={theme} extensions={[color, langs.typescript()]} />
46+
<CodeMirror
47+
value={typescriptStr}
48+
height="300px !important"
49+
theme={theme}
50+
extensions={[color, langs.typescript()]}
51+
/>
4752
<Title>TSX</Title>
48-
<CodeMirror value={tsxStr} height="300px" theme={theme} extensions={[color, langs.tsx()]} />
53+
<CodeMirror value={tsxStr} height="300px !important" theme={theme} extensions={[color, langs.tsx()]} />
4954
<Title>JSON</Title>
50-
<CodeMirror value={jsonStr} height="300px" theme={theme} extensions={[color, langs.json()]} />
55+
<CodeMirror value={jsonStr} height="300px !important" theme={theme} extensions={[color, langs.json()]} />
5156
<Title>HTML</Title>
52-
<CodeMirror value={htmlStr} height="300px" theme={theme} extensions={[color, langs.html()]} />
57+
<CodeMirror value={htmlStr} height="300px !important" theme={theme} extensions={[color, langs.html()]} />
5358
<Title>Markdown</Title>
54-
<CodeMirror value={markdownStr} height="300px" theme={theme} extensions={[color, langs.markdown()]} />
59+
<CodeMirror value={markdownStr} height="300px !important" theme={theme} extensions={[color, langs.markdown()]} />
5560
<Title>CSS</Title>
56-
<CodeMirror value={cssStr} height="300px" theme={theme} extensions={[color, langs.css()]} />
61+
<CodeMirror value={cssStr} height="300px !important" theme={theme} extensions={[color, langs.css()]} />
5762
<Title>PHP</Title>
58-
<CodeMirror value={phpStr} height="300px" theme={theme} extensions={[color, langs.php()]} />
63+
<CodeMirror value={phpStr} height="300px !important" theme={theme} extensions={[color, langs.php()]} />
5964
<Title>JAVA</Title>
60-
<CodeMirror value={javaStr} height="300px" theme={theme} extensions={[color, langs.java()]} />
65+
<CodeMirror value={javaStr} height="300px !important" theme={theme} extensions={[color, langs.java()]} />
6166
<Title>Rust</Title>
62-
<CodeMirror value={rustStr} height="300px" theme={theme} extensions={[color, langs.rust()]} />
67+
<CodeMirror value={rustStr} height="300px !important" theme={theme} extensions={[color, langs.rust()]} />
6368
<Title>Go</Title>
64-
<CodeMirror value={goStr} height="300px" theme={theme} extensions={[color, langs.go()]} />
69+
<CodeMirror value={goStr} height="300px !important" theme={theme} extensions={[color, langs.go()]} />
6570
<Title>MySQL</Title>
66-
<CodeMirror value={mysqlStr} height="300px" theme={theme} extensions={[color, langs.mysql()]} />
71+
<CodeMirror value={mysqlStr} height="300px !important" theme={theme} extensions={[color, langs.mysql()]} />
6772
<Title>Python</Title>
68-
<CodeMirror value={pythonStr} height="300px" theme={theme} extensions={[color, langs.python()]} />
73+
<CodeMirror value={pythonStr} height="300px !important" theme={theme} extensions={[color, langs.python()]} />
6974
<Title>Shell</Title>
70-
<CodeMirror value={shellStr} height="300px" theme={theme} extensions={[color, langs.shell()]} />
75+
<CodeMirror value={shellStr} height="300px !important" theme={theme} extensions={[color, langs.shell()]} />
7176
<Title>Swift</Title>
72-
<CodeMirror value={swiftStr} height="300px" theme={theme} extensions={[color, langs.swift()]} />
77+
<CodeMirror value={swiftStr} height="300px !important" theme={theme} extensions={[color, langs.swift()]} />
7378
</Warpper>
7479
);
7580
};

0 commit comments

Comments
 (0)
Please sign in to comment.