我正在使用useEditorTipTap 库中的函数来创建编辑器,但它首先返回 null。我的意思是,如果我使用useEditor并立即记录我设置的变量,它会返回 null,但随后会返回一个 Editor 对象。我正在使用 React 和 create-react-app。
我的 App.js 文件中有这个:
const editorUse = useEditor({
extensions: [StarterKit],
content: JSON.parse(localStorage.getItem("text")) ?? "",
});
console.log(editorUse);
Run Code Online (Sandbox Code Playgroud)
代码沙箱:https://codesandbox.io/s/zealous-darwin-iswww?file =/src/App.js