You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
what should I do if I want to make a page that "Left is an Editor, and right is an EditorStatic preview" just like the following image?
I achieve this with the following code, but actually got a bad performance while using useState to control editorStatic value. I sincerely ask for your help. Many thanks!
exportdefaultfunctionPage(){constt=useTranslations("editor");const[editorValue,setEditorValue]=useState("");consteditor=useCreateEditor();consteditorStatic=createSlateEditor({value: editorValue,plugins: ...
});return(<DndProviderbackend={HTML5Backend}><Plateeditor={editor}onValueChange={(e)=>{setEditorValue(e?.valueasany);}}><divclassName="min-h-screen bg-background"><divclassName="grid grid-cols-1 lg:grid-cols-2">{/* left */}<divclassName="bg-editor-paper p-4 shadow-sm h-screen w-full"data-registry="plate"><SettingsProvider><EditorContainer><Editorvariant="demo"placeholder="Type..."/></EditorContainer><SettingsDialog/></SettingsProvider></div>{/* right */}<divclassName="bg-editor-preview p-6 shadow-sm overflow-auto relative"><EditorStaticcomponents={editorStaticComponents}editor={editorStatic}/></div></div></div></Plate></DndProvider>);}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
what should I do if I want to make a page that "Left is an Editor, and right is an EditorStatic preview" just like the following image?
I achieve this with the following code, but actually got a bad performance while using
useState
to control editorStatic value. I sincerely ask for your help. Many thanks!Beta Was this translation helpful? Give feedback.
All reactions