|
@@ -12,11 +12,10 @@ import AppContainer from '~/client/services/AppContainer';
|
|
|
import EditorContainer from '~/client/services/EditorContainer';
|
|
import EditorContainer from '~/client/services/EditorContainer';
|
|
|
import PageContainer from '~/client/services/PageContainer';
|
|
import PageContainer from '~/client/services/PageContainer';
|
|
|
import { getOptionsToSave } from '~/client/util/editor';
|
|
import { getOptionsToSave } from '~/client/util/editor';
|
|
|
-import { isEnabledShowUnsavedWarning } from '~/client/util/editor';
|
|
|
|
|
|
|
|
|
|
// TODO: remove this when omitting unstated is completed
|
|
// TODO: remove this when omitting unstated is completed
|
|
|
import { useIsEditable, useCurrentPageId } from '~/stores/context';
|
|
import { useIsEditable, useCurrentPageId } from '~/stores/context';
|
|
|
-import { usePageTagsForEditors } from '~/stores/editor';
|
|
|
|
|
|
|
+import { usePageTagsForEditors, useUnsavedWarning } from '~/stores/editor';
|
|
|
import {
|
|
import {
|
|
|
useEditorMode, useSelectedGrant, useSelectedGrantGroupId, useSelectedGrantGroupName,
|
|
useEditorMode, useSelectedGrant, useSelectedGrantGroupId, useSelectedGrantGroupName,
|
|
|
} from '~/stores/ui';
|
|
} from '~/stores/ui';
|
|
@@ -55,7 +54,7 @@ class SavePageControls extends React.Component {
|
|
|
isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageContainer, editorContainer, pageTags,
|
|
isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageContainer, editorContainer, pageTags,
|
|
|
} = this.props;
|
|
} = this.props;
|
|
|
// disable unsaved warning
|
|
// disable unsaved warning
|
|
|
- isEnabledShowUnsavedWarning(false)
|
|
|
|
|
|
|
+ mutateIsEnabledUnsavedWarning(false)
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
// save
|
|
// save
|
|
@@ -81,7 +80,7 @@ class SavePageControls extends React.Component {
|
|
|
isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageContainer, editorContainer, pageTags,
|
|
isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageContainer, editorContainer, pageTags,
|
|
|
} = this.props;
|
|
} = this.props;
|
|
|
// disable unsaved warning
|
|
// disable unsaved warning
|
|
|
- isEnabledShowUnsavedWarning(false)
|
|
|
|
|
|
|
+ mutateIsEnabledUnsavedWarning(false)
|
|
|
// save
|
|
// save
|
|
|
const currentOptionsToSave = getOptionsToSave(isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageTags);
|
|
const currentOptionsToSave = getOptionsToSave(isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageTags);
|
|
|
const optionsToSave = Object.assign(currentOptionsToSave, {
|
|
const optionsToSave = Object.assign(currentOptionsToSave, {
|
|
@@ -147,6 +146,7 @@ const SavePageControlsWrapper = (props) => {
|
|
|
const { data: grantGroupName, mutate: mutateGrantGroupName } = useSelectedGrantGroupName();
|
|
const { data: grantGroupName, mutate: mutateGrantGroupName } = useSelectedGrantGroupName();
|
|
|
const { data: pageId } = useCurrentPageId();
|
|
const { data: pageId } = useCurrentPageId();
|
|
|
const { data: pageTags } = usePageTagsForEditors(pageId);
|
|
const { data: pageTags } = usePageTagsForEditors(pageId);
|
|
|
|
|
+ const { mutate: mutateIsEnabledUnsavedWarning} = useUnsavedWarning();
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isEditable == null || editorMode == null) {
|
|
if (isEditable == null || editorMode == null) {
|
|
@@ -168,6 +168,7 @@ const SavePageControlsWrapper = (props) => {
|
|
|
mutateGrant={mutateGrant}
|
|
mutateGrant={mutateGrant}
|
|
|
mutateGrantGroupId={mutateGrantGroupId}
|
|
mutateGrantGroupId={mutateGrantGroupId}
|
|
|
mutateGrantGroupName={mutateGrantGroupName}
|
|
mutateGrantGroupName={mutateGrantGroupName}
|
|
|
|
|
+ mutateIsEnabledUnsavedWarning={mutateIsEnabledUnsavedWarning}
|
|
|
pageTags={pageTags}
|
|
pageTags={pageTags}
|
|
|
/>
|
|
/>
|
|
|
);
|
|
);
|
|
@@ -191,6 +192,7 @@ SavePageControls.propTypes = {
|
|
|
mutateGrant: PropTypes.func,
|
|
mutateGrant: PropTypes.func,
|
|
|
mutateGrantGroupId: PropTypes.func,
|
|
mutateGrantGroupId: PropTypes.func,
|
|
|
mutateGrantGroupName: PropTypes.func,
|
|
mutateGrantGroupName: PropTypes.func,
|
|
|
|
|
+ mutateIsEnabledUnsavedWarning: PropTypes.func,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export default SavePageControlsWrapper;
|
|
export default SavePageControlsWrapper;
|