Compare commits

..

No commits in common. "196224d0b8ccf48b536ba794355561d98c31924a" and "1600bd132c5368837c195f3ca2d13eef441ad65b" have entirely different histories.

4 changed files with 16 additions and 32 deletions

View File

@ -45,7 +45,7 @@
ref="titleTextarea" ref="titleTextarea"
v-on:keyup="titleResize" v-on:keyup="titleResize"
v-on:keydown="titleResize" v-on:keydown="titleResize"
@keydown.enter.exact.prevent="editor.focus(); editor.moveCursorToEnd()" @keydown.enter.exact.prevent="editor.focus()"
rows="1" rows="1"
:style="{ 'background-color':styleObject['noteBackground'], 'color':styleObject['noteText']}" :style="{ 'background-color':styleObject['noteBackground'], 'color':styleObject['noteText']}"
v-on:blur="save" type="text" v-model="noteTitle" placeholder="Title" class="stealth-input"> v-on:blur="save" type="text" v-model="noteTitle" placeholder="Title" class="stealth-input">
@ -59,7 +59,7 @@
<h3 class="ui center aligned icon header"> <h3 class="ui center aligned icon header">
<i class="green lock alternate icon"></i> <i class="green lock alternate icon"></i>
<span v-if="!lockedOut"> <span v-if="!lockedOut" :data-tooltip="`Unlock Attempts: ${decryptAttempts}`">
This note is encrypted and requires a password to be opened. This note is encrypted and requires a password to be opened.
</span> </span>
@ -860,10 +860,7 @@
this.created = response.data.created this.created = response.data.created
this.updated = response.data.updated this.updated = response.data.updated
this.noteTitle = '' this.noteTitle = response.data.title
if(response.data.title){
this.noteTitle = response.data.title
}
this.noteText = response.data.text this.noteText = response.data.text
this.diffNoteText = response.data.text this.diffNoteText = response.data.text
@ -914,8 +911,6 @@
}, },
diffText(){ diffText(){
return
// dont emit to one user // dont emit to one user
if(this.usersOnNote <= 1){ if(this.usersOnNote <= 1){
return return
@ -964,7 +959,7 @@
}, },
patchText(patch_text){ patchText(patch_text){
return console.log(patch_text)
// //
// Capture x,y of caret and position into string // Capture x,y of caret and position into string
@ -972,10 +967,10 @@
let currentSelection = this.editor.getSelection() let currentSelection = this.editor.getSelection()
let lineText = currentSelection.startContainer.textContent let lineText = currentSelection.startContainer.textContent
// console.log(lineText) console.log(lineText)
let cursorOffset = parseInt(currentSelection.startOffset) //number of characters in let cursorOffset = parseInt(currentSelection.startOffset) //number of characters in
let path = this.xpath(currentSelection.commonAncestorContainer.parentElement) let path = this.xpath(currentSelection.commonAncestorContainer.parentElement)
// console.log(path) console.log(path)
// //
@ -984,21 +979,21 @@
let currentText = this.editor._getHTML() let currentText = this.editor._getHTML()
const startingLines = (currentText.match(/<br>/g) || '').length + 1 const startingLines = (currentText.match(/<br>/g) || '').length + 1
// console.log('1') console.log('1')
const dmp = new DiffMatchPatch.diff_match_patch() const dmp = new DiffMatchPatch.diff_match_patch()
var patches = dmp.patch_fromText(patch_text); var patches = dmp.patch_fromText(patch_text);
var results = dmp.patch_apply(patches, currentText); var results = dmp.patch_apply(patches, currentText);
let newText = results[0] let newText = results[0]
// console.log('2') console.log('2')
this.noteText = newText this.noteText = newText
this.diffNoteText = newText this.diffNoteText = newText
// console.log('3') console.log('3')
// this.editor._setHTML(newText) // this.editor._setHTML(newText)
this.editor.setHTML(newText) this.editor.setHTML(newText)
// console.log('4') console.log('4')
// //
// I user hasn't selected the document, we are done here // I user hasn't selected the document, we are done here
@ -1046,14 +1041,14 @@
} }
} }
// console.log('Targeting Node') console.log('Targeting Node')
// console.log(node) console.log(node)
//Create and set range //Create and set range
let squireRange = this.editor.createRange(node, cursorOffset) let squireRange = this.editor.createRange(node, cursorOffset)
squireRange.collapse(true) squireRange.collapse(true)
this.editor.setSelection(squireRange) this.editor.setSelection(squireRange)
// console.log('cursor set') console.log('cursor set')
}, 20) }, 20)
// } // }

