From fab0b3873fd32e45abe5b1cc597705e3b59c98f8 Mon Sep 17 00:00:00 2001 From: Max G Date: Sun, 23 Feb 2020 06:27:49 +0000 Subject: [PATCH] * Fixed a bunch of little bugs * Added more options to attachment page and filters * Much better rendering and updating on attachment page * Math bug is fixed with better string parsing fixes #14 * Icons are limited to 4 per note * If an image is visible on note preview it will not appear in images preview * Touched up text algorithm to better display note titles --- client/index.html | 2 +- client/src/assets/semantic-helper.css | 3 + .../src/components/AttachmentDisplayCard.vue | 10 +- client/src/components/GlobalSiteMenu.vue | 8 +- client/src/components/NoteInputPanel.vue | 8 +- .../src/components/NoteTitleDisplayCard.vue | 28 +++- .../SimpleAttachmentNoteComponent.vue | 3 +- client/src/pages/AttachmentsPage.vue | 139 +++++++++++++++--- client/src/router/index.js | 10 +- server/helpers/ProcessText.js | 9 +- server/models/Attachment.js | 15 +- server/models/Note.js | 9 ++ server/routes/attachmentController.js | 2 +- 13 files changed, 208 insertions(+), 38 deletions(-) diff --git a/client/index.html b/client/index.html index 5f04839..35f3698 100644 --- a/client/index.html +++ b/client/index.html @@ -8,7 +8,7 @@ - + Notes diff --git a/client/src/assets/semantic-helper.css b/client/src/assets/semantic-helper.css index dd1c8e1..1cb6442 100644 --- a/client/src/assets/semantic-helper.css +++ b/client/src/assets/semantic-helper.css @@ -55,6 +55,9 @@ body { background-color: var(--background_color); border-color: var(--border_color); } +.ui.icon.input > i.icon { + color: var(--text_color); +} div.ui.basic.green.label { background-color: var(--background_color) !important; } diff --git a/client/src/components/AttachmentDisplayCard.vue b/client/src/components/AttachmentDisplayCard.vue index eda4b48..c99563c 100644 --- a/client/src/components/AttachmentDisplayCard.vue +++ b/client/src/components/AttachmentDisplayCard.vue @@ -98,7 +98,12 @@
- + + +
Save
{{linkText}} @@ -139,6 +144,7 @@ unfolded:true, visible: true, + showSave: false, working: false, } @@ -199,6 +205,8 @@ }, saveIt(){ + this.showSave = false + //Don't save text if it didn'th change if(this.item.text == this.text){ return diff --git a/client/src/components/GlobalSiteMenu.vue b/client/src/components/GlobalSiteMenu.vue index 6028eea..88c1eaf 100644 --- a/client/src/components/GlobalSiteMenu.vue +++ b/client/src/components/GlobalSiteMenu.vue @@ -166,7 +166,7 @@ @@ -233,11 +233,13 @@ this.mobile = this.$store.getters.getIsUserOnMobile this.collapsed = this.$store.getters.getIsUserOnMobile - // {{ totals['totalNotes'] }} - if(this.mobile){ this.menuOpen = false } + + if(this.loggedIn){ + this.$store.dispatch('fetchAndUpdateUserTotals') + } }, computed: { diff --git a/client/src/components/NoteInputPanel.vue b/client/src/components/NoteInputPanel.vue index 6c73e11..de38085 100644 --- a/client/src/components/NoteInputPanel.vue +++ b/client/src/components/NoteInputPanel.vue @@ -582,8 +582,10 @@ // simple function that trys to evaluate javascript const shittyMath = (string) => { + //Remove all chars but math chars + const cleanString = String(string).replace(/[a-zA-Z\s]*/g,'') try { - return Function('"use strict"; return (' + string + ')')(); + return Function('"use strict"; return (' + cleanString + ')')(); } catch (error) { console.log('Math Error: ', string) return null @@ -596,8 +598,7 @@ const line = node.innerText.trim() // = sign exists and its the last character in the string - let equalLocation = line.indexOf('=') - if(equalLocation != -1 && (line.length-1) == equalLocation ){ + if(line.indexOf('=') != -1 && (line.length-1) == line.indexOf('=')){ //Pull out everything before the formula and try to evaluate it const formula = line.split('=').shift() @@ -607,6 +608,7 @@ if(!isNaN(output) && output != null){ //Since there is HTML in the line, splice in the number after the = sign + let equalLocation = node.innerHTML.indexOf('=') let newLine = node.innerHTML.slice(0, equalLocation+1).trim() newLine += ` ${output}` newLine += node.innerHTML.slice(equalLocation+1).trim() diff --git a/client/src/components/NoteTitleDisplayCard.vue b/client/src/components/NoteTitleDisplayCard.vue index 2a12f91..15520cd 100644 --- a/client/src/components/NoteTitleDisplayCard.vue +++ b/client/src/components/NoteTitleDisplayCard.vue @@ -66,9 +66,9 @@
-
+
- +
@@ -118,6 +118,30 @@ iconColor: null, } }, + computed: { + getThumbs(){ + if(!this.note.thumbs){ + return [] + } + + let notDisplaying = [] + + //Remove images displaying in text from the thumbnails + this.note.thumbs.forEach( path => { + + const titleLocation = String(this.note.title).indexOf(path) + const subtextLocation = String(this.note.subtext).indexOf(path) + + if(titleLocation != -1 || subtextLocation != -1){ + return + } + + notDisplaying.push(path) + }) + + return notDisplaying + } + }, beforeMount(){ this.note = this.data diff --git a/client/src/components/SimpleAttachmentNoteComponent.vue b/client/src/components/SimpleAttachmentNoteComponent.vue index 95d09f5..e4d9a21 100644 --- a/client/src/components/SimpleAttachmentNoteComponent.vue +++ b/client/src/components/SimpleAttachmentNoteComponent.vue @@ -87,7 +87,8 @@ }, mounted(){ - axios.post('/api/attachment/search', {'attachmentType':2}) + + axios.post('/api/attachment/search', {'attachmentType':'files', 'setSize':1000}) .then( ({data}) => { //Sort files into two categories diff --git a/client/src/pages/AttachmentsPage.vue b/client/src/pages/AttachmentsPage.vue index 9bee76d..ecd56c3 100644 --- a/client/src/pages/AttachmentsPage.vue +++ b/client/src/pages/AttachmentsPage.vue @@ -1,8 +1,8 @@