diff --git a/.githooks/pre-commit/flow.sh b/.githooks/pre-commit/flow.sh deleted file mode 100644 index 4d946a70dc..0000000000 --- a/.githooks/pre-commit/flow.sh +++ /dev/null @@ -1 +0,0 @@ -yarn flow \ No newline at end of file diff --git a/app/components/Editor/Embed.js b/app/components/Editor/Embed.js deleted file mode 100644 index eee6e86f19..0000000000 --- a/app/components/Editor/Embed.js +++ /dev/null @@ -1,50 +0,0 @@ -// @flow -import * as React from 'react'; -import styled from 'styled-components'; -import { fadeIn } from 'shared/styles/animations'; -import embeds from '../../embeds'; - -export default class Embed extends React.Component<*> { - get url(): string { - return this.props.attrs.href; - } - - getMatchResults(): ?{ component: *, matches: string[] } { - const keys = Object.keys(embeds); - - for (const key of keys) { - const component = embeds[key]; - - for (const host of component.ENABLED) { - const matches = this.url.match(host); - if (matches) return { component, matches }; - } - } - } - - render() { - const result = this.getMatchResults(); - if (!result) return null; - - const { isSelected, children } = this.props; - const { component, matches } = result; - const EmbedComponent = component; - - return ( - - - {children} - - ); - } -} - -const Container = styled.div` - text-align: center; - animation: ${fadeIn} 500ms ease-in-out; - line-height: 0; - - border-radius: 3px; - box-shadow: ${props => - props.isSelected ? `0 0 0 2px ${props.theme.selected}` : 'none'}; -`; diff --git a/app/components/Layout.js b/app/components/Layout.js index 04915caf25..acbdd40639 100644 --- a/app/components/Layout.js +++ b/app/components/Layout.js @@ -59,6 +59,7 @@ class Layout extends React.Component { @keydown('shift+/') handleOpenKeyboardShortcuts() { + if (this.props.ui.editMode) return; this.keyboardShortcutsOpen = true; } diff --git a/app/components/Sidebar/Settings.js b/app/components/Sidebar/Settings.js index 85b46712cd..866922d4fc 100644 --- a/app/components/Sidebar/Settings.js +++ b/app/components/Sidebar/Settings.js @@ -2,6 +2,7 @@ import * as React from 'react'; import { observer, inject } from 'mobx-react'; import type { RouterHistory } from 'react-router-dom'; +import styled from 'styled-components'; import { DocumentIcon, EmailIcon, @@ -13,6 +14,7 @@ import { LinkIcon, TeamIcon, BulletedListIcon, + ExpandedIcon, } from 'outline-icons'; import ZapierIcon from './icons/Zapier'; import SlackIcon from './icons/Slack'; @@ -49,7 +51,11 @@ class SettingsSidebar extends React.Component { return ( + Return to App + + } teamName={team.name} logoUrl={team.avatarUrl} onClick={this.returnToDashboard} @@ -145,4 +151,13 @@ class SettingsSidebar extends React.Component { } } +const BackIcon = styled(ExpandedIcon)` + transform: rotate(90deg); + margin-left: -8px; +`; + +const ReturnToApp = styled(Flex)` + height: 16px; +`; + export default inject('auth', 'policies')(SettingsSidebar); diff --git a/app/components/Sidebar/components/Collections.js b/app/components/Sidebar/components/Collections.js index f70cca7049..eb066e7252 100644 --- a/app/components/Sidebar/components/Collections.js +++ b/app/components/Sidebar/components/Collections.js @@ -17,6 +17,7 @@ import { import Header from './Header'; import SidebarLink from './SidebarLink'; import CollectionLink from './CollectionLink'; +import CollectionsLoading from './CollectionsLoading'; import Fade from 'components/Fade'; import CollectionsStore from 'stores/CollectionsStore'; @@ -152,8 +153,7 @@ class Collections extends React.Component { const { draggingDocumentId } = this.state; const content = ( - -
Collections
+ { label="New collection…" exact /> -
+ ); return ( - collections.isLoaded && - (this.isPreloaded ? content : {content}) + +
Collections
+ {collections.isLoaded ? ( + this.isPreloaded ? ( + content + ) : ( + {content} + ) + ) : ( + + )} +
); } } diff --git a/app/components/Sidebar/components/CollectionsLoading.js b/app/components/Sidebar/components/CollectionsLoading.js new file mode 100644 index 0000000000..f3e488949e --- /dev/null +++ b/app/components/Sidebar/components/CollectionsLoading.js @@ -0,0 +1,21 @@ +// @flow +import * as React from 'react'; +import styled from 'styled-components'; +import Mask from 'components/Mask'; + +function CollectionsLoading() { + return ( + + + + + + ); +} + +const Wrapper = styled.div` + margin: 4px 16px; + width: 75%; +`; + +export default CollectionsLoading; diff --git a/app/components/SocketProvider.js b/app/components/SocketProvider.js index 43d179fdc2..4cc857dfee 100644 --- a/app/components/SocketProvider.js +++ b/app/components/SocketProvider.js @@ -128,22 +128,6 @@ class SocketProvider extends React.Component { }); } } - - // TODO: Move this to the document scene once data loading - // has been refactored to be friendlier there. - if ( - auth.user && - documentId === ui.activeDocumentId && - document.updatedBy.id !== auth.user.id - ) { - ui.showToast(`Document updated by ${document.updatedBy.name}`, { - timeout: 30 * 1000, - action: { - text: 'Refresh', - onClick: () => window.location.reload(), - }, - }); - } } } diff --git a/app/embeds/Gist.js b/app/embeds/Gist.js index 7992a46e2f..23abdd1446 100644 --- a/app/embeds/Gist.js +++ b/app/embeds/Gist.js @@ -31,10 +31,21 @@ class Gist extends React.Component { const iframe = this.iframeNode; if (!iframe) return; + // We need to add some temporary content to the iframe for the document + // to be available, otherwise it's undefined on first load + const temp = document.getElementById('gist'); + if (temp) { + temp.innerHTML = ''; + temp.appendChild(iframe); + } + // $FlowFixMe let doc = iframe.document; - if (iframe.contentDocument) doc = iframe.contentDocument; - else if (iframe.contentWindow) doc = iframe.contentWindow.document; + if (iframe.contentDocument) { + doc = iframe.contentDocument; + } else if (iframe.contentWindow) { + doc = iframe.contentWindow.document; + } const gistLink = `https://gist.github.com/${id}.js`; const gistScript = `