import { useMemo } from "react";
import { withReact } from "slate-react";
import { withHistory } from "slate-history";
import {
createTazeEditor,
Taze,
TDescendant
} from "@taze-editor/taze-core";
import {
createSearchHighlightPlugin,
useSearchHighlightPluginStore
} from "@taze-editor/taze-plugin-search-highlight";
import { Toolbar } from "./Toolbar";
export default function App() {
const storeSearchHighlight = useSearchHighlightPluginStore();
const editor = useMemo(() =>
withReact(
withHistory(
createTazeEditor({
plugins: [
createSearchHighlightPlugin()
]
})
)
),
[]);
const initialValue: TDescendant[] = [{
type: "p",
children: [{ text: "This is editable." }],
}]
return (
<div>
<Taze
editor={editor}
initialValue={initialValue}
beforeEditable={<Toolbar />}
/>
</div>
);
}
To enter the code editing mode, press Enter. To exit the edit mode, press Escape
You are editing the code. To exit the edit mode, press Escape