|
|
@@ -18,7 +18,7 @@ import {
|
|
|
useShareLinkId, useShareLinksNumber, useTemplateTagData, useCurrentUpdatedAt, useCreator, useRevisionAuthor, useCurrentUser, useTargetAndAncestors,
|
|
|
useNotFoundTargetPathOrId, useIsSearchPage, useIsForbidden, useIsIdenticalPath, useHasParent,
|
|
|
useIsAclEnabled, useIsSearchServiceConfigured, useIsSearchServiceReachable, useIsEnabledAttachTitleHeader, useIsNotFoundPermalink,
|
|
|
- useDefaultIndentSize, useIsIndentSizeForced, useCsrfToken, useIsEmptyPageInNotFoundContext,
|
|
|
+ useDefaultIndentSize, useIsIndentSizeForced, useCsrfToken, useIsEmptyPage,
|
|
|
} from '../../stores/context';
|
|
|
|
|
|
const { isTrashPage: _isTrashPage } = pagePathUtils;
|
|
|
@@ -29,7 +29,7 @@ const ContextExtractorOnce: FC = () => {
|
|
|
|
|
|
const mainContent = document.querySelector('#content-main');
|
|
|
const notFoundContentForPt = document.getElementById('growi-pagetree-not-found-context');
|
|
|
- const notFoundContent = document.getElementById('growi-not-found-context');
|
|
|
+ const notFoundContext = document.getElementById('growi-not-found-context');
|
|
|
const forbiddenContent = document.getElementById('forbidden-page');
|
|
|
|
|
|
// get csrf token from body element
|
|
|
@@ -57,7 +57,8 @@ const ContextExtractorOnce: FC = () => {
|
|
|
*/
|
|
|
const revisionId = mainContent?.getAttribute('data-page-revision-id');
|
|
|
const path = decodeURI(mainContent?.getAttribute('data-path') || '');
|
|
|
- const pageId = mainContent?.getAttribute('data-page-id') || notFoundContent?.getAttribute('data-page-id');
|
|
|
+ // assign `null` to avoid returning empty string
|
|
|
+ const pageId = (mainContent?.getAttribute('data-page-id') || notFoundContext?.getAttribute('data-page-id')) || null;
|
|
|
|
|
|
const revisionCreatedAt = +(mainContent?.getAttribute('data-page-revision-created') || '');
|
|
|
|
|
|
@@ -90,9 +91,9 @@ const ContextExtractorOnce: FC = () => {
|
|
|
const revisionAuthor = JSON.parse(mainContent?.getAttribute('data-page-revision-author') || jsonNull);
|
|
|
const targetAndAncestors = JSON.parse(document.getElementById('growi-pagetree-target-and-ancestors')?.textContent || jsonNull);
|
|
|
const notFoundTargetPathOrId = JSON.parse(notFoundContentForPt?.getAttribute('data-not-found-target-path-or-id') || jsonNull);
|
|
|
- const isNotFoundPermalink = JSON.parse(notFoundContent?.getAttribute('data-is-not-found-permalink') || jsonNull);
|
|
|
+ const isNotFoundPermalink = JSON.parse(notFoundContext?.getAttribute('data-is-not-found-permalink') || jsonNull);
|
|
|
const isSearchPage = document.getElementById('search-page') != null;
|
|
|
- const isEmptyPage = notFoundContent != null && pageId != null;
|
|
|
+ const isEmptyPage = JSON.parse(mainContent?.getAttribute('data-page-is-empty') || jsonNull) ?? false;
|
|
|
|
|
|
const grant = +(mainContent?.getAttribute('data-page-grant') || 1);
|
|
|
const grantGroupId = mainContent?.getAttribute('data-page-grant-group') || null;
|
|
|
@@ -153,7 +154,7 @@ const ContextExtractorOnce: FC = () => {
|
|
|
useNotFoundTargetPathOrId(notFoundTargetPathOrId);
|
|
|
useIsNotFoundPermalink(isNotFoundPermalink);
|
|
|
useIsSearchPage(isSearchPage);
|
|
|
- useIsEmptyPageInNotFoundContext(isEmptyPage);
|
|
|
+ useIsEmptyPage(isEmptyPage);
|
|
|
useHasParent(hasParent);
|
|
|
|
|
|
// Navigation
|