* Removed arrows from notification

* Added trash can function
* Tweaked status text to always be the same
* Removed some open second note code
* Edior always focuses on text now
* Added some extra loading note messages
* Notes are now removed from search index when deleted
* Lots more things happen and update in real time on multiple machines
* Shared notes can be reverted
* WAY more tests
* Note Categories are much more reliable
* Lots of code is much cleaner
This commit is contained in:
Max G
2020-05-18 07:45:35 +00:00
parent e87e8513bc
commit 5096e74a60
18 changed files with 644 additions and 368 deletions

View File

@@ -26,6 +26,10 @@
<!-- <span>{{ $store.getters.totals['archivedNotes'] }}</span> -->
</div>
<div class="ui basic icon button shrinking" v-on:click="updateFastFilters(4)" v-if="$store.getters.totals && $store.getters.totals['trashedNotes'] > 0">
<i class="trash alternate outline icon"></i>
</div>
<tag-display
:active-tags="searchTags"
v-on:tagClick="tagId => toggleTagFilter(tagId)"
@@ -66,11 +70,23 @@
</h2>
</div>
<h2 v-if="fastFilters['withLinks'] == 1">Notes with Links</h2>
<h2 v-if="fastFilters['withTags'] == 1">Notes with Tags</h2>
<h2 v-if="fastFilters['onlyArchived'] == 1">Archived Notes</h2>
<h2 v-if="fastFilters['onlyShowSharedNotes'] == 1">Shared Notes</h2>
<h2 v-if="fastFilters['onlyShowEncrypted'] == 1">Password Protected - No longer supported</h2>
<div v-if="fastFilters['onlyArchived'] == 1" class="sixteen wide column">
<h2>Archived Notes</h2>
</div>
<div class="sixteen wide column" v-if="fastFilters['onlyShowTrashed'] == 1">
<h2 >Trash
<span>({{ $store.getters.totals['trashedNotes'] }})</span>
<div class="ui right floated basic button" data-tooltip="This doesn't work yet">
<i class="poo storm icon"></i>
Empty Trash
</div>
</h2>
</div>
<div class="sixteen wide column" v-if="fastFilters['onlyShowSharedNotes'] == 1">
<h2>Shared Notes</h2>
</div>
<!-- Note title card display -->
<div class="sixteen wide column">
@@ -124,15 +140,11 @@
<input-notes
v-if="activeNoteId1 != null"
:key="'active_note_'+activeNoteId1"
:noteid="activeNoteId1"
:position="activeNote1Position"
:url-data="$route.params"
ref="note1" />
<input-notes
v-if="activeNoteId2 != null"
:noteid="activeNoteId2"
:position="activeNote2Position"
ref="note2" />
</div>
</template>
@@ -148,7 +160,7 @@
'input-notes': () => import(/* webpackChunkName: "NoteInputPanel" */ '@/components/NoteInputPanel.vue'),
'note-title-display-card': require('@/components/NoteTitleDisplayCard.vue').default,
'fast-filters': require('@/components/FastFilters.vue').default,
// 'fast-filters': require('@/components/FastFilters.vue').default,
'search-input': require('@/components/SearchInput.vue').default,
'attachment-display': require('@/components/AttachmentDisplayCard').default,
'counter':require('@/components/AnimatedCounterComponent.vue').default,
@@ -205,7 +217,8 @@
'shared': ['envelope outline', 'Received Notes'],
'sent': ['paper plane outline', 'Shared Notes'],
'notes': ['file','Notes'],
'highlights': ['paragraph', 'Found In Text']
'highlights': ['paragraph', 'Found In Text'],
'trashed': ['poop', 'Trashed Notes']
},
noteSections: {
pinned: [],
@@ -213,7 +226,8 @@
shared:[],
sent:[],
notes: [],
highlights: []
highlights: [],
trashed: []
},
}
@@ -223,35 +237,47 @@
this.$parent.loginGateway()
this.$io.on('new_note_created', noteId => {
//Do not update note if its open
if(this.activeNoteId1 != noteId){
this.updateSingleNote(parseInt(noteId))
this.$store.dispatch('fetchAndUpdateUserTotals')
this.updateSingleNote(noteId)
}
})
this.$io.on('note_attribute_modified', noteId => {
//Do not update note if its open
if(this.activeNoteId1 != noteId){
this.$store.dispatch('fetchAndUpdateUserTotals')
this.updateSingleNote(noteId)
}
})
//Update title cards when new note text is saved
this.$io.on('new_note_text_saved', ({noteId, hash}) => {
//Do not update note if its open
if(this.activeNoteId1 != noteId){
this.updateSingleNote(parseInt(noteId))
this.updateSingleNote(noteId)
}
})
//Update totals for app
this.$store.dispatch('fetchAndUpdateUserTotals')
//Close note event
this.$bus.$on('close_active_note', ({position, noteId, modified}) => {
this.closeNote(position)
this.$store.dispatch('fetchAndUpdateUserTotals')
this.closeNote()
if(modified){
this.$store.dispatch('fetchAndUpdateUserTotals')
this.updateSingleNote(parseInt(noteId))
}
})
this.$bus.$on('update_single_note', (noteId) => {
this.updateSingleNote(noteId)
})
// this.$bus.$on('update_single_note', (noteId) => {
// this.updateSingleNote(noteId)
// })
this.$bus.$on('note_deleted', (noteId) => {
//Remove deleted note from set, its deleted
@@ -320,7 +346,7 @@
this.$bus.$off('note_reload')
this.$bus.$off('close_active_note')
this.$bus.$off('update_single_note')
// this.$bus.$off('update_single_note')
this.$bus.$off('note_deleted')
this.$bus.$off('update_fast_filters')
this.$bus.$off('update_search_term')
@@ -364,30 +390,8 @@
}
},
closeNote(position){
//One note open, close that note
if(position == 0){
this.activeNoteId1 = null
this.activeNoteId2 = null
}
//Right note closed, thats 1
if(position == 1){
this.activeNoteId1 = null
}
if(position == 2){
this.activeNoteId2 = null
}
//IF two notes get opened, update ID of open note
if(this.activeNoteId1 || this.activeNoteId2){
this.$router.push('/notes/open/'+Math.max(this.activeNoteId1, this.activeNoteId2))
} else {
//No notes are open, just show notes page
this.$router.push('/notes')
}
this.activeNote1Position = 0
this.activeNote2Position = 0
this.activeNoteId1 = null
this.$router.push('/notes')
},
toggleTagFilter(tagId){
@@ -479,6 +483,8 @@
// @TODO Don't even trigger this if the note wasn't changed
updateSingleNote(noteId){
noteId = parseInt(noteId)
//Find local note, if it exists; continue
@@ -656,33 +662,58 @@
//Sort notes into defined sections
notes.forEach(note => {
//Only show trashed notes when trashed
if(this.fastFilters.onlyShowTrashed == 1){
if(note.trashed == 1){
this.noteSections.trashed.push(note)
}
return
}
if(note.trashed == 1){
return
}
//Show archived notes
if(note.archived == 1 && this.fastFilters.onlyArchived == 1){
this.noteSections.archived.push(note)
if(this.fastFilters.onlyArchived == 1){
if(note.pinned == 1 && note.archived == 1){
this.noteSections.pinned.push(note)
return
}
if(note.archived == 1){
this.noteSections.archived.push(note)
}
return
}
if(note.shareUsername != null){
this.noteSections.shared.push(note)
if(note.archived == 1){
return
}
//Only show sent notes section if shared is selected
if(note.shared == 2 && this.fastFilters.onlyShowSharedNotes == 1){
this.noteSections.sent.push(note)
return
}
if(note.note_highlights.length > 0){
this.noteSections.highlights.push(note)
if(this.fastFilters.onlyShowSharedNotes == 1){
if(note.shared == 2){
this.noteSections.sent.push(note)
}
if(note.shareUsername != null){
this.noteSections.shared.push(note)
}
return
}
//Show shared notes on main list but not notes shared with you
if(note.shareUsername != null){ return }
// Pinned notes are always first, they can appear in the archive
if(note.pinned == 1){
this.noteSections.pinned.push(note)
return
}
//If the note is not archived, push it.
if(note.archived != 1 && this.fastFilters.onlyArchived != 1){
this.noteSections.notes.push(note)
}
//Push to default note section
this.noteSections.notes.push(note)
return
})
},
@@ -692,14 +723,13 @@
this.searchTerm = ''
this.searchTags = []
this.fastFilters = {}
this.updateFastFilters(5)
this.foundAttachments = [] //Remove all attachments
this.$bus.$emit('reset_fast_filters')
// this.$bus.$emit('reset_fast_filters')
//Load initial batch, then tags, then other batch
this.search(true, this.firstLoadBatchSize)
.then( () => {
//Load a larger batch once first batch has loaded
return this.search(false, this.batchSize, true)
})
@@ -711,6 +741,7 @@
//clear out tags
this.searchTags = []
this.loadingInProgress = false
//A little hacky, brings user to notes page then filters on click
if(this.$route.name != 'Note Page'){
@@ -725,7 +756,8 @@
'withTags', // 'Only Show Notes with Tags'
'onlyArchived', //'Only Show Archived Notes'
'onlyShowSharedNotes', //Only show shared notes
'onlyShowEncrypted',
'onlyShowTrashed',
'notesHome',
]
let filter = {}