1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Support for tags

This commit is contained in:
Laurent Cozic
2017-07-25 19:36:52 +01:00
parent e128077326
commit d5e39d153f
12 changed files with 274 additions and 65 deletions

View File

@ -38,10 +38,13 @@ import { PoorManIntervals } from 'lib/poor-man-intervals.js';
let defaultState = {
notes: [],
notesSource: '',
notesParentType: null,
folders: [],
tags: [],
selectedNoteId: null,
selectedItemType: 'note',
selectedFolderId: null,
selectedTagId: null,
selectedItemType: 'note',
showSideMenu: false,
screens: {},
loading: true,
@ -148,6 +151,12 @@ const reducer = (state = defaultState, action) => {
if ('folderId' in action) {
newState.selectedFolderId = action.folderId;
newState.notesParentType = 'Folder';
}
if ('tagId' in action) {
newState.selectedTagId = action.tagId;
newState.notesParentType = 'Tag';
}
if ('itemType' in action) {
@ -229,6 +238,12 @@ const reducer = (state = defaultState, action) => {
newState.folders = action.folders;
break;
case 'TAGS_UPDATE_ALL':
newState = Object.assign({}, state);
newState.tags = action.tags;
break;
case 'FOLDERS_UPDATE_ONE':
var newFolders = state.folders.splice(0);
@ -414,6 +429,13 @@ async function initialize(dispatch, backButtonHandler) {
await FoldersScreenUtils.refreshFolders();
const tags = await Tag.all();
dispatch({
type: 'TAGS_UPDATE_ALL',
tags: tags,
});
dispatch({
type: 'APPLICATION_LOADING_DONE',
});