Editor component
import { ReactComponents, Utils } from 'jstide-common';import { IEditor } from "roosterjs";import { useRef } from "react";const {Editor} = ReactComponents;const {getFileBase64} = Utils.file;type EditorActions = ReactComponents.EditorActions;function App() { const actionsRef = useRef<EditorActions>(); const editorRef = useRef<IEditor>(); return ( <> <Editor onReady={(actions: EditorActions, editor: IEditor) => { actionsRef.current = actions; editorRef.current = editor; }} onPasteImage={async (image: File) => { if (editorRef.current) { console.log(image) actionsRef.current.insertImage(await getFileBase64(image)); } }} /> </> )} Copy
import { ReactComponents, Utils } from 'jstide-common';import { IEditor } from "roosterjs";import { useRef } from "react";const {Editor} = ReactComponents;const {getFileBase64} = Utils.file;type EditorActions = ReactComponents.EditorActions;function App() { const actionsRef = useRef<EditorActions>(); const editorRef = useRef<IEditor>(); return ( <> <Editor onReady={(actions: EditorActions, editor: IEditor) => { actionsRef.current = actions; editorRef.current = editor; }} onPasteImage={async (image: File) => { if (editorRef.current) { console.log(image) actionsRef.current.insertImage(await getFileBase64(image)); } }} /> </> )}
Editor component