Change "Move" dialog appearance to match that of "Publish" dialog (#4787)
* refactor: receive items as props in DocumentExplore * refactor: leverage DocumentExplorer for DocumentMove * fix: keyboard shortcut for moving document * refactor: cleanup * Revert "refactor: cleanup" This reverts commit 9a0a98eff22934aeffa48d0bf899629b6e61617c. * fix: get rid of extra parent container * Revert "fix: get rid of extra parent container" This reverts commit 908eaf2bba5c8d6d1f4eeeaeb9674bc906af08f4. * refactor: remove PathToDocument component
This commit is contained in:
@@ -6,7 +6,6 @@ import * as React from "react";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import {
|
||||
Prompt,
|
||||
Route,
|
||||
RouteComponentProps,
|
||||
StaticContext,
|
||||
withRouter,
|
||||
@@ -28,7 +27,6 @@ import ConnectionStatus from "~/components/ConnectionStatus";
|
||||
import ErrorBoundary from "~/components/ErrorBoundary";
|
||||
import Flex from "~/components/Flex";
|
||||
import LoadingIndicator from "~/components/LoadingIndicator";
|
||||
import Modal from "~/components/Modal";
|
||||
import PageTitle from "~/components/PageTitle";
|
||||
import PlaceholderDocument from "~/components/PlaceholderDocument";
|
||||
import RegisterKeyDown from "~/components/RegisterKeyDown";
|
||||
@@ -39,7 +37,6 @@ import { replaceTitleVariables } from "~/utils/date";
|
||||
import { emojiToUrl } from "~/utils/emoji";
|
||||
import { isModKey } from "~/utils/keyboard";
|
||||
import {
|
||||
documentMoveUrl,
|
||||
documentHistoryUrl,
|
||||
editDocumentUrl,
|
||||
documentUrl,
|
||||
@@ -226,15 +223,15 @@ class DocumentScene extends React.Component<Props> {
|
||||
}
|
||||
};
|
||||
|
||||
goToMove = (ev: KeyboardEvent) => {
|
||||
if (!this.props.readOnly) {
|
||||
return;
|
||||
}
|
||||
onMove = (ev: React.MouseEvent | KeyboardEvent) => {
|
||||
ev.preventDefault();
|
||||
const { document, abilities } = this.props;
|
||||
|
||||
const { document, dialogs, t, abilities } = this.props;
|
||||
if (abilities.move) {
|
||||
this.props.history.push(documentMoveUrl(document));
|
||||
dialogs.openModal({
|
||||
title: t("Move document"),
|
||||
isCentered: true,
|
||||
content: <DocumentMove document={document} />,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -476,7 +473,7 @@ class DocumentScene extends React.Component<Props> {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<RegisterKeyDown trigger="m" handler={this.goToMove} />
|
||||
<RegisterKeyDown trigger="m" handler={this.onMove} />
|
||||
<RegisterKeyDown trigger="e" handler={this.goToEdit} />
|
||||
<RegisterKeyDown trigger="Escape" handler={this.goBack} />
|
||||
<RegisterKeyDown trigger="h" handler={this.goToHistory} />
|
||||
@@ -502,21 +499,6 @@ class DocumentScene extends React.Component<Props> {
|
||||
column
|
||||
auto
|
||||
>
|
||||
<Route
|
||||
path={`${document.url}/move`}
|
||||
component={() => (
|
||||
<Modal
|
||||
title={`Move ${document.noun}`}
|
||||
onRequestClose={this.goBack}
|
||||
isOpen
|
||||
>
|
||||
<DocumentMove
|
||||
document={document}
|
||||
onRequestClose={this.goBack}
|
||||
/>
|
||||
</Modal>
|
||||
)}
|
||||
/>
|
||||
<PageTitle
|
||||
title={document.titleWithDefault.replace(document.emoji || "", "")}
|
||||
favicon={document.emoji ? emojiToUrl(document.emoji) : undefined}
|
||||
|
||||
Reference in New Issue
Block a user