1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-03-20 20:55:18 +02:00

Electron: When deleting tag that is currently selected, select a new tag or folder

This commit is contained in:
Laurent Cozic 2017-11-12 17:37:04 +00:00
parent f9a06bb5b9
commit 6d2a5a7b32
6 changed files with 69 additions and 22 deletions

View File

@ -469,6 +469,9 @@ msgstr ""
msgid "Search:" msgid "Search:"
msgstr "" msgstr ""
msgid "File"
msgstr ""
msgid "New note" msgid "New note"
msgstr "" msgstr ""
@ -556,6 +559,15 @@ msgstr ""
msgid "Refresh" msgid "Refresh"
msgstr "" msgstr ""
msgid "OneDrive Login"
msgstr ""
msgid "Import"
msgstr ""
msgid "Configuration"
msgstr ""
msgid "Delete notebook?" msgid "Delete notebook?"
msgstr "" msgstr ""
@ -773,9 +785,6 @@ msgstr ""
msgid "Status" msgid "Status"
msgstr "" msgstr ""
msgid "Configuration"
msgstr ""
msgid "Cancel synchronisation" msgid "Cancel synchronisation"
msgstr "" msgstr ""

View File

@ -520,6 +520,9 @@ msgstr ""
msgid "Search:" msgid "Search:"
msgstr "Chercher" msgstr "Chercher"
msgid "File"
msgstr ""
msgid "New note" msgid "New note"
msgstr "Nouvelle note" msgstr "Nouvelle note"
@ -616,6 +619,17 @@ msgstr "Attacher un fichier"
msgid "Refresh" msgid "Refresh"
msgstr "Rafraîchir" msgstr "Rafraîchir"
#, fuzzy
msgid "OneDrive Login"
msgstr "OneDrive"
#, fuzzy
msgid "Import"
msgstr "Importé - %s"
msgid "Configuration"
msgstr "Configuration"
msgid "Delete notebook?" msgid "Delete notebook?"
msgstr "Supprimer le carnet ?" msgstr "Supprimer le carnet ?"
@ -846,9 +860,6 @@ msgstr "Journal"
msgid "Status" msgid "Status"
msgstr "Etat" msgstr "Etat"
msgid "Configuration"
msgstr "Configuration"
msgid "Cancel synchronisation" msgid "Cancel synchronisation"
msgstr "Annuler synchronisation" msgstr "Annuler synchronisation"
@ -1060,9 +1071,6 @@ msgstr "Bienvenue"
#~ "Tous les ports sont en cours d'utilisation. Veuillez signaler ce problème " #~ "Tous les ports sont en cours d'utilisation. Veuillez signaler ce problème "
#~ "sur %s" #~ "sur %s"
#~ msgid "Imported - %s"
#~ msgstr "Importé - %s"
#~ msgid "" #~ msgid ""
#~ "There is currently no notebook. Create one by clicking on the (+) button." #~ "There is currently no notebook. Create one by clicking on the (+) button."
#~ msgstr "" #~ msgstr ""

View File

@ -469,6 +469,9 @@ msgstr ""
msgid "Search:" msgid "Search:"
msgstr "" msgstr ""
msgid "File"
msgstr ""
msgid "New note" msgid "New note"
msgstr "" msgstr ""
@ -556,6 +559,15 @@ msgstr ""
msgid "Refresh" msgid "Refresh"
msgstr "" msgstr ""
msgid "OneDrive Login"
msgstr ""
msgid "Import"
msgstr ""
msgid "Configuration"
msgstr ""
msgid "Delete notebook?" msgid "Delete notebook?"
msgstr "" msgstr ""
@ -773,9 +785,6 @@ msgstr ""
msgid "Status" msgid "Status"
msgstr "" msgstr ""
msgid "Configuration"
msgstr ""
msgid "Cancel synchronisation" msgid "Cancel synchronisation"
msgstr "" msgstr ""

View File

