|
@@ -18,7 +18,7 @@ import { IEditorMethods } from '~/interfaces/editor-methods';
|
|
|
import { SocketEventName } from '~/interfaces/websocket';
|
|
import { SocketEventName } from '~/interfaces/websocket';
|
|
|
import {
|
|
import {
|
|
|
useCurrentPathname, useCurrentPageId,
|
|
useCurrentPathname, useCurrentPageId,
|
|
|
- useIsEditable, useIsIndentSizeForced, useIsUploadableFile, useIsUploadableImage, useIsNotFound,
|
|
|
|
|
|
|
+ useIsEditable, useIsIndentSizeForced, useIsUploadableFile, useIsUploadableImage, useIsNotFound, useEditingMarkdown,
|
|
|
} from '~/stores/context';
|
|
} from '~/stores/context';
|
|
|
import {
|
|
import {
|
|
|
useCurrentIndentSize, useSWRxSlackChannels, useIsSlackEnabled, useIsTextlintEnabled, usePageTagsForEditors,
|
|
useCurrentIndentSize, useSWRxSlackChannels, useIsSlackEnabled, useIsTextlintEnabled, usePageTagsForEditors,
|
|
@@ -64,6 +64,7 @@ const PageEditor = React.memo((): JSX.Element => {
|
|
|
const { data: currentPage, mutate: mutateCurrentPage } = useSWRxCurrentPage();
|
|
const { data: currentPage, mutate: mutateCurrentPage } = useSWRxCurrentPage();
|
|
|
const { data: grantData, mutate: mutateGrant } = useSelectedGrant();
|
|
const { data: grantData, mutate: mutateGrant } = useSelectedGrant();
|
|
|
const { data: pageTags } = usePageTagsForEditors(pageId);
|
|
const { data: pageTags } = usePageTagsForEditors(pageId);
|
|
|
|
|
+ const { data: editingMarkdown } = useEditingMarkdown();
|
|
|
const { data: isEditable } = useIsEditable();
|
|
const { data: isEditable } = useIsEditable();
|
|
|
const { data: editorMode, mutate: mutateEditorMode } = useEditorMode();
|
|
const { data: editorMode, mutate: mutateEditorMode } = useEditorMode();
|
|
|
const { data: isMobile } = useIsMobile();
|
|
const { data: isMobile } = useIsMobile();
|
|
@@ -79,7 +80,7 @@ const PageEditor = React.memo((): JSX.Element => {
|
|
|
const { data: rendererOptions } = usePreviewOptions();
|
|
const { data: rendererOptions } = usePreviewOptions();
|
|
|
|
|
|
|
|
const currentRevisionId = currentPage?.revision?._id;
|
|
const currentRevisionId = currentPage?.revision?._id;
|
|
|
- const initialValue = currentPage?.revision?.body ?? '';
|
|
|
|
|
|
|
+ const initialValue = editingMarkdown ?? '';
|
|
|
|
|
|
|
|
const markdownToSave = useRef<string>(initialValue);
|
|
const markdownToSave = useRef<string>(initialValue);
|
|
|
const [markdownToPreview, setMarkdownToPreview] = useState<string>(initialValue);
|
|
const [markdownToPreview, setMarkdownToPreview] = useState<string>(initialValue);
|