|
@@ -10,6 +10,7 @@ import {
|
|
|
import { useConflictDiffModal } from '~/stores/modal';
|
|
import { useConflictDiffModal } from '~/stores/modal';
|
|
|
import { useSWRxCurrentPage } from '~/stores/page';
|
|
import { useSWRxCurrentPage } from '~/stores/page';
|
|
|
import { useRemoteRevisionId, useRemoteRevisionLastUpdateUser } from '~/stores/remote-latest-page';
|
|
import { useRemoteRevisionId, useRemoteRevisionLastUpdateUser } from '~/stores/remote-latest-page';
|
|
|
|
|
+import { EditorMode, useEditorMode } from '~/stores/ui';
|
|
|
|
|
|
|
|
import { Username } from './User/Username';
|
|
import { Username } from './User/Username';
|
|
|
|
|
|
|
@@ -29,6 +30,7 @@ export const PageStatusAlert = (): JSX.Element => {
|
|
|
const { data: isConflict } = useIsConflict();
|
|
const { data: isConflict } = useIsConflict();
|
|
|
const { mutate: mutateEditingMarkdown } = useEditingMarkdown();
|
|
const { mutate: mutateEditingMarkdown } = useEditingMarkdown();
|
|
|
const { open: openConflictDiffModal } = useConflictDiffModal();
|
|
const { open: openConflictDiffModal } = useConflictDiffModal();
|
|
|
|
|
+ const { mutate: mutateEditorMode } = useEditorMode();
|
|
|
|
|
|
|
|
// store remote latest page data
|
|
// store remote latest page data
|
|
|
const { data: revisionIdHackmdSynced } = useRevisionIdHackmdSynced();
|
|
const { data: revisionIdHackmdSynced } = useRevisionIdHackmdSynced();
|
|
@@ -72,12 +74,12 @@ export const PageStatusAlert = (): JSX.Element => {
|
|
|
{t('hackmd.this_page_has_draft')}
|
|
{t('hackmd.this_page_has_draft')}
|
|
|
</>,
|
|
</>,
|
|
|
btn:
|
|
btn:
|
|
|
- <a href="#hackmd" key="btnOpenHackmdPageHasDraft" className="btn btn-outline-white">
|
|
|
|
|
|
|
+ <button onClick={() => mutateEditorMode(EditorMode.HackMD)} className="btn btn-outline-white">
|
|
|
<i className="fa fa-fw fa-file-text-o mr-1"></i>
|
|
<i className="fa fa-fw fa-file-text-o mr-1"></i>
|
|
|
Open HackMD Editor
|
|
Open HackMD Editor
|
|
|
- </a>,
|
|
|
|
|
|
|
+ </button>,
|
|
|
};
|
|
};
|
|
|
- }, [t]);
|
|
|
|
|
|
|
+ }, [mutateEditorMode, t]);
|
|
|
|
|
|
|
|
const getContentsForUpdatedAlert = useCallback((): AlertComponentContents => {
|
|
const getContentsForUpdatedAlert = useCallback((): AlertComponentContents => {
|
|
|
|
|
|