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

フォルダーで検索するときに in:じゃなくて /にする +バグ修正

This commit is contained in:
Rokt33r
2015-11-15 00:57:29 +09:00
parent ef84c4e3da
commit 41e1630aac
5 changed files with 15 additions and 14 deletions

View File

@@ -119,9 +119,9 @@ FinderMain.propTypes = {
function remap (state) {
let { articles, folders, status } = state
let filters = status.search.split(' ').map(key => key.trim()).filter(key => key.length > 0 && !key.match(/^#$/)).map(key => {
if (key.match(/^in:.+$/)) {
return {type: FOLDER_FILTER, value: key.match(/^in:(.+)$/)[1]}
let filters = status.search.split(' ').map(key => key.trim()).filter(key => key.length > 0 && !key.match(/^\/$/) && !key.match(/^#$/)).map(key => {
if (key.match(/^\/.+$/)) {
return {type: FOLDER_FILTER, value: key.match(/^\/(.+)$/)[1]}
}
if (key.match(/^#(.+)/)) {
return {type: TAG_FILTER, value: key.match(/^#(.+)$/)[1]}
@@ -134,7 +134,7 @@ function remap (state) {
if (folders != null) {
let targetFolders = folders.filter(folder => {
return _.findWhere(folderFilters, {value: folder.name})
return _.find(folderFilters, filter => folder.name.match(new RegExp(`^${filter.value}`)))
})
status.targetFolders = targetFolders
@@ -164,6 +164,7 @@ function remap (state) {
let activeArticle = _.findWhere(articles, {key: status.articleKey})
if (activeArticle == null) activeArticle = articles[0]
console.log(status.search)
return {
articles,
activeArticle,

View File

@@ -14,10 +14,10 @@ function status (state = initialStatus, action) {
switch (action.type) {
case SELECT_ARTICLE:
state.articleKey = action.data.key
return state
return Object.assign({}, state)
case SEARCH_ARTICLE:
state.search = action.data.input
return state
return Object.assign({}, state)
default:
return state
}