diff --git a/app/scenes/Document/Document.js b/app/scenes/Document/Document.js index 839595122..977fa2e49 100644 --- a/app/scenes/Document/Document.js +++ b/app/scenes/Document/Document.js @@ -194,16 +194,18 @@ class DocumentScene extends React.Component { this.isUploading = false; }; - onChange = text => { + onChange = debounce(getText => { let document = this.document; if (!document) return; + + const text = getText(); if (document.text.trim() === text.trim()) return; document.updateData({ text }, true); // prevent autosave before anything has been written if (!document.title && !document.id) return; this.autosave(); - }; + }, 250); onDiscard = () => { let url; diff --git a/package.json b/package.json index 16c0febd8..3ea7caf86 100644 --- a/package.json +++ b/package.json @@ -158,7 +158,7 @@ "react-waypoint": "^7.3.1", "redis": "^2.6.2", "redis-lock": "^0.1.0", - "rich-markdown-editor": "3.1.4", + "rich-markdown-editor": "4.0.0", "safestart": "1.1.0", "sequelize": "4.28.6", "sequelize-cli": "^2.7.0", diff --git a/yarn.lock b/yarn.lock index 680590e25..f05eceae9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8858,9 +8858,9 @@ retry-axios@0.3.2, retry-axios@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/retry-axios/-/retry-axios-0.3.2.tgz#5757c80f585b4cc4c4986aa2ffd47a60c6d35e13" -rich-markdown-editor@3.1.4: - version "3.1.4" - resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-3.1.4.tgz#90e60f599e0ad57b52d893880c89d7ebdfdd97cd" +rich-markdown-editor@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-4.0.0.tgz#483f2b24867553245b66a8c8f56ec3f8d70ae248" dependencies: "@tommoor/slate-drop-or-paste-images" "^0.8.1" babel-plugin-transform-async-to-generator "^6.24.1"