فهرست منبع

134432 remove onSave from use-handsontable

soumaeda 2 سال پیش
والد
کامیت
35ec62d3d2

+ 1 - 0
apps/app/src/components/PageEditor/PageEditor.tsx

@@ -183,6 +183,7 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
 
   const { data: codeMirrorEditor } = useCodeMirrorEditorIsolated(GlobalCodeMirrorEditorKey.MAIN);
 
+
   const checkIsConflict = useCallback((data) => {
     const { s2cMessagePageUpdated } = data;
 

+ 0 - 1
packages/editor/src/components/CodeMirrorEditor/CodeMirrorEditor.tsx

@@ -141,7 +141,6 @@ export const CodeMirrorEditor = (props: Props): JSX.Element => {
     return '';
   }, [isUploading, acceptedFileType, isDragAccept, isDragReject]);
 
-
   return (
     <div className={`${style['codemirror-editor']} flex-expand-vert`}>
       <div {...getRootProps()} className={`dropzone ${fileUploadState} flex-expand-vert`}>

+ 1 - 2
packages/editor/src/components/CodeMirrorEditor/Toolbar/TableButton.tsx

@@ -1,8 +1,7 @@
 import { useCallback } from 'react';
 
 import { useCodeMirrorEditorIsolated } from '../../../stores';
-import { useHandsontableModal } from '../../../stores/use-hands-on-table';
-
+import { useHandsontableModal } from '../../../stores/use-handsontable';
 
 type Props = {
   editorKey: string,

+ 2 - 4
packages/editor/src/components/CodeMirrorEditor/Toolbar/Toolbar.tsx

@@ -14,14 +14,12 @@ import styles from './Toolbar.module.scss';
 type Props = {
   editorKey: string | GlobalCodeMirrorEditorKey,
   onFileOpen: () => void,
-  acceptedFileType: AcceptedUploadFileType,
+  acceptedFileType: AcceptedUploadFileType
 }
 
 export const Toolbar = memo((props: Props): JSX.Element => {
 
-  const {
-    editorKey, onFileOpen, acceptedFileType,
-  } = props;
+  const { editorKey, onFileOpen, acceptedFileType } = props;
 
   return (
     <div className={`d-flex gap-2 p-2 codemirror-editor-toolbar ${styles['codemirror-editor-toolbar']}`}>

+ 3 - 8
packages/editor/src/stores/use-hands-on-table.ts → packages/editor/src/stores/use-handsontable.ts

@@ -4,19 +4,14 @@ import { EditorView } from '@codemirror/view';
 import { useSWRStatic } from '@growi/core/dist/swr';
 import type { SWRResponse } from 'swr';
 
-type HandsonTableModalSaveHandler = () => void;
-
 type HandsontableModalStatus = {
   isOpened: boolean,
   editor?: EditorView,
-  // onSave is passed only when editing table directly from the page.
-  onSave?: HandsonTableModalSaveHandler
 }
 
 type HandsontableModalStatusUtils = {
   open(
     editor?: EditorView,
-    onSave?: HandsonTableModalSaveHandler
   ): void
   close(): void
 }
@@ -31,14 +26,14 @@ export const useHandsontableModal = (status?: HandsontableModalStatus): SWRRespo
 
   const { mutate } = swrResponse;
 
-  const open = useCallback((editor?: EditorView, onSave?: HandsonTableModalSaveHandler): void => {
+  const open = useCallback((editor?: EditorView): void => {
     mutate({
-      isOpened: true, editor, onSave,
+      isOpened: true, editor,
     });
   }, [mutate]);
   const close = useCallback((): void => {
     mutate({
-      isOpened: false, editor: undefined, onSave: undefined,
+      isOpened: false, editor: undefined,
     });
   }, [mutate]);