mirror of
https://github.com/outline/outline.git
synced 2026-11-26 15:43:48 +03:00
Merge pull request #353 from jorilallo/jori/empty-fix
Fixes for empty document
This commit is contained in:
commit
6ef886ad2a
2 files changed
+6
-1
No files matched your search
@@ -51,7 +51,7 @@ type KeyData = {
|
||||
onImageUploadStop: props.onImageUploadStop,
|
||||
});
|
||||
|
||||
if (props.text) {
|
||||
if (props.text.trim().length) {
|
||||
this.state = { state: Markdown.deserialize(props.text) };
|
||||
} else {
|
||||
this.state = { state: Plain.deserialize('') };
|
||||
|
||||
@@ -14,6 +14,11 @@ async function present(ctx: Object, document: Document, options: ?Options) {
|
||||
...options,
|
||||
};
|
||||
ctx.cache.set(document.id, document);
|
||||
|
||||
// For empty document content, return the title
|
||||
if (document.text.trim().length === 0)
|
||||
document.text = `# ${document.title || 'Untitled document'}`;
|
||||
|
||||
const data = {
|
||||
id: document.id,
|
||||
url: document.getUrl(),
|
||||
|
||||
Reference in new issue
Block a user