Skip to content

Commit d0d8135

Browse files
committed
add option to tag the new notes with the filtering tags, or not...
1 parent d75dd87 commit d0d8135

File tree

6 files changed

+27
-8
lines changed

6 files changed

+27
-8
lines changed

browser/lib/newNote.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ import dataApi from 'browser/main/lib/dataApi'
33
import ee from 'browser/main/lib/eventEmitter'
44
import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig'
55

6-
export function createMarkdownNote (storage, folder, dispatch, location, params) {
6+
export function createMarkdownNote (storage, folder, dispatch, location, params, config) {
77
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_MARKDOWN')
88
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_ALLNOTE')
99

10-
const tags = location.pathname.match(/\/tags/) ? params.tagname.split(' ') : []
10+
let tags = []
11+
if (config.ui.tagNewNoteWithFilteringTags && location.pathname.match(/\/tags/)) {
12+
tags = params.tagname.split(' ')
13+
}
1114

1215
return dataApi
1316
.createNote(storage, {
@@ -37,7 +40,10 @@ export function createSnippetNote (storage, folder, dispatch, location, params,
3740
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_SNIPPET')
3841
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_ALLNOTE')
3942

40-
const tags = location.pathname.match(/\/tags/) ? params.tagname.split(' ') : []
43+
let tags = []
44+
if (config.ui.tagNewNoteWithFilteringTags && location.pathname.match(/\/tags/)) {
45+
tags = params.tagname.split(' ')
46+
}
4147

4248
return dataApi
4349
.createNote(storage, {

browser/main/NewNoteButton/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class NewNoteButton extends React.Component {
3939
const { storage, folder } = this.resolveTargetFolder()
4040

4141
if (config.ui.defaultNote === 'MARKDOWN_NOTE') {
42-
createMarkdownNote(storage.key, folder.key, dispatch, location, params)
42+
createMarkdownNote(storage.key, folder.key, dispatch, location, params, config)
4343
} else if (config.ui.defaultNote === 'SNIPPET_NOTE') {
4444
createSnippetNote(storage.key, folder.key, dispatch, location, params, config)
4545
} else {

browser/main/modals/NewNoteModal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class NewNoteModal extends React.Component {
2121
}
2222

2323
handleMarkdownNoteButtonClick (e) {
24-
const { storage, folder, dispatch, location, params } = this.props
25-
createMarkdownNote(storage, folder, dispatch, location, params).then(() => {
24+
const { storage, folder, dispatch, location, params, config } = this.props
25+
createMarkdownNote(storage, folder, dispatch, location, params, config).then(() => {
2626
setTimeout(this.props.close, 200)
2727
})
2828
}

browser/main/modals/PreferencesModal/UiTab.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class UiTab extends React.Component {
6868
theme: this.refs.uiTheme.value,
6969
language: this.refs.uiLanguage.value,
7070
defaultNote: this.refs.defaultNote.value,
71+
tagNewNoteWithFilteringTags: this.refs.tagNewNoteWithFilteringTags.checked,
7172
showCopyNotification: this.refs.showCopyNotification.checked,
7273
confirmDeletion: this.refs.confirmDeletion.checked,
7374
showOnlyRelatedTags: this.refs.showOnlyRelatedTags.checked,
@@ -226,6 +227,16 @@ class UiTab extends React.Component {
226227
</div>
227228
</div>
228229

230+
<div styleName='group-checkBoxSection'>
231+
<label>
232+
<input onChange={(e) => this.handleUIChange(e)}
233+
checked={this.state.config.ui.tagNewNoteWithFilteringTags}
234+
ref='tagNewNoteWithFilteringTags'
235+
type='checkbox'
236+
/>&nbsp;
237+
{i18n.__('New notes are tagged with the filtering tags')}
238+
</label>
239+
</div>
229240
<div styleName='group-checkBoxSection'>
230241
<label>
231242
<input onChange={(e) => this.handleUIChange(e)}

locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,5 +177,6 @@
177177
"Convert textual arrows to beautiful signs. ⚠ This will interfere with using HTML comments in your Markdown.": "Convert textual arrows to beautiful signs. ⚠ This will interfere with using HTML comments in your Markdown.",
178178
"⚠ You have pasted a link referring an attachment that could not be found in the storage location of this note. Pasting links referring attachments is only supported if the source and destination location is the same storage. Please Drag&Drop the attachment instead! ⚠": "⚠ You have pasted a link referring an attachment that could not be found in the storage location of this note. Pasting links referring attachments is only supported if the source and destination location is the same storage. Please Drag&Drop the attachment instead! ⚠",
179179
"Enable smart table editor": "Enable smart table editor",
180-
"Snippet Default Language": "Snippet Default Language"
180+
"Snippet Default Language": "Snippet Default Language",
181+
"New notes are tagged with the filtering tags": "New notes are tagged with the filtering tags"
181182
}

locales/fr.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,6 @@
154154
"Convert textual arrows to beautiful signs. ⚠ This will interfere with using HTML comments in your Markdown.": "Convertir des flèches textuelles en jolis signes. ⚠ Cela va interferérer avec les éventuels commentaires HTML dans votre Markdown.",
155155
"⚠ You have pasted a link referring an attachment that could not be found in the storage location of this note. Pasting links referring attachments is only supported if the source and destination location is the same storage. Please Drag&Drop the attachment instead! ⚠": "⚠ Vous avez collé un lien qui référence une pièce-jointe qui n'a pas pu être récupéré dans le dossier de stockage de la note. Coller des liens qui font référence à des pièces-jointes ne fonctionne que si la source et la destination et la même. Veuillez plutôt utiliser du Drag & Drop ! ⚠",
156156
"Enable smart table editor": "Activer l'intelligent éditeur de tableaux",
157-
"Snippet Default Language": "Langage par défaut d'un snippet"
157+
"Snippet Default Language": "Langage par défaut d'un snippet",
158+
"New notes are tagged with the filtering tags": "Les nouvelles notes sont taggées avec les tags de filtrage"
158159
}

0 commit comments

Comments
 (0)