View File

@ -59,7 +59,6 @@
<h2 v-if="fastFilters['withTags'] == 1">Notes with Tags</h2> <h2 v-if="fastFilters['withTags'] == 1">Notes with Tags</h2>
<h2 v-if="fastFilters['onlyArchived'] == 1">Archived Notes</h2> <h2 v-if="fastFilters['onlyArchived'] == 1">Archived Notes</h2>
<h2 v-if="fastFilters['onlyShowSharedNotes'] == 1">Shared Notes</h2> <h2 v-if="fastFilters['onlyShowSharedNotes'] == 1">Shared Notes</h2>
<h2 v-if="fastFilters['onlyShowEncrypted'] == 1">Password Protected Notes</h2>
<!-- tags section --> <!-- tags section -->
<div v-if="commonTags.length > 0" class="sixteen wide column"> <div v-if="commonTags.length > 0" class="sixteen wide column">
@ -185,8 +184,7 @@
'shared': ['envelope outline', 'Received Notes'], 'shared': ['envelope outline', 'Received Notes'],
'sent': ['paper plane outline', 'Shared Notes'], 'sent': ['paper plane outline', 'Shared Notes'],
'notes': ['file','Notes'], 'notes': ['file','Notes'],
'highlights': ['paragraph', 'Found In Text'], 'highlights': ['paragraph', 'Found In Text']
'locked': ['lock', 'Password Protected']
}, },
noteSections: { noteSections: {
pinned: [], pinned: [],
@ -195,7 +193,6 @@
sent:[], sent:[],
notes: [], notes: [],
highlights: [], highlights: [],
locked: []
}, },
} }
@ -602,10 +599,6 @@
this.noteSections.sent.push(note) this.noteSections.sent.push(note)
return return
} }
if(note.encrypted == 1 && this.fastFilters.onlyShowEncrypted == 1){
this.noteSections.locked.push(note)
return
}
if(note.note_highlights.length > 0){ if(note.note_highlights.length > 0){
this.noteSections.highlights.push(note) this.noteSections.highlights.push(note)
return return

View File

@ -436,6 +436,7 @@ Note.get = (userId, noteId, password = '') => {
//To many attempts in less than 5 minutes, note is locked //To many attempts in less than 5 minutes, note is locked
if(noteData.decrypt_attempts_count > 3 && timeSinceLastUnlock < 300){ if(noteData.decrypt_attempts_count > 3 && timeSinceLastUnlock < 300){
console.log('Locked Out')
noteLockedOut = true noteLockedOut = true
} }
@ -443,6 +444,7 @@ Note.get = (userId, noteId, password = '') => {
if(noteData.decrypt_attempts_count > 0 && timeSinceLastUnlock > 300){ if(noteData.decrypt_attempts_count > 0 && timeSinceLastUnlock > 300){
noteLockedOut = false noteLockedOut = false
noteData.decrypt_attempts_count = 0 noteData.decrypt_attempts_count = 0
console.log('Resseting Lockout')
db.promise().query('UPDATE note_raw_text SET last_decrypted_date = ?, decrypt_attempts_count = 0 WHERE id = ?', [nowTime, rawTextId ]) db.promise().query('UPDATE note_raw_text SET last_decrypted_date = ?, decrypt_attempts_count = 0 WHERE id = ?', [nowTime, rawTextId ])
} }
} }
@ -626,10 +628,8 @@ Note.search = (userId, searchQuery, searchTags, fastFilters) => {
searchAllNotes = true searchAllNotes = true
} }
//Encrypted Note
if(fastFilters.onlyShowEncrypted == 1){ if(fastFilters.onlyShowEncrypted == 1){
noteSearchQuery += ' AND encrypted = 1' noteSearchQuery += ' AND encrypted = 1'
searchAllNotes = true
} }
//If tags are passed, use those tags in search //If tags are passed, use those tags in search

View File

@ -23,10 +23,6 @@ Tag.userTags = (userId, searchQuery, searchTags, fastFilters) => {
query += ' AND note.share_user_id IS NULL' query += ' AND note.share_user_id IS NULL'
} }
if(fastFilters && fastFilters.onlyShowEncrypted == 1){
query += ' AND note.encrypted = 1' //Show Archived
}
//Show archived notes, only if fast filter is set, default to not archived //Show archived notes, only if fast filter is set, default to not archived
if(fastFilters && fastFilters.onlyArchived == 1){ if(fastFilters && fastFilters.onlyArchived == 1){
query += ' AND note.archived = 1' //Show Archived query += ' AND note.archived = 1' //Show Archived