@@ -110,45 +126,37 @@
diff --git a/client/src/pages/LoginPage.vue b/client/src/pages/LoginPage.vue
index 1056ed7..553056c 100644
--- a/client/src/pages/LoginPage.vue
+++ b/client/src/pages/LoginPage.vue
@@ -25,7 +25,7 @@
- You will remain logged in on this browser, for 30 days or until you log out.
+ You will remain logged in on this browser, for 20 days or until you log out.
diff --git a/client/src/pages/NotesPage.vue b/client/src/pages/NotesPage.vue
index 598525b..2f7d239 100644
--- a/client/src/pages/NotesPage.vue
+++ b/client/src/pages/NotesPage.vue
@@ -31,7 +31,7 @@
-
+
@@ -117,7 +117,7 @@
:onClick="openNote"
:data="note"
:title-view="titleView"
- :currently-open="(activeNoteId1 == note.id || activeNoteId2 == note.id)"
+ :currently-open="activeNoteId1 == note.id"
:key="note.id + note.color + '-' +note.title.length + '-' +note.subtext.length + '-' + note.tag_count + note.updated"
/>
@@ -132,13 +132,12 @@
-
+ />
@@ -151,7 +150,7 @@
name: 'SearchBar',
components: {
- 'input-notes': () => import(/* webpackChunkName: "NoteInputPanel" */ '@/components/NoteInputPanel.vue'),
+ 'note-input-panel': () => import(/* webpackChunkName: "NoteInputPanel" */ '@/components/NoteInputPanel.vue'),
'note-title-display-card': require('@/components/NoteTitleDisplayCard.vue').default,
// 'fast-filters': require('@/components/FastFilters.vue').default,
@@ -247,7 +246,7 @@
//Do not update note if its open
if(this.activeNoteId1 != noteId){
- this.updateSingleNote(noteId, false)
+ this.updateSingleNote(noteId, true)
}
})
@@ -264,10 +263,18 @@
//Close note event
this.$bus.$on('close_active_note', ({noteId, modified}) => {
- this.closeNote()
+ if(modified){
+ console.log('Just closed Note -> ' + noteId + ', modified -> ', modified)
+ }
+
+ //A note has been closed
+ if(this.$route.fullPath != '/notes'){
+ this.$router.push('/notes')
+ }
+
this.$store.dispatch('fetchAndUpdateUserTotals')
//Focus and animate if modified
- this.updateSingleNote(parseInt(noteId), modified)
+ this.updateSingleNote(noteId, modified)
})
this.$bus.$on('note_deleted', (noteId) => {
@@ -312,35 +319,25 @@
})
})
- //New note button pushes open note event
- this.$bus.$on('open_note', noteId => {
- this.openNote(noteId)
- })
-
- //Reload page content
+ //Reload page content - don't trigger if load is in progress
this.$bus.$on('note_reload', () => {
- this.reset()
+ if(!this.loadingInProgress){
+ this.reset()
+ }
})
- //Mount notes on load if note ID is set
- if(this.$route.params && this.$route.params.id){
- const id = this.$route.params.id
- this.openNote(id)
- }
-
window.addEventListener('scroll', this.onScroll)
//Close notes when back button is pressed
- window.addEventListener('hashchange', this.hashChangeAction)
+ // window.addEventListener('hashchange', this.hashChangeAction)
//update note on visibility change
- document.addEventListener('visibilitychange', this.visibiltyChangeAction);
+ // document.addEventListener('visibilitychange', this.visibiltyChangeAction);
},
beforeDestroy(){
window.removeEventListener('scroll', this.onScroll)
- window.removeEventListener('hashchange', this.hashChangeAction)
- document.removeEventListener('visibilitychange', this.visibiltyChangeAction)
+ // document.removeEventListener('visibilitychange', this.visibiltyChangeAction)
this.$bus.$off('note_reload')
this.$bus.$off('close_active_note')
@@ -348,7 +345,6 @@
this.$bus.$off('note_deleted')
this.$bus.$off('update_fast_filters')
this.$bus.$off('update_search_term')
- this.$bus.$off('open_note')
//We want to remove event listeners, but something here is messing them up and preventing ALL event listeners from working
// this.$off() // Remove all event listeners
@@ -356,11 +352,20 @@
},
mounted() {
+ //Open note on load if ID is set
+ if(this.$route.params.id > 1){
+ this.activeNoteId1 = this.$route.params.id
+ }
+
//Loads initial batch and tags
this.reset()
- // this.search(true, this.firstLoadBatchSize, false)
- // .then( r => this.search(false, this.batchSize, true))
+ },
+ watch: {
+ '$route.params.id': function(id){
+ //Open note on ID, null id will close note
+ this.activeNoteId1 = id
+ }
},
methods: {
toggleTitleView(){
@@ -382,17 +387,9 @@
if(nodeClick == 'A'){ return }
}
- //1 note open
- if(this.activeNoteId1 == null){
- this.activeNoteId1 = id
- this.activeNote1Position = 0 //Middel of page
- this.$router.push('/notes/open/'+this.activeNoteId1).catch(e => { console.log(e) })
- return
- }
- },
- closeNote(position){
- this.activeNoteId1 = null
- this.$router.push('/notes')
+ //Open note if a link was not clicked
+ this.$router.push('/notes/open/'+id)
+ return
},
toggleTagFilter(tagId){
@@ -429,34 +426,6 @@
return
},
- //Try to close notes on URL hash change /notes/open/123 to /notes - parse 123, close note id 123
- hashChangeAction(event){
-
- //Clean up path of hash change
- let path = window.location.protocol + '//' + window.location.hostname + window.location.pathname + window.location.hash
- let newPath = event.newURL.replace(path,'')
- let oldPath = event.oldURL.replace(path,'')
-
- // console.log(this.$route.params)
- // console.log(this.$router)
-
- //Open note if user goes forward to a note id
- if(this.$route.params && this.$route.params.id){
- this.openNote(this.$route.params.id)
- }
-
- //If we go from open note ID to no note ID, close the note
- if(newPath == '' && oldPath.indexOf('/open/') != -1){
- //Pull note ID out of URL
- const noteIdToClose = oldPath.split('/').pop()
-
- // console.log(noteIdToClose)
-
- if(this.$refs.note1 && this.$refs.note1.currentNoteId == noteIdToClose){
- // this.$refs.note1.close()
- }
- }
- },
visibiltyChangeAction(event){
//Fuck this shit, just use web sockets
@@ -484,8 +453,11 @@
let note = null
if(this.$refs['note-'+noteId] && this.$refs['note-'+noteId][0] && this.$refs['note-'+noteId][0].note){
note = this.$refs['note-'+noteId][0].note
+ //Show that note is working on updating
+ this.$refs['note-'+noteId][0].showWorking = true
}
+
//Lookup one note using passed in ID
const postData = {
searchQuery: this.searchTerm,
@@ -508,18 +480,13 @@
if(note && newNote){
- //Don't move notes that were not changed
- if(note.updated == newNote.updated){
- // return
- }
-
//go through each prop and update it with new values
Object.keys(newNote).forEach(prop => {
note[prop] = newNote[prop]
})
- //Push new note to front if its modified
- if(focuseAndAnimate){
+ //Push new note to front if its modified or we want it to
+ if( focuseAndAnimate || note.updated != newNote.updated ){
// Find note, in section, move to front
Object.keys(this.noteSections).forEach( key => {
@@ -536,6 +503,7 @@
this.$nextTick( () => {
//Trigger close animation on note
this.$refs['note-'+noteId][0].justClosed()
+ this.$refs['note-'+noteId][0].showWorking = false
})
}
@@ -547,9 +515,14 @@
//Trigger close animation on note
if(this.$refs['note-'+noteId] && this.$refs['note-'+noteId][0]){
this.$refs['note-'+noteId][0].justClosed()
+ this.$refs['note-'+noteId][0].showWorking = false
}
}
+ if(this.$refs['note-'+noteId] && this.$refs['note-'+noteId][0]){
+ this.$refs['note-'+noteId][0].showWorking = false
+ }
+
//Trigger section rebuild
this.rebuildNoteCategorise()
})
@@ -610,7 +583,6 @@
//Perform search - or die
this.loadingInProgress = true
- // console.time('Fetch TitleCard Batch '+notesInNextLoad)
axios.post('/api/note/search', postData)
.then(response => {
@@ -735,7 +707,6 @@
this.fastFilters = {}
this.foundAttachments = [] //Remove all attachments
- this.$bus.$emit('reset_fast_filters')
this.updateFastFilters(5) //This loads notes
},
diff --git a/client/src/pages/QuickPage.vue b/client/src/pages/QuickPage.vue
index aee5532..0dcf062 100644
--- a/client/src/pages/QuickPage.vue
+++ b/client/src/pages/QuickPage.vue
@@ -14,6 +14,11 @@