diff --git a/packages/react/src/useGetEditor.ts b/packages/react/src/useGetEditor.ts index 72eade81062..ee8d64b7260 100644 --- a/packages/react/src/useGetEditor.ts +++ b/packages/react/src/useGetEditor.ts @@ -26,6 +26,8 @@ export const useGetEditor = (getEditor: GetEditor) => { const div = dom.current; if (!div) return; + if (div.querySelector('.milkdown') != null) return; + const editor = getEditor(div, renderReact); if (!editor) return; diff --git a/website/component/Demo/Demo.tsx b/website/component/Demo/Demo.tsx index d79ed5b247e..86e946a2d8d 100644 --- a/website/component/Demo/Demo.tsx +++ b/website/component/Demo/Demo.tsx @@ -6,7 +6,7 @@ import { i18nConfig, Local } from '../../route'; import { decode } from '../../utils/share'; import { Mode } from '../constant'; import { localCtx } from '../Context'; -import { MilkdownEditor, MilkdownRef } from '../MilkdownEditor/MilkdownEditor'; +import { MilkdownRef, OnlineEditor } from '../MilkdownEditor/OnlineEditor'; import { CodeMirror, CodeMirrorRef } from './CodeMirror'; import className from './style.module.css'; @@ -70,7 +70,7 @@ export const Demo = ({ mode }: DemoProps) => { return !md.length ? null : (