This commit is contained in:
Jori Lallo
2018-01-03 21:35:13 -08:00
parent 2fd5fc2dff
commit 2c9e92e5b9
19 changed files with 130 additions and 215 deletions

View File

@@ -2,7 +2,7 @@
import React from 'react';
import Document from 'models/Document';
import DocumentPreview from 'components/DocumentPreview';
import ArrowKeyNavigation from 'boundless-arrow-key-navigation/build';
import ArrowKeyNavigation from 'boundless-arrow-key-navigation';
class DocumentList extends React.Component {
props: {

View File

@@ -24,12 +24,12 @@ import styled from 'styled-components';
type Props = {
text: string,
onChange: Change => *,
onSave: (redirect?: boolean) => *,
onCancel: () => void,
onImageUploadStart: () => void,
onImageUploadStop: () => void,
emoji ?: string,
readOnly: boolean,
onSave: (redirect?: boolean) => *,
onCancel: () => void,
onImageUploadStart: () => void,
onImageUploadStop: () => void,
emoji?: string,
readOnly: boolean,
};
@observer
@@ -216,13 +216,13 @@ class MarkdownEditor extends Component {
};
}
const MaxWidth = styled(Flex) `
const MaxWidth = styled(Flex)`
margin: 0 60px;
max-width: 46em;
height: 100%;
`;
const Header = styled(Flex) `
const Header = styled(Flex)`
height: 60px;
flex-shrink: 0;
align-items: flex-end;
@@ -233,7 +233,7 @@ const Header = styled(Flex) `
}
`;
const StyledEditor = styled(Editor) `
const StyledEditor = styled(Editor)`
font-weight: 400;
font-size: 1em;
line-height: 1.7em;

View File

@@ -6,7 +6,6 @@ import { Portal } from 'react-portal';
import { Editor, findDOMNode } from 'slate-react';
import { Node, Value } from 'slate';
import styled from 'styled-components';
import _ from 'lodash';
import FormattingToolbar from './components/FormattingToolbar';
import LinkToolbar from './components/LinkToolbar';

View File

@@ -7,7 +7,7 @@ import { withRouter } from 'react-router-dom';
import { Node } from 'slate';
import { Editor } from 'slate-react';
import styled from 'styled-components';
import ArrowKeyNavigation from 'boundless-arrow-key-navigation/build';
import ArrowKeyNavigation from 'boundless-arrow-key-navigation';
import ToolbarButton from './ToolbarButton';
import DocumentResult from './DocumentResult';
import DocumentsStore from 'stores/DocumentsStore';

View File

@@ -32,7 +32,12 @@ class ErrorBoundary extends Component {
return (
<CenteredContent>
<PageTitle title="Something went wrong" />
<h1>🛸 Something unexpected happened</h1>
<h1>
<span role="img" aria-label="Space ship">
🛸
</span>{' '}
Something unexpected happened
</h1>
<p>
An unrecoverable error occurred{window.Bugsnag ||
(true && ' and our engineers have been notified')}. Please try{' '}

View File

@@ -166,6 +166,7 @@ const DocumentLink = observer(
activeDocumentRef,
prefetchDocument,
depth,
history,
}: DocumentLinkProps) => {
const isActiveDocument =
activeDocument && activeDocument.id === document.id;

View File

@@ -1,7 +1,6 @@
// @flow
import { extendObservable, action, computed, runInAction } from 'mobx';
import invariant from 'invariant';
import _ from 'lodash';
import BaseModel from 'models/BaseModel';
import { client } from 'utils/ApiClient';

View File

@@ -25,7 +25,6 @@ import DocumentsStore from 'stores/DocumentsStore';
import CollectionsStore from 'stores/CollectionsStore';
import DocumentMenu from 'menus/DocumentMenu';
import SaveAction from './components/SaveAction';
import type EditorType from 'components/Editor';
import LoadingPlaceholder from 'components/LoadingPlaceholder';
import LoadingIndicator from 'components/LoadingIndicator';
import Collaborators from 'components/Collaborators';
@@ -238,77 +237,77 @@ class DocumentScene extends Component {
<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}
<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>
)}
</Action>
</Actions>
</Flex>
)}
</ErrorBoundary>
</Container>
);
}
}
const Container = styled(Flex) `
const Container = styled(Flex)`
position: relative;
`;
const LoadingState = styled(LoadingPlaceholder) `
const LoadingState = styled(LoadingPlaceholder)`
margin: 90px 0;
`;

View File

@@ -5,7 +5,7 @@ import { observable, computed } from 'mobx';
import { observer, inject } from 'mobx-react';
import { withRouter } from 'react-router-dom';
import { Search } from 'js-search';
import ArrowKeyNavigation from 'boundless-arrow-key-navigation/build';
import ArrowKeyNavigation from 'boundless-arrow-key-navigation';
import _ from 'lodash';
import styled from 'styled-components';
import { size } from 'shared/styles/constants';

View File

@@ -2,7 +2,6 @@
import React from 'react';
import { observer } from 'mobx-react';
import invariant from 'invariant';
import _ from 'lodash';
import styled from 'styled-components';
import { color } from 'shared/styles/constants';

View File

@@ -13,7 +13,7 @@ import DocumentsStore, {
import { withRouter } from 'react-router-dom';
import { searchUrl } from 'utils/routeHelpers';
import styled from 'styled-components';
import ArrowKeyNavigation from 'boundless-arrow-key-navigation/build';
import ArrowKeyNavigation from 'boundless-arrow-key-navigation';
import Empty from 'components/Empty';
import Flex from 'shared/components/Flex';