From 3e3db7435f65bf9badc3c14b5da234f88c6b44f5 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 7 Jul 2019 19:18:51 -0700 Subject: [PATCH] lint --- app/scenes/Document/Document.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/app/scenes/Document/Document.js b/app/scenes/Document/Document.js index 502eddbee..7f033959e 100644 --- a/app/scenes/Document/Document.js +++ b/app/scenes/Document/Document.js @@ -228,14 +228,14 @@ class DocumentScene extends React.Component { let document = this.document; if (!document) return; - // prevent saves when we're already saving - if (document.isSaving ) return; + // prevent saves when we are already saving + if (document.isSaving) return; // get the latest version of the editor text value const text = this.getEditorText ? this.getEditorText() : document.text; - // prevent save before anything has been written - if (text.trim() === "#") return; + // prevent save before anything has been written (single hash is empty doc) + if (text.trim() === '#') return; // prevent autosave if nothing has changed if (options.autosave && document.text.trim() === text.trim()) return; @@ -265,15 +265,11 @@ class DocumentScene extends React.Component { updateIsDirty = debounce(() => { const document = this.document; - const editorText = this.getEditorText().trim() - - this.isEmpty = editorText === "#"; - this.isDirty = !!document && editorText !== document.text.trim() - - console.log({editorText}) - console.log({doctext: document.text.trim()}) - + const editorText = this.getEditorText().trim(); + // a single hash is a doc with just an empty title + this.isEmpty = editorText === '#'; + this.isDirty = !!document && editorText !== document.text.trim(); }, IS_DIRTY_DELAY); onImageUploadStart = () => { @@ -387,7 +383,9 @@ class DocumentScene extends React.Component { isEditing={this.isEditing} isSaving={this.isSaving} isPublishing={this.isPublishing} - publishingIsDisabled={document.isSaving || this.isPublishing || this.isEmpty} + publishingIsDisabled={ + document.isSaving || this.isPublishing || this.isEmpty + } savingIsDisabled={document.isSaving || this.isEmpty} onDiscard={this.onDiscard} onSave={this.onSave}