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

Add option to disable the automiatic deletion of un-referenced attachments -> might fix #3203

This commit is contained in:
ehhc
2019-08-26 18:07:04 +02:00
committed by Junyoung Choi
parent 857e75594d
commit cf324d93fe
5 changed files with 26 additions and 7 deletions

View File

@@ -70,7 +70,9 @@ export default class CodeEditor extends React.Component {
storageKey,
noteKey
} = this.props
debouncedDeletionOfAttachments(this.editor.getValue(), storageKey, noteKey)
if (this.props.deleteUnusedAttachments === true) {
debouncedDeletionOfAttachments(this.editor.getValue(), storageKey, noteKey)
}
}
this.pasteHandler = (editor, e) => {
e.preventDefault()
@@ -632,6 +634,9 @@ export default class CodeEditor extends React.Component {
this.editor.addPanel(this.createSpellCheckPanel(), {position: 'bottom'})
}
}
if (prevProps.deleteUnusedAttachments !== this.props.deleteUnusedAttachments) {
this.editor.setOption('deleteUnusedAttachments', this.props.deleteUnusedAttachments)
}
if (needRefresh) {
this.editor.refresh()
@@ -1204,7 +1209,8 @@ CodeEditor.propTypes = {
autoDetect: PropTypes.bool,
spellCheck: PropTypes.bool,
enableMarkdownLint: PropTypes.bool,
customMarkdownLintConfig: PropTypes.string
customMarkdownLintConfig: PropTypes.string,
deleteUnusedAttachments: PropTypes.bool
}
CodeEditor.defaultProps = {
@@ -1219,5 +1225,6 @@ CodeEditor.defaultProps = {
spellCheck: false,
enableMarkdownLint: DEFAULT_CONFIG.editor.enableMarkdownLint,
customMarkdownLintConfig: DEFAULT_CONFIG.editor.customMarkdownLintConfig,
prettierConfig: DEFAULT_CONFIG.editor.prettierConfig
prettierConfig: DEFAULT_CONFIG.editor.prettierConfig,
deleteUnusedAttachments: DEFAULT_CONFIG.editor.deleteUnusedAttachments
}