|
@@ -6,6 +6,7 @@ import nodePath from 'path';
|
|
|
import type { IPagePopulatedToShowRevision } from '@growi/core';
|
|
import type { IPagePopulatedToShowRevision } from '@growi/core';
|
|
|
import { DevidedPagePath } from '@growi/core/dist/models';
|
|
import { DevidedPagePath } from '@growi/core/dist/models';
|
|
|
import { pathUtils } from '@growi/core/dist/utils';
|
|
import { pathUtils } from '@growi/core/dist/utils';
|
|
|
|
|
+import { isMovablePage } from '@growi/core/dist/utils/page-path-utils';
|
|
|
import { useTranslation } from 'next-i18next';
|
|
import { useTranslation } from 'next-i18next';
|
|
|
|
|
|
|
|
import { ValidationTarget } from '~/client/util/input-validator';
|
|
import { ValidationTarget } from '~/client/util/input-validator';
|
|
@@ -16,7 +17,8 @@ import { usePagePathRenameHandler } from '../PageEditor/page-path-rename-utils';
|
|
|
|
|
|
|
|
import styles from './PageTitleHeader.module.scss';
|
|
import styles from './PageTitleHeader.module.scss';
|
|
|
|
|
|
|
|
-const moduleClass = styles['page-title-header'];
|
|
|
|
|
|
|
+const moduleClass = styles['page-title-header'] ?? '';
|
|
|
|
|
+const borderColorClass = styles['page-title-header-border-color'] ?? '';
|
|
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
|
currentPage: IPagePopulatedToShowRevision,
|
|
currentPage: IPagePopulatedToShowRevision,
|
|
@@ -29,6 +31,8 @@ export const PageTitleHeader: FC<Props> = (props) => {
|
|
|
|
|
|
|
|
const currentPagePath = currentPage.path;
|
|
const currentPagePath = currentPage.path;
|
|
|
|
|
|
|
|
|
|
+ const isMovable = isMovablePage(currentPagePath);
|
|
|
|
|
+
|
|
|
const dPagePath = new DevidedPagePath(currentPage.path, true);
|
|
const dPagePath = new DevidedPagePath(currentPage.path, true);
|
|
|
const pageTitle = dPagePath.latter;
|
|
const pageTitle = dPagePath.latter;
|
|
|
|
|
|
|
@@ -64,9 +68,13 @@ export const PageTitleHeader: FC<Props> = (props) => {
|
|
|
}, [currentPagePath]);
|
|
}, [currentPagePath]);
|
|
|
|
|
|
|
|
const onClickPageTitle = useCallback(() => {
|
|
const onClickPageTitle = useCallback(() => {
|
|
|
|
|
+ if (!isMovable) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
setEditedPagePath(currentPagePath);
|
|
setEditedPagePath(currentPagePath);
|
|
|
setRenameInputShown(true);
|
|
setRenameInputShown(true);
|
|
|
- }, [currentPagePath]);
|
|
|
|
|
|
|
+ }, [currentPagePath, isMovable]);
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
@@ -86,7 +94,13 @@ export const PageTitleHeader: FC<Props> = (props) => {
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
) }
|
|
) }
|
|
|
- <h1 className={`mb-0 fs-4 ${isRenameInputShown ? 'invisible' : ''} text-truncate`} onClick={onClickPageTitle}>
|
|
|
|
|
|
|
+ <h1
|
|
|
|
|
+ className={`mb-0 px-2 fs-4
|
|
|
|
|
+ ${isRenameInputShown ? 'invisible' : ''} text-truncate
|
|
|
|
|
+ ${isMovable ? 'border border-2 rounded-2' : ''} ${borderColorClass}
|
|
|
|
|
+ `}
|
|
|
|
|
+ onClick={onClickPageTitle}
|
|
|
|
|
+ >
|
|
|
{pageTitle}
|
|
{pageTitle}
|
|
|
</h1>
|
|
</h1>
|
|
|
</div>
|
|
</div>
|
|
@@ -100,7 +114,7 @@ export const PageTitleHeader: FC<Props> = (props) => {
|
|
|
pageId={currentPage._id}
|
|
pageId={currentPage._id}
|
|
|
pagePath={currentPage.path}
|
|
pagePath={currentPage.path}
|
|
|
dropdownToggleId={`copydropdown-${currentPage._id}`}
|
|
dropdownToggleId={`copydropdown-${currentPage._id}`}
|
|
|
- dropdownToggleClassName="ms-2 p-1"
|
|
|
|
|
|
|
+ dropdownToggleClassName="p-1"
|
|
|
>
|
|
>
|
|
|
<span className="material-symbols-outlined fs-6">content_paste</span>
|
|
<span className="material-symbols-outlined fs-6">content_paste</span>
|
|
|
</CopyDropdown>
|
|
</CopyDropdown>
|