diff --git a/app/components/Editor/Editor.js b/app/components/Editor/Editor.js index 139bcbe7d..fa6d92054 100644 --- a/app/components/Editor/Editor.js +++ b/app/components/Editor/Editor.js @@ -17,6 +17,7 @@ import embeds from '../../embeds'; type Props = { defaultValue?: string, readOnly?: boolean, + grow?: boolean, disableEmbeds?: boolean, forwardedRef: React.Ref, ui: UiStore, @@ -103,6 +104,7 @@ class Editor extends React.Component { } const StyledEditor = styled(RichMarkdownEditor)` + flex-grow: ${props => (props.grow ? 'initial' : '0')}; justify-content: start; > div { diff --git a/app/menus/DocumentMenu.js b/app/menus/DocumentMenu.js index 7cc473e5d..edfd38b13 100644 --- a/app/menus/DocumentMenu.js +++ b/app/menus/DocumentMenu.js @@ -188,9 +188,9 @@ class DocumentMenu extends React.Component { {can.update && ( - New child document + New nested document )} {can.update && ( diff --git a/app/menus/NewChildDocumentMenu.js b/app/menus/NewChildDocumentMenu.js index fbcdb818d..70bb98d6c 100644 --- a/app/menus/NewChildDocumentMenu.js +++ b/app/menus/NewChildDocumentMenu.js @@ -49,7 +49,7 @@ class NewChildDocumentMenu extends React.Component { - New child document + New nested document ); diff --git a/app/models/Document.js b/app/models/Document.js index 79a400855..4fe1819a8 100644 --- a/app/models/Document.js +++ b/app/models/Document.js @@ -52,6 +52,19 @@ export default class Document extends BaseModel { } } + @computed + get isOnlyTitle(): boolean { + const { title } = parseTitle(this.text); + + // find and extract title + const trimmedBody = this.text + .trim() + .replace(/^#/, '') + .trim(); + + return unescape(trimmedBody) === title; + } + @computed get modifiedSinceViewed(): boolean { return !!this.lastViewedAt && this.lastViewedAt < this.updatedAt; diff --git a/app/scenes/Document/Document.js b/app/scenes/Document/Document.js index e1d8ece76..a6674829a 100644 --- a/app/scenes/Document/Document.js +++ b/app/scenes/Document/Document.js @@ -440,7 +440,11 @@ class DocumentScene extends React.Component { schema={schema} /> {!this.isEditing && - !isShare && } + !isShare && ( + + + + )} @@ -450,6 +454,10 @@ class DocumentScene extends React.Component { } } +const ReferencesWrapper = styled('div')` + margin-top: ${props => (props.isOnlyTitle ? -45 : 16)}px; +`; + const MaxWidth = styled(Flex)` ${props => props.archived && `* { color: ${props.theme.textSecondary} !important; } `}; diff --git a/app/scenes/Document/components/Editor.js b/app/scenes/Document/components/Editor.js index a2268884c..527531f59 100644 --- a/app/scenes/Document/components/Editor.js +++ b/app/scenes/Document/components/Editor.js @@ -34,12 +34,10 @@ class DocumentEditor extends React.Component { (this.editor = ref)} plugins={plugins} + grow={!readOnly} {...this.props} /> - + {!readOnly && } ); } diff --git a/app/scenes/Document/components/References.js b/app/scenes/Document/components/References.js index 4d35a7bef..2fcca1b0c 100644 --- a/app/scenes/Document/components/References.js +++ b/app/scenes/Document/components/References.js @@ -42,7 +42,7 @@ class References extends React.Component { {showChildren && ( !isBacklinksTab}> - Child documents + Nested documents )} {showBacklinks && ( diff --git a/app/scenes/DocumentDelete.js b/app/scenes/DocumentDelete.js index 10fad808d..451802ad3 100644 --- a/app/scenes/DocumentDelete.js +++ b/app/scenes/DocumentDelete.js @@ -51,7 +51,7 @@ class DocumentDelete extends React.Component { Are you sure about that? Deleting the{' '} {document.title} document will delete all of its - history, and any child documents. + history, and any nested documents. {!document.isDraft && !document.isArchived && ( diff --git a/server/pages/developers/Api.js b/server/pages/developers/Api.js index c90d1e4ff..599c998b6 100644 --- a/server/pages/developers/Api.js +++ b/server/pages/developers/Api.js @@ -439,7 +439,7 @@ export default function Api() { - Archive a document and all of its child documents, if any. + Archive a document and all of its nested documents, if any. - Permanantly delete a document and all of its child documents, if + Permanantly delete a document and all of its nested documents, if any.