|
@@ -79,16 +79,11 @@ export const useIsMobile = (): SWRResponse<boolean, Error> => {
|
|
|
return useStaticSWR<boolean, Error>(key, undefined, configuration);
|
|
return useStaticSWR<boolean, Error>(key, undefined, configuration);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// TODO: Enable `editing-sidebar` class
|
|
|
|
|
-// https://redmine.weseek.co.jp/issues/111527
|
|
|
|
|
-const getClassNamesByEditorMode = (editorMode: EditorMode | undefined /* , isSidebar = false */): string[] => {
|
|
|
|
|
|
|
+const getClassNamesByEditorMode = (editorMode: EditorMode | undefined): string[] => {
|
|
|
const classNames: string[] = [];
|
|
const classNames: string[] = [];
|
|
|
switch (editorMode) {
|
|
switch (editorMode) {
|
|
|
case EditorMode.Editor:
|
|
case EditorMode.Editor:
|
|
|
classNames.push('editing', 'builtin-editor');
|
|
classNames.push('editing', 'builtin-editor');
|
|
|
- // if (isSidebar) {
|
|
|
|
|
- // classNames.push('editing-sidebar');
|
|
|
|
|
- // }
|
|
|
|
|
break;
|
|
break;
|
|
|
case EditorMode.HackMD:
|
|
case EditorMode.HackMD:
|
|
|
classNames.push('editing', 'hackmd');
|
|
classNames.push('editing', 'hackmd');
|
|
@@ -140,10 +135,8 @@ export const determineEditorModeByHash = (): EditorMode => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// TODO: Enable `editing-sidebar` class somehow
|
|
|
|
|
-// https://redmine.weseek.co.jp/issues/111527
|
|
|
|
|
type EditorModeUtils = {
|
|
type EditorModeUtils = {
|
|
|
- getClassNamesByEditorMode: (/* isEditingSidebar: boolean */) => string[],
|
|
|
|
|
|
|
+ getClassNamesByEditorMode: () => string[],
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export const useEditorMode = (): SWRResponseWithUtils<EditorModeUtils, EditorMode> => {
|
|
export const useEditorMode = (): SWRResponseWithUtils<EditorModeUtils, EditorMode> => {
|
|
@@ -171,11 +164,8 @@ export const useEditorMode = (): SWRResponseWithUtils<EditorModeUtils, EditorMod
|
|
|
return mutateOriginal(editorMode, shouldRevalidate);
|
|
return mutateOriginal(editorMode, shouldRevalidate);
|
|
|
}, [isEditable, mutateOriginal]);
|
|
}, [isEditable, mutateOriginal]);
|
|
|
|
|
|
|
|
- // TODO: Enable `editing-sidebar` class
|
|
|
|
|
- // https://redmine.weseek.co.jp/issues/111527
|
|
|
|
|
- // construct getClassNamesByEditorMode method
|
|
|
|
|
- const getClassNames = useCallback((/* isEditingSidebar: boolean */) => {
|
|
|
|
|
- return getClassNamesByEditorMode(swrResponse.data /* , isEditingSidebar */);
|
|
|
|
|
|
|
+ const getClassNames = useCallback(() => {
|
|
|
|
|
+ return getClassNamesByEditorMode(swrResponse.data);
|
|
|
}, [swrResponse.data]);
|
|
}, [swrResponse.data]);
|
|
|
|
|
|
|
|
return Object.assign(swrResponse, {
|
|
return Object.assign(swrResponse, {
|