remove-error-boundary
This commit is contained in:
parent
8cdc09339b
commit
d65f7577d4
|
@ -32,7 +32,6 @@ import CenteredContent from 'components/CenteredContent';
|
|||
import PageTitle from 'components/PageTitle';
|
||||
import NewDocumentIcon from 'components/Icon/NewDocumentIcon';
|
||||
import Actions, { Action, Separator } from 'components/Actions';
|
||||
import ErrorBoundary from 'components/ErrorBoundary';
|
||||
import Search from 'scenes/Search';
|
||||
|
||||
const DISCARD_CHANGES = `
|
||||
|
@ -228,76 +227,74 @@ class DocumentScene extends Component {
|
|||
|
||||
return (
|
||||
<Container column auto>
|
||||
<ErrorBoundary key={this.props.location.pathname}>
|
||||
{isMoving && document && <DocumentMove document={document} />}
|
||||
{titleText && <PageTitle title={titleText} />}
|
||||
{(this.isLoading || this.isSaving) && <LoadingIndicator />}
|
||||
{!document || !Editor ? (
|
||||
<CenteredContent>
|
||||
<LoadingState />
|
||||
</CenteredContent>
|
||||
) : (
|
||||
<Flex justify="center" auto>
|
||||
{this.isEditing && (
|
||||
<Prompt
|
||||
when={document.hasPendingChanges}
|
||||
message={DISCARD_CHANGES}
|
||||
/>
|
||||
)}
|
||||
<Editor
|
||||
text={document.text}
|
||||
emoji={document.emoji}
|
||||
onImageUploadStart={this.onImageUploadStart}
|
||||
onImageUploadStop={this.onImageUploadStop}
|
||||
onChange={this.onChange}
|
||||
onSave={this.onSave}
|
||||
onCancel={this.onDiscard}
|
||||
readOnly={!this.isEditing}
|
||||
{isMoving && document && <DocumentMove document={document} />}
|
||||
{titleText && <PageTitle title={titleText} />}
|
||||
{(this.isLoading || this.isSaving) && <LoadingIndicator />}
|
||||
{!document || !Editor ? (
|
||||
<CenteredContent>
|
||||
<LoadingState />
|
||||
</CenteredContent>
|
||||
) : (
|
||||
<Flex justify="center" auto>
|
||||
{this.isEditing && (
|
||||
<Prompt
|
||||
when={document.hasPendingChanges}
|
||||
message={DISCARD_CHANGES}
|
||||
/>
|
||||
<Actions
|
||||
align="center"
|
||||
justify="flex-end"
|
||||
readOnly={!this.isEditing}
|
||||
>
|
||||
{!isNew &&
|
||||
!this.isEditing && <Collaborators document={document} />}
|
||||
<Action>
|
||||
{this.isEditing ? (
|
||||
<SaveAction
|
||||
isSaving={this.isSaving}
|
||||
onClick={this.onSave.bind(this, true)}
|
||||
disabled={
|
||||
!(this.document && this.document.allowSave) ||
|
||||
this.isSaving
|
||||
}
|
||||
isNew={!!isNew}
|
||||
/>
|
||||
) : (
|
||||
<a onClick={this.onClickEdit}>Edit</a>
|
||||
)}
|
||||
</Action>
|
||||
{this.isEditing && (
|
||||
<Action>
|
||||
<a onClick={this.onDiscard}>Discard</a>
|
||||
</Action>
|
||||
)}
|
||||
<Editor
|
||||
text={document.text}
|
||||
emoji={document.emoji}
|
||||
onImageUploadStart={this.onImageUploadStart}
|
||||
onImageUploadStop={this.onImageUploadStop}
|
||||
onChange={this.onChange}
|
||||
onSave={this.onSave}
|
||||
onCancel={this.onDiscard}
|
||||
readOnly={!this.isEditing}
|
||||
/>
|
||||
<Actions
|
||||
align="center"
|
||||
justify="flex-end"
|
||||
readOnly={!this.isEditing}
|
||||
>
|
||||
{!isNew &&
|
||||
!this.isEditing && <Collaborators document={document} />}
|
||||
<Action>
|
||||
{this.isEditing ? (
|
||||
<SaveAction
|
||||
isSaving={this.isSaving}
|
||||
onClick={this.onSave.bind(this, true)}
|
||||
disabled={
|
||||
!(this.document && this.document.allowSave) ||
|
||||
this.isSaving
|
||||
}
|
||||
isNew={!!isNew}
|
||||
/>
|
||||
) : (
|
||||
<a onClick={this.onClickEdit}>Edit</a>
|
||||
)}
|
||||
</Action>
|
||||
{this.isEditing && (
|
||||
<Action>
|
||||
<a onClick={this.onDiscard}>Discard</a>
|
||||
</Action>
|
||||
)}
|
||||
{!this.isEditing && (
|
||||
<Action>
|
||||
<DocumentMenu document={document} />
|
||||
</Action>
|
||||
)}
|
||||
{!this.isEditing && <Separator />}
|
||||
<Action>
|
||||
{!this.isEditing && (
|
||||
<Action>
|
||||
<DocumentMenu document={document} />
|
||||
</Action>
|
||||
<a onClick={this.onClickNew}>
|
||||
<NewDocumentIcon />
|
||||
</a>
|
||||
)}
|
||||
{!this.isEditing && <Separator />}
|
||||
<Action>
|
||||
{!this.isEditing && (
|
||||
<a onClick={this.onClickNew}>
|
||||
<NewDocumentIcon />
|
||||
</a>
|
||||
)}
|
||||
</Action>
|
||||
</Actions>
|
||||
</Flex>
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
</Action>
|
||||
</Actions>
|
||||
</Flex>
|
||||
)}
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
|
Reference in New Issue