mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
fix indent
This commit is contained in:
@@ -3,59 +3,59 @@ export default function searchFromNotes(data, search) {
|
|||||||
if (search.trim().length === 0) return []
|
if (search.trim().length === 0) return []
|
||||||
let searchBlocks = search.split(' ')
|
let searchBlocks = search.split(' ')
|
||||||
searchBlocks.forEach((block) => {
|
searchBlocks.forEach((block) => {
|
||||||
if (block.match(/^!#.+/)) {
|
if (block.match(/^!#.+/)) {
|
||||||
let tag = block.match(/^!#(.+)/)[1]
|
let tag = block.match(/^!#(.+)/)[1]
|
||||||
let regExp = new RegExp(_.escapeRegExp(tag), 'i')
|
let regExp = new RegExp(_.escapeRegExp(tag), 'i')
|
||||||
notes = notes
|
notes = notes
|
||||||
.filter((note) => {
|
.filter((note) => {
|
||||||
if (!_.isArray(note.tags)) return false
|
if (!_.isArray(note.tags)) return false
|
||||||
|
return note.tags.some((_tag) => {
|
||||||
|
return _tag.match(regExp)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else if (block.match(/^!.+/)) {
|
||||||
|
let block = block.match(/^!(.+)/)[1]
|
||||||
|
let regExp = new RegExp(_.escapeRegExp(block), 'i')
|
||||||
|
notes = notes.filter((note) => {
|
||||||
|
if (!_.isArray(note.tags) || !note.tags.some((_tag) => {
|
||||||
|
return _tag.match(regExp)
|
||||||
|
})) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (note.type === 'SNIPPET_NOTE') {
|
||||||
|
return !note.description.match(regExp)
|
||||||
|
} else if (note.type === 'MARKDOWN_NOTE') {
|
||||||
|
return !note.content.match(regExp)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
} else if (block.match(/^#.+/)) {
|
||||||
|
let tag = block.match(/#(.+)/)[1]
|
||||||
|
let regExp = new RegExp(_.escapeRegExp(tag), 'i')
|
||||||
|
notes = notes
|
||||||
|
.filter((note) => {
|
||||||
|
if (!_.isArray(note.tags)) return false
|
||||||
return note.tags.some((_tag) => {
|
return note.tags.some((_tag) => {
|
||||||
return _tag.match(regExp)
|
return _tag.match(regExp)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
} else {
|
||||||
} else if (block.match(/^!.+/)) {
|
let regExp = new RegExp(_.escapeRegExp(block), 'i')
|
||||||
let block = block.match(/^!(.+)/)[1]
|
notes = notes.filter((note) => {
|
||||||
let regExp = new RegExp(_.escapeRegExp(block), 'i')
|
if (_.isArray(note.tags) && note.tags.some((_tag) => {
|
||||||
notes = notes.filter((note) => {
|
|
||||||
if (!_.isArray(note.tags) || !note.tags.some((_tag) => {
|
|
||||||
return _tag.match(regExp)
|
|
||||||
})) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if (note.type === 'SNIPPET_NOTE') {
|
|
||||||
return !note.description.match(regExp)
|
|
||||||
} else if (note.type === 'MARKDOWN_NOTE') {
|
|
||||||
return !note.content.match(regExp)
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
} else if (block.match(/^#.+/)) {
|
|
||||||
let tag = block.match(/#(.+)/)[1]
|
|
||||||
let regExp = new RegExp(_.escapeRegExp(tag), 'i')
|
|
||||||
notes = notes
|
|
||||||
.filter((note) => {
|
|
||||||
if (!_.isArray(note.tags)) return false
|
|
||||||
return note.tags.some((_tag) => {
|
|
||||||
return _tag.match(regExp)
|
return _tag.match(regExp)
|
||||||
})
|
})) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (note.type === 'SNIPPET_NOTE') {
|
||||||
|
return note.description.match(regExp)
|
||||||
|
} else if (note.type === 'MARKDOWN_NOTE') {
|
||||||
|
return note.content.match(regExp)
|
||||||
|
}
|
||||||
|
return false
|
||||||
})
|
})
|
||||||
} else {
|
}
|
||||||
let regExp = new RegExp(_.escapeRegExp(block), 'i')
|
})
|
||||||
notes = notes.filter((note) => {
|
|
||||||
if (_.isArray(note.tags) && note.tags.some((_tag) => {
|
|
||||||
return _tag.match(regExp)
|
|
||||||
})) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if (note.type === 'SNIPPET_NOTE') {
|
|
||||||
return note.description.match(regExp)
|
|
||||||
} else if (note.type === 'MARKDOWN_NOTE') {
|
|
||||||
return note.content.match(regExp)
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return notes
|
return notes
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user