@ -1,7 +1,7 @@
const { Setting } = require('lib/models/setting.js'); const { Setting } = require('lib/models/setting.js');
const globalStyle = { const globalStyle = {
fontSize: 13, fontSize: 12,
fontFamily: 'sans-serif', fontFamily: 'sans-serif',
margin: 15, // No text and no interactive component should be within this margin margin: 15, // No text and no interactive component should be within this margin
itemMarginTop: 10, itemMarginTop: 10,

View File

@ -136,10 +136,27 @@ class BaseApplication {
process.exit(code); process.exit(code);
} }
async refreshNotes(parentType, parentId) { //async refreshNotes(parentType, parentId) {
this.logger().debug('Refreshing notes:', parentType, parentId); //async refreshNotes(parentType, parentId) {
async refreshNotes(state) {
let parentType = state.notesParentType;
let parentId = null;
const state = this.store().getState(); if (parentType === 'Folder') {
parentId = state.selectedFolderId;
parentType = BaseModel.TYPE_FOLDER;
} else if (parentType === 'Note') {
parentId = state.selectedNoteId;
parentType = BaseModel.TYPE_NOTE;
} else if (parentType === 'Tag') {
parentId = state.selectedTagId;
parentType = BaseModel.TYPE_TAG;
} else if (parentType === 'Search') {
parentId = state.selectedSearchId;
parentType = BaseModel.TYPE_SEARCH;
}
this.logger().debug('Refreshing notes:', parentType, parentId);
let options = { let options = {
order: state.notesOrder, order: state.notesOrder,
@ -213,19 +230,19 @@ class BaseApplication {
if (action.type == 'FOLDER_SELECT' || action.type === 'FOLDER_DELETE') { if (action.type == 'FOLDER_SELECT' || action.type === 'FOLDER_DELETE') {
Setting.setValue('activeFolderId', newState.selectedFolderId); Setting.setValue('activeFolderId', newState.selectedFolderId);
this.currentFolder_ = newState.selectedFolderId ? await Folder.load(newState.selectedFolderId) : null; this.currentFolder_ = newState.selectedFolderId ? await Folder.load(newState.selectedFolderId) : null;
await this.refreshNotes(Folder.modelType(), newState.selectedFolderId); await this.refreshNotes(newState);
} }
if (this.hasGui() && action.type == 'SETTING_UPDATE_ONE' && action.key == 'uncompletedTodosOnTop' || action.type == 'SETTING_UPDATE_ALL') { if (this.hasGui() && action.type == 'SETTING_UPDATE_ONE' && action.key == 'uncompletedTodosOnTop' || action.type == 'SETTING_UPDATE_ALL') {
await this.refreshNotes(Folder.modelType(), newState.selectedFolderId); await this.refreshNotes(newState);
} }
if (action.type == 'TAG_SELECT') { if (action.type == 'TAG_SELECT' || action.type === 'TAG_DELETE') {
await this.refreshNotes(Tag.modelType(), action.id); await this.refreshNotes(newState);
} }
if (action.type == 'SEARCH_SELECT') { if (action.type == 'SEARCH_SELECT' || action.type === 'SEARCH_DELETE') {
await this.refreshNotes(BaseModel.TYPE_SEARCH, action.id); await this.refreshNotes(newState);
} }
if (this.hasGui() && action.type == 'SETTING_UPDATE_ONE' && action.key == 'sync.interval' || action.type == 'SETTING_UPDATE_ALL') { if (this.hasGui() && action.type == 'SETTING_UPDATE_ONE' && action.key == 'sync.interval' || action.type == 'SETTING_UPDATE_ALL') {

View File

@ -61,6 +61,10 @@ function handleItemDelete(state, action) {
const newIndex = previousIndex >= 0 ? newItems[previousIndex].id : null; const newIndex = previousIndex >= 0 ? newItems[previousIndex].id : null;
newState[selectedItemKey] = newIndex; newState[selectedItemKey] = newIndex;
if (!newIndex && newState.notesParentType !== 'Folder') {
newState.notesParentType = 'Folder';
}
return newState; return newState;
} }