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

Look for tags in context too

The previous commit broke this behaviour.

Looking for a tag means the union of **tags** AND **tag in content**, so
it has to search in the in currently found notes separetely, thus it has
to clone the list first (`.slice(0)`).
This commit is contained in:
bimlas
2018-03-20 09:35:39 +01:00
parent 5f5a7880a6
commit aae584106a

View File

@@ -7,7 +7,7 @@ export default function searchFromNotes (notes, search) {
let foundNotes = notes let foundNotes = notes
searchBlocks.forEach((block) => { searchBlocks.forEach((block) => {
if (block.match(/^#.+/)) { if (block.match(/^#.+/)) {
foundNotes = findByTag(foundNotes, block) foundNotes = findByTag(foundNotes.slice(0), block).concat(findByWord(foundNotes.slice(0), block))
} else { } else {
foundNotes = findByWord(foundNotes, block) foundNotes = findByWord(foundNotes, block)
} }