diff --git a/app/components/Tab.js b/app/components/Tab.js
index 627a1c1275..0da5040922 100644
--- a/app/components/Tab.js
+++ b/app/components/Tab.js
@@ -43,18 +43,4 @@ function Tab({ theme, ...rest }: Props) {
return ;
}
-const TabWithTheme = withTheme(Tab);
-
-const RightTabWithTheme = styled(TabWithTheme)`
- position: absolute;
- right: 0;
-
- margin-left: 24px;
- margin-right: 0;
-`;
-
-export function RightTab(props: Object) {
- return ;
-}
-
-export default TabWithTheme;
+export default withTheme(Tab);
diff --git a/app/menus/DocumentMenu.js b/app/menus/DocumentMenu.js
index 03561994b8..0977ebc368 100644
--- a/app/menus/DocumentMenu.js
+++ b/app/menus/DocumentMenu.js
@@ -264,7 +264,7 @@ class DocumentMenu extends React.Component {
)}
diff --git a/app/menus/NewFromTemplateMenu.js b/app/menus/NewFromTemplateMenu.js
index cac5acb82b..a1dcb49ecb 100644
--- a/app/menus/NewFromTemplateMenu.js
+++ b/app/menus/NewFromTemplateMenu.js
@@ -3,7 +3,7 @@ import * as React from "react";
import { observable } from "mobx";
import { observer } from "mobx-react";
import { Redirect } from "react-router-dom";
-import { PlusIcon, DocumentIcon } from "outline-icons";
+import { EditIcon, DocumentIcon } from "outline-icons";
import styled from "styled-components";
import { newDocumentUrl } from "utils/routeHelpers";
@@ -59,8 +59,8 @@ class NewFromTemplateMenu extends React.Component {
{...rest}
>
this.handleNewDocument(collection.id)}>
-
- New document
+
+ Blank document
{templates.map(template => (
diff --git a/app/models/Document.js b/app/models/Document.js
index c738f69698..4157f05c40 100644
--- a/app/models/Document.js
+++ b/app/models/Document.js
@@ -35,14 +35,26 @@ export default class Document extends BaseModel {
title: string;
emoji: string;
template: boolean;
+ templateId: ?string;
parentDocumentId: ?string;
publishedAt: ?string;
archivedAt: string;
deletedAt: ?string;
url: string;
urlId: string;
+ originalTitle: string;
revision: number;
+ constructor(fields: Object, store: DocumentsStore) {
+ super(fields, store);
+
+ this.originalTitle = this.title;
+
+ if (this.isNew && this.isFromTemplate) {
+ this.title = "";
+ }
+ }
+
get emoji() {
const { emoji } = parseTitle(this.title);
return emoji;
@@ -102,6 +114,23 @@ export default class Document extends BaseModel {
return addDays(new Date(this.deletedAt), 30).toString();
}
+ @computed
+ get isNew(): boolean {
+ return this.createdAt === this.updatedAt;
+ }
+
+ @computed
+ get isFromTemplate(): boolean {
+ return !!this.templateId;
+ }
+
+ @computed
+ get placeholder(): ?string {
+ return this.isNew && this.isFromTemplate
+ ? this.originalTitle
+ : this.isTemplate ? "Start your template…" : "Start with a title…";
+ }
+
@action
share = async () => {
return this.store.rootStore.shares.create({ documentId: this.id });
diff --git a/app/scenes/Collection.js b/app/scenes/Collection.js
index 1abfa2b2fb..87d01c92bd 100644
--- a/app/scenes/Collection.js
+++ b/app/scenes/Collection.js
@@ -34,7 +34,7 @@ import Flex from "components/Flex";
import Modal from "components/Modal";
import CollectionMembers from "scenes/CollectionMembers";
import Tabs from "components/Tabs";
-import Tab, { RightTab } from "components/Tab";
+import Tab from "components/Tab";
import PaginatedDocumentList from "components/PaginatedDocumentList";
import CollectionIcon from "components/CollectionIcon";
import NewFromTemplateMenu from "../menus/NewFromTemplateMenu";
@@ -256,12 +256,6 @@ class CollectionScene extends React.Component {
A–Z
-
- Templates
-
@@ -298,14 +292,6 @@ class CollectionScene extends React.Component {
showPin
/>
-
-
-
{
type="text"
onChange={onChangeTitle}
onKeyDown={this.handleTitleKeyDown}
- placeholder={
- document.template ? "Start your template…" : "Start with a title…"
- }
+ placeholder={document.placeholder}
value={!title && readOnly ? document.titleWithDefault : title}
style={startsWithEmojiAndSpace ? { marginLeft: "-1.2em" } : undefined}
readOnlyWriteCheckboxes
diff --git a/server/models/Document.js b/server/models/Document.js
index ba19977779..f2ce5bf21e 100644
--- a/server/models/Document.js
+++ b/server/models/Document.js
@@ -143,6 +143,10 @@ Document.associate = models => {
as: "team",
foreignKey: "teamId",
});
+ Document.belongsTo(models.Document, {
+ as: "document",
+ foreignKey: "templateId",
+ });
Document.belongsTo(models.User, {
as: "createdBy",
foreignKey: "createdById",
diff --git a/server/presenters/document.js b/server/presenters/document.js
index 69ebcaedf0..89568957dd 100644
--- a/server/presenters/document.js
+++ b/server/presenters/document.js
@@ -55,6 +55,7 @@ export default async function present(document: Document, options: ?Options) {
deletedAt: document.deletedAt,
teamId: document.teamId,
template: document.template,
+ templateId: document.templateId,
collaborators: [],
starred: document.starred ? !!document.starred.length : undefined,
revision: document.revisionCount,