mirror of
https://github.com/outline/outline.git
synced 2026-11-21 13:34:02 +03:00
fix: Handle no templates available
This commit is contained in:
1 parent
399507d441
commit
011a5c97df
4 files changed
+10
-9
No files matched your search
@@ -15,6 +15,10 @@ export const Action = styled(Flex)`
|
||||
color: ${props => props.theme.text};
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
`;
|
||||
|
||||
export const Separator = styled.div`
|
||||
|
||||
@@ -19,6 +19,10 @@ class TemplatesMenu extends React.Component<Props> {
|
||||
const { documents, document, ...rest } = this.props;
|
||||
const templates = documents.templatesInCollection(document.collectionId);
|
||||
|
||||
if (!templates.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<DropdownMenu
|
||||
position="left"
|
||||
|
||||
@@ -43,14 +43,11 @@ export default class Document extends BaseModel {
|
||||
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 = "";
|
||||
}
|
||||
@@ -127,9 +124,7 @@ export default class Document extends BaseModel {
|
||||
|
||||
@computed
|
||||
get placeholder(): ?string {
|
||||
return this.isNew && this.isFromTemplate
|
||||
? this.originalTitle
|
||||
: this.isTemplate ? "Start your template…" : "Start with a title…";
|
||||
return this.isTemplate ? "Start your template…" : "Start with a title…";
|
||||
}
|
||||
|
||||
@action
|
||||
|
||||
@@ -211,9 +211,7 @@ class Header extends React.Component<Props> {
|
||||
!isTemplate &&
|
||||
isNew && (
|
||||
<Action>
|
||||
<Fade>
|
||||
<TemplatesMenu document={document} />
|
||||
</Fade>
|
||||
<TemplatesMenu document={document} />
|
||||
</Action>
|
||||
)}
|
||||
{!isEditing &&
|
||||
|
||||
Reference in new issue
Block a user