|
@@ -9,7 +9,7 @@ import type { IPageHasId } from '@growi/core';
|
|
|
import { useGlobalSocket } from '@growi/core/dist/swr';
|
|
import { useGlobalSocket } from '@growi/core/dist/swr';
|
|
|
import { pathUtils } from '@growi/core/dist/utils';
|
|
import { pathUtils } from '@growi/core/dist/utils';
|
|
|
import {
|
|
import {
|
|
|
- CodeMirrorEditorMain, GlobalCodeMirrorEditorKey, AcceptedUploadFileType,
|
|
|
|
|
|
|
+ CodeMirrorEditorMain, GlobalCodeMirrorEditorKey,
|
|
|
useCodeMirrorEditorIsolated, useResolvedThemeForEditor,
|
|
useCodeMirrorEditorIsolated, useResolvedThemeForEditor,
|
|
|
} from '@growi/editor';
|
|
} from '@growi/editor';
|
|
|
import detectIndent from 'detect-indent';
|
|
import detectIndent from 'detect-indent';
|
|
@@ -27,8 +27,6 @@ import {
|
|
|
useDefaultIndentSize, useCurrentUser,
|
|
useDefaultIndentSize, useCurrentUser,
|
|
|
useCurrentPathname, useIsEnabledAttachTitleHeader,
|
|
useCurrentPathname, useIsEnabledAttachTitleHeader,
|
|
|
useIsEditable, useIsIndentSizeForced,
|
|
useIsEditable, useIsIndentSizeForced,
|
|
|
- useIsUploadAllFileAllowed, useIsUploadEnabled,
|
|
|
|
|
- // useAcceptedUploadFileType,
|
|
|
|
|
} from '~/stores/context';
|
|
} from '~/stores/context';
|
|
|
import {
|
|
import {
|
|
|
useEditorSettings,
|
|
useEditorSettings,
|
|
@@ -36,6 +34,7 @@ import {
|
|
|
useIsConflict,
|
|
useIsConflict,
|
|
|
useEditingMarkdown,
|
|
useEditingMarkdown,
|
|
|
useWaitingSaveProcessing,
|
|
useWaitingSaveProcessing,
|
|
|
|
|
+ useAcceptedUploadFileType,
|
|
|
} from '~/stores/editor';
|
|
} from '~/stores/editor';
|
|
|
import { useConflictDiffModal } from '~/stores/modal';
|
|
import { useConflictDiffModal } from '~/stores/modal';
|
|
|
import {
|
|
import {
|
|
@@ -110,9 +109,7 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
|
|
|
const { data: isIndentSizeForced } = useIsIndentSizeForced();
|
|
const { data: isIndentSizeForced } = useIsIndentSizeForced();
|
|
|
const { data: currentIndentSize, mutate: mutateCurrentIndentSize } = useCurrentIndentSize();
|
|
const { data: currentIndentSize, mutate: mutateCurrentIndentSize } = useCurrentIndentSize();
|
|
|
const { data: defaultIndentSize } = useDefaultIndentSize();
|
|
const { data: defaultIndentSize } = useDefaultIndentSize();
|
|
|
- const { data: isUploadAllFileAllowed } = useIsUploadAllFileAllowed();
|
|
|
|
|
- const { data: isUploadEnabled } = useIsUploadEnabled();
|
|
|
|
|
- // const { data: acceptedUploadFileType } = useAcceptedUploadFileType();
|
|
|
|
|
|
|
+ const { data: acceptedUploadFileType } = useAcceptedUploadFileType();
|
|
|
const { data: conflictDiffModalStatus, close: closeConflictDiffModal } = useConflictDiffModal();
|
|
const { data: conflictDiffModalStatus, close: closeConflictDiffModal } = useConflictDiffModal();
|
|
|
const { data: editorSettings } = useEditorSettings();
|
|
const { data: editorSettings } = useEditorSettings();
|
|
|
const { mutate: mutateIsLatestRevision } = useIsLatestRevision();
|
|
const { mutate: mutateIsLatestRevision } = useIsLatestRevision();
|
|
@@ -318,17 +315,6 @@ export const PageEditor = React.memo((props: Props): JSX.Element => {
|
|
|
|
|
|
|
|
}, [codeMirrorEditor, pageId]);
|
|
}, [codeMirrorEditor, pageId]);
|
|
|
|
|
|
|
|
- const acceptedUploadFileType = useMemo(() => {
|
|
|
|
|
- if (!isUploadEnabled) {
|
|
|
|
|
- return AcceptedUploadFileType.NONE;
|
|
|
|
|
- }
|
|
|
|
|
- if (isUploadAllFileAllowed) {
|
|
|
|
|
- return AcceptedUploadFileType.ALL;
|
|
|
|
|
- }
|
|
|
|
|
- return AcceptedUploadFileType.IMAGE;
|
|
|
|
|
- }, [isUploadAllFileAllowed, isUploadEnabled]);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
const scrollEditorHandler = useCallback(() => {
|
|
const scrollEditorHandler = useCallback(() => {
|
|
|
if (codeMirrorEditor?.view?.scrollDOM == null || previewRef.current == null) {
|
|
if (codeMirrorEditor?.view?.scrollDOM == null || previewRef.current == null) {
|
|
|
return;
|
|
return;
|