Update landing page (#387)

* feat: update landing page

* feat(code): improve code editing experience

* feat: update landing page

* fix: react warning

* fix: update logo and i18n

Co-authored-by: tzhangchi <terry.zhangchi@outlook.com>
Co-authored-by: Yifeng Wang <doodlewind@qq.com>
This commit is contained in:
zuomeng wang
2022-09-08 16:24:49 +08:00
committed by GitHub
parent d5878d60c0
commit 715b235fea
21 changed files with 883 additions and 669 deletions
@@ -99,7 +99,7 @@ const langs: Record<string, any> = {
dockerfile: () => StreamLanguage.define(dockerFile),
r: () => StreamLanguage.define(r),
};
const DEFAULT_LANG = 'javascript';
const DEFAULT_LANG = 'markdown';
const CodeBlock = styled('div')(({ theme }) => ({
backgroundColor: '#F2F5F9',
padding: '8px 24px',
@@ -142,10 +142,13 @@ export const CodeView = ({ block, editor }: CreateCodeView) => {
const langType: string = block.getProperty('lang');
const [extensions, setExtensions] = useState<Extension[]>();
const codeMirror = useRef<ReactCodeMirrorRef>();
useOnSelect(block.id, (_is_select: boolean) => {
const focusCode = () => {
if (codeMirror.current) {
codeMirror?.current?.view?.focus();
}
};
useOnSelect(block.id, (_is_select: boolean) => {
focusCode();
});
const onChange = (value: string) => {
block.setProperty('text', {
@@ -158,6 +161,9 @@ export const CodeView = ({ block, editor }: CreateCodeView) => {
};
useEffect(() => {
handleLangChange(langType ? langType : DEFAULT_LANG);
setTimeout(() => {
focusCode();
}, 100);
}, []);
const copyCode = () => {