useToastEditor.ts 565 B

123456789101112131415161718192021222324
  1. import Editor from "@toast-ui/editor";
  2. import "@toast-ui/editor/dist/toastui-editor.css";
  3. import "@toast-ui/editor/dist/i18n/ko-kr";
  4. export const toastEditorInstance = (
  5. divId: HTMLElement,
  6. initialEditType: string,
  7. hideModeSwitch: boolean,
  8. autofocus: boolean,
  9. height: string
  10. ) => {
  11. return new Editor({
  12. el: divId,
  13. initialEditType: initialEditType,
  14. hideModeSwitch: hideModeSwitch,
  15. language: "ko-KR",
  16. autofocus: autofocus,
  17. height: height,
  18. hooks: {
  19. // addImageBlobHook: async (blob: Blob, callback) => { }
  20. },
  21. });
  22. };