diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js
index 4126e580..4917db3b 100644
--- a/browser/components/CodeEditor.js
+++ b/browser/components/CodeEditor.js
@@ -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
}
diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js
index c38aa99b..cd885fd9 100644
--- a/browser/components/MarkdownEditor.js
+++ b/browser/components/MarkdownEditor.js
@@ -324,6 +324,7 @@ class MarkdownEditor extends React.Component {
enableMarkdownLint={config.editor.enableMarkdownLint}
customMarkdownLintConfig={config.editor.customMarkdownLintConfig}
prettierConfig={config.editor.prettierConfig}
+ deleteUnusedAttachments={config.editor.deleteUnusedAttachments}
/>