Skip to main content
Version: 1.14.0

Create Editor

note

Each example is using Sandpack, a live-running coding environment leveraging CodeSandbox.

Default Editor

import { useMemo } from "react";
import { withReact } from "slate-react";
import { withHistory } from "slate-history";

import { 
  createTazeEditor, 
  Taze,
  TDescendant
} from "@taze-editor/taze-core";


export default function App() {

  const editor = useMemo(() => 
    withReact(
      withHistory(
        createTazeEditor()
      )
    ),
  []);

  const initialValue: TDescendant[] = [{
    type: "p",
    children: [{ text: "This is editable " }],
  }]

  return (
    <div>
      <Taze
        editor={editor} 
        initialValue={initialValue} 
      />
    </div>
  );
}