|
|
@@ -1,5 +1,7 @@
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
|
|
+import EventEmitter from 'events';
|
|
|
+
|
|
|
import { pagePathUtils, PageGrant } from '@growi/core';
|
|
|
import { useTranslation } from 'next-i18next';
|
|
|
import {
|
|
|
@@ -7,8 +9,6 @@ import {
|
|
|
DropdownToggle, DropdownMenu, DropdownItem,
|
|
|
} from 'reactstrap';
|
|
|
|
|
|
-// import PageContainer from '~/client/services/PageContainer';
|
|
|
-import { CustomWindow } from '~/interfaces/global';
|
|
|
import { IPageGrantData } from '~/interfaces/page';
|
|
|
import {
|
|
|
useIsEditable, useCurrentPageId, useIsAclEnabled,
|
|
|
@@ -20,17 +20,13 @@ import loggerFactory from '~/utils/logger';
|
|
|
|
|
|
import GrantSelector from './SavePageControls/GrantSelector';
|
|
|
|
|
|
-// import { withUnstatedContainers } from './UnstatedUtils';
|
|
|
+declare const globalEmitter: EventEmitter;
|
|
|
|
|
|
const logger = loggerFactory('growi:SavePageControls');
|
|
|
|
|
|
-type Props = {
|
|
|
- // pageContainer: PropTypes.instanceOf(PageContainer).isRequired,
|
|
|
-}
|
|
|
-
|
|
|
const { isTopPage } = pagePathUtils;
|
|
|
|
|
|
-export const SavePageControls = (props: Props): JSX.Element | null => {
|
|
|
+export const SavePageControls = (): JSX.Element | null => {
|
|
|
const { t } = useTranslation();
|
|
|
const { data: currentPagePath } = useCurrentPagePath();
|
|
|
const { data: isEditable } = useIsEditable();
|
|
|
@@ -45,12 +41,12 @@ export const SavePageControls = (props: Props): JSX.Element | null => {
|
|
|
|
|
|
const save = useCallback(async(): Promise<void> => {
|
|
|
// save
|
|
|
- (window as CustomWindow).globalEmitter.emit('saveAndReturnToView');
|
|
|
+ globalEmitter.emit('saveAndReturnToView');
|
|
|
}, []);
|
|
|
|
|
|
const saveAndOverwriteScopesOfDescendants = useCallback(() => {
|
|
|
// save
|
|
|
- (window as CustomWindow).globalEmitter.emit('saveAndReturnToView', { overwriteScopesOfDescendants: true });
|
|
|
+ globalEmitter.emit('saveAndReturnToView', { overwriteScopesOfDescendants: true });
|
|
|
}, []);
|
|
|
|
|
|
|