فهرست منبع

use useIsMobile

yuken 3 سال پیش
والد
کامیت
59c92550e7
1فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 4 3
      packages/app/src/components/PageEditor/Editor.tsx

+ 4 - 3
packages/app/src/components/PageEditor/Editor.tsx

@@ -11,6 +11,7 @@ import {
 import { toastError } from '~/client/util/apiNotification';
 import { useDefaultIndentSize } from '~/stores/context';
 import { useEditorSettings } from '~/stores/editor';
+import { useIsMobile } from '~/stores/ui';
 
 import Cheatsheet from './Cheatsheet';
 import CodeMirrorEditor from './CodeMirrorEditor';
@@ -21,7 +22,6 @@ type EditorPropsType = {
   value?: string,
   isGfmMode?: boolean,
   noCdn?: boolean,
-  isMobile?: boolean
   isUploadable?: boolean,
   isUploadableFile?: boolean,
   onChange?: () => void,
@@ -39,16 +39,17 @@ type DropzoneRef = {
 
 const Editor = React.forwardRef((props: EditorPropsType, ref): JSX.Element => {
   const {
-    isMobile, onUpload, isUploadable, isUploadableFile, indentSize,
+    onUpload, isUploadable, isUploadableFile, indentSize,
   } = props;
 
   const [dropzoneActive, setDropzoneActive] = useState(false);
   const [isUploading, setIsUploading] = useState(false);
   const [isCheatsheetModalShown, setIsCheatsheetModalShown] = useState(false);
 
+  const { t } = useTranslation();
   const { data: editorSettings } = useEditorSettings();
   const { data: defaultIndentSize } = useDefaultIndentSize();
-  const { t } = useTranslation();
+  const { data: isMobile } = useIsMobile();
 
   const dropzoneRef = useRef<DropzoneRef>(null);
   const cmEditorRef = useRef<CodeMirrorEditor>(null);