|
|
@@ -15,6 +15,7 @@ import PageAccessories from '../PageAccessories';
|
|
|
import PageEditorByHackmd from '../PageEditorByHackmd';
|
|
|
import EditorNavbarBottom from '../PageEditor/EditorNavbarBottom';
|
|
|
import HashChanged from '../EventListeneres/HashChanged';
|
|
|
+import { useIsEditable } from '~/stores/context';
|
|
|
|
|
|
|
|
|
const DisplaySwitcher = (props) => {
|
|
|
@@ -23,6 +24,7 @@ const DisplaySwitcher = (props) => {
|
|
|
} = props;
|
|
|
const { isPageExist, pageUser } = pageContainer.state;
|
|
|
|
|
|
+ const { data: isEditable } = useIsEditable();
|
|
|
const { data: editorMode } = useEditorMode();
|
|
|
|
|
|
const isViewMode = editorMode === EditorMode.View;
|
|
|
@@ -55,20 +57,24 @@ const DisplaySwitcher = (props) => {
|
|
|
|
|
|
</div>
|
|
|
</TabPane>
|
|
|
- <TabPane tabId={EditorMode.Editor}>
|
|
|
- <div id="page-editor">
|
|
|
- <Editor />
|
|
|
- </div>
|
|
|
- </TabPane>
|
|
|
- <TabPane tabId={EditorMode.HackMD}>
|
|
|
- <div id="page-editor-with-hackmd">
|
|
|
- <PageEditorByHackmd />
|
|
|
- </div>
|
|
|
- </TabPane>
|
|
|
+ { isEditable && (
|
|
|
+ <TabPane tabId={EditorMode.Editor}>
|
|
|
+ <div id="page-editor">
|
|
|
+ <Editor />
|
|
|
+ </div>
|
|
|
+ </TabPane>
|
|
|
+ ) }
|
|
|
+ { isEditable && (
|
|
|
+ <TabPane tabId={EditorMode.HackMD}>
|
|
|
+ <div id="page-editor-with-hackmd">
|
|
|
+ <PageEditorByHackmd />
|
|
|
+ </div>
|
|
|
+ </TabPane>
|
|
|
+ ) }
|
|
|
</TabContent>
|
|
|
- {!isViewMode && <EditorNavbarBottom /> }
|
|
|
+ { isEditable && !isViewMode && <EditorNavbarBottom /> }
|
|
|
|
|
|
- <HashChanged></HashChanged>
|
|
|
+ { isEditable && <HashChanged></HashChanged> }
|
|
|
</>
|
|
|
);
|
|
|
};
|