1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

fix unwanted deletion of attachments

This commit is contained in:
Baptiste Augrain
2020-09-13 01:34:12 +02:00
committed by Junyoung Choi
parent 47b796909a
commit 8958e67fcf

View File

@@ -63,7 +63,7 @@ export default class CodeEditor extends React.Component {
this.focusHandler = () => { this.focusHandler = () => {
ipcRenderer.send('editor:focused', true) ipcRenderer.send('editor:focused', true)
} }
const debouncedDeletionOfAttachments = _.debounce( this.debouncedDeletionOfAttachments = _.debounce(
attachmentManagement.deleteAttachmentsNotPresentInNote, attachmentManagement.deleteAttachmentsNotPresentInNote,
30000 30000
) )
@@ -80,7 +80,7 @@ export default class CodeEditor extends React.Component {
this.props.onBlur != null && this.props.onBlur(e) this.props.onBlur != null && this.props.onBlur(e)
const { storageKey, noteKey } = this.props const { storageKey, noteKey } = this.props
if (this.props.deleteUnusedAttachments === true) { if (this.props.deleteUnusedAttachments === true) {
debouncedDeletionOfAttachments( this.debouncedDeletionOfAttachments(
this.editor.getValue(), this.editor.getValue(),
storageKey, storageKey,
noteKey noteKey
@@ -810,6 +810,8 @@ export default class CodeEditor extends React.Component {
} }
handleChange(editor, changeObject) { handleChange(editor, changeObject) {
this.debouncedDeletionOfAttachments.cancel()
spellcheck.handleChange(editor, changeObject) spellcheck.handleChange(editor, changeObject)
// The current note contains an toc. We'll check for changes on headlines. // The current note contains an toc. We'll check for changes on headlines.