diff --git a/ui/src/components/Editor/index.tsx b/ui/src/components/Editor/index.tsx index 8fe0616e..fcc2d6ec 100644 --- a/ui/src/components/Editor/index.tsx +++ b/ui/src/components/Editor/index.tsx @@ -1,7 +1,6 @@ import { useEffect, useRef, - useState, ForwardRefRenderFunction, forwardRef, useImperativeHandle, @@ -74,14 +73,6 @@ const MDEditor: ForwardRefRenderFunction = ( autoFocus, }); - const [markdown, setMarkdown] = useState(value || ''); - - useEffect(() => { - if (value !== markdown) { - setMarkdown(value); - } - }, [value]); - const getHtml = () => { return previewRef.current?.getHtml(); }; @@ -103,29 +94,31 @@ const MDEditor: ForwardRefRenderFunction = ( <>
- - - - -
- - -
- - -
-
    -
      - - -
      -
      - - + {editor && ( + + + + +
      + + +
      + +
+
+
    +
      + + +
      +
      + + + )}
      @@ -135,7 +128,7 @@ const MDEditor: ForwardRefRenderFunction = ( />
      - + ); }; diff --git a/ui/src/components/Editor/utils/index.ts b/ui/src/components/Editor/utils/index.ts index 480ed0eb..e0630566 100644 --- a/ui/src/components/Editor/utils/index.ts +++ b/ui/src/components/Editor/utils/index.ts @@ -127,7 +127,8 @@ export const useEditor = ({ onFocus, onBlur, }) => { - const [editor, setEditor] = useState(); + const [editor, setEditor] = useState(null); + const [value, setValue] = useState(''); const onEnter = (cm) => { const cursor = cm.getCursor(); @@ -168,13 +169,13 @@ export const useEditor = ({ placeholder, focus: autoFocus, }); - setEditor(cm); + setEditor(cm); createEditorUtils(codeMirror, cm); cm.on('change', (e) => { const newValue = e.getValue(); - onChange?.(newValue); + setValue(newValue); }); cm.on('focus', () => { @@ -187,8 +188,13 @@ export const useEditor = ({ cm.addKeyMap({ Enter: onEnter, }); + return cm; }; + useEffect(() => { + onChange?.(value); + }, [value]); + useEffect(() => { if (!(editorRef.current instanceof HTMLElement)) { return; diff --git a/ui/src/index.scss b/ui/src/index.scss index 1b1a358e..1664965a 100644 --- a/ui/src/index.scss +++ b/ui/src/index.scss @@ -322,10 +322,6 @@ img[src=""] { vertical-align: -0.125em; } -.algoliaSvg { - display: inline-block; - width: 92px; - height: 24px; - fill: currentColor; - vertical-align: -0.125em; +.max-width-200 { + max-width: 200px; } diff --git a/ui/src/pages/403/index.tsx b/ui/src/pages/403/index.tsx new file mode 100644 index 00000000..ebef9045 --- /dev/null +++ b/ui/src/pages/403/index.tsx @@ -0,0 +1,7 @@ +import { HttpErrorContent } from '@/components'; + +const Index = () => { + return ; +}; + +export default Index; diff --git a/ui/src/plugins/builtin/SearchInfo/index.tsx b/ui/src/plugins/builtin/SearchInfo/index.tsx index 28ef2517..218d6ca5 100644 --- a/ui/src/plugins/builtin/SearchInfo/index.tsx +++ b/ui/src/plugins/builtin/SearchInfo/index.tsx @@ -15,13 +15,11 @@ const pluginInfo: PluginInfo = { }; const Index: FC = () => { - console.log(111111); const { t } = useTranslation(getTransNs(), { keyPrefix: getTransKeyPrefix(pluginInfo), }); const { data } = useGetSearchPLuginInfo(); - console.log(data); // if (!data?.icon) return null; return ( @@ -31,7 +29,7 @@ const Index: FC = () => { target="_blank" rel="noopener noreferrer"> {t('search_by')} - + ); }; diff --git a/ui/src/router/routes.ts b/ui/src/router/routes.ts index 7407dce2..c63cbff0 100644 --- a/ui/src/router/routes.ts +++ b/ui/src/router/routes.ts @@ -394,6 +394,10 @@ const routes: RouteNode[] = [ path: '50x', page: 'pages/50X', }, + { + path: '403', + page: 'pages/403', + }, ], }, {