|
|
@@ -14,7 +14,8 @@ import PageContainer from '~/client/services/PageContainer';
|
|
|
import { getOptionsToSave } from '~/client/util/editor';
|
|
|
|
|
|
// TODO: remove this when omitting unstated is completed
|
|
|
-import { useIsEditable } from '~/stores/context';
|
|
|
+import { useIsEditable, useCurrentPageId } from '~/stores/context';
|
|
|
+import { useSWRTagsInfo } from '~/stores/page';
|
|
|
import {
|
|
|
useEditorMode, useSelectedGrant, useSelectedGrantGroupId, useSelectedGrantGroupName,
|
|
|
} from '~/stores/ui';
|
|
|
@@ -50,14 +51,14 @@ class SavePageControls extends React.Component {
|
|
|
|
|
|
async save() {
|
|
|
const {
|
|
|
- isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageContainer, editorContainer,
|
|
|
+ isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageContainer, editorContainer, pageTags,
|
|
|
} = this.props;
|
|
|
// disable unsaved warning
|
|
|
editorContainer.disableUnsavedWarning();
|
|
|
|
|
|
try {
|
|
|
// save
|
|
|
- const optionsToSave = getOptionsToSave(isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, editorContainer);
|
|
|
+ const optionsToSave = getOptionsToSave(isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageTags);
|
|
|
await pageContainer.saveAndReload(optionsToSave, this.props.editorMode);
|
|
|
}
|
|
|
catch (error) {
|
|
|
@@ -76,12 +77,12 @@ class SavePageControls extends React.Component {
|
|
|
|
|
|
saveAndOverwriteScopesOfDescendants() {
|
|
|
const {
|
|
|
- isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageContainer, editorContainer,
|
|
|
+ isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageContainer, editorContainer, pageTags,
|
|
|
} = this.props;
|
|
|
// disable unsaved warning
|
|
|
editorContainer.disableUnsavedWarning();
|
|
|
// save
|
|
|
- const currentOptionsToSave = getOptionsToSave(isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, editorContainer);
|
|
|
+ const currentOptionsToSave = getOptionsToSave(isSlackEnabled, slackChannels, grant, grantGroupId, grantGroupName, pageTags);
|
|
|
const optionsToSave = Object.assign(currentOptionsToSave, {
|
|
|
overwriteScopesOfDescendants: true,
|
|
|
});
|
|
|
@@ -143,6 +144,8 @@ const SavePageControlsWrapper = (props) => {
|
|
|
const { data: grant, mutate: mutateGrant } = useSelectedGrant();
|
|
|
const { data: grantGroupId, mutate: mutateGrantGroupId } = useSelectedGrantGroupId();
|
|
|
const { data: grantGroupName, mutate: mutateGrantGroupName } = useSelectedGrantGroupName();
|
|
|
+ const { data: pageId } = useCurrentPageId();
|
|
|
+ const { data: tagsInfoData } = useSWRTagsInfo(pageId);
|
|
|
|
|
|
|
|
|
if (isEditable == null || editorMode == null) {
|
|
|
@@ -164,6 +167,7 @@ const SavePageControlsWrapper = (props) => {
|
|
|
mutateGrant={mutateGrant}
|
|
|
mutateGrantGroupId={mutateGrantGroupId}
|
|
|
mutateGrantGroupName={mutateGrantGroupName}
|
|
|
+ pageTags={tagsInfoData?.tags || []}
|
|
|
/>
|
|
|
);
|
|
|
};
|
|
|
@@ -179,6 +183,7 @@ SavePageControls.propTypes = {
|
|
|
editorMode: PropTypes.string.isRequired,
|
|
|
isSlackEnabled: PropTypes.bool.isRequired,
|
|
|
slackChannels: PropTypes.string.isRequired,
|
|
|
+ pageTags: PropTypes.arrayOf(PropTypes.string),
|
|
|
grant: PropTypes.number.isRequired,
|
|
|
grantGroupId: PropTypes.string,
|
|
|
grantGroupName: PropTypes.string,
|