Bug fixes and encryption handling

This commit is contained in:
Max G
2020-03-14 06:04:03 +00:00
parent 795f1b7d76
commit 196224d0b8
4 changed files with 31 additions and 15 deletions

View File

@@ -59,7 +59,7 @@
<h3 class="ui center aligned icon header">
<i class="green lock alternate icon"></i>
<span v-if="!lockedOut" :data-tooltip="`Unlock Attempts: ${decryptAttempts}`">
<span v-if="!lockedOut">
This note is encrypted and requires a password to be opened.
</span>
@@ -860,7 +860,10 @@
this.created = response.data.created
this.updated = response.data.updated
this.noteTitle = response.data.title
this.noteTitle = ''
if(response.data.title){
this.noteTitle = response.data.title
}
this.noteText = response.data.text
this.diffNoteText = response.data.text
@@ -911,6 +914,8 @@
},
diffText(){
return
// dont emit to one user
if(this.usersOnNote <= 1){
return
@@ -959,7 +964,7 @@
},
patchText(patch_text){
console.log(patch_text)
return
//
// Capture x,y of caret and position into string
@@ -967,10 +972,10 @@
let currentSelection = this.editor.getSelection()
let lineText = currentSelection.startContainer.textContent
console.log(lineText)
// console.log(lineText)
let cursorOffset = parseInt(currentSelection.startOffset) //number of characters in
let path = this.xpath(currentSelection.commonAncestorContainer.parentElement)
console.log(path)
// console.log(path)
//
@@ -979,21 +984,21 @@
let currentText = this.editor._getHTML()
const startingLines = (currentText.match(/<br>/g) || '').length + 1
console.log('1')
// console.log('1')
const dmp = new DiffMatchPatch.diff_match_patch()
var patches = dmp.patch_fromText(patch_text);
var results = dmp.patch_apply(patches, currentText);
let newText = results[0]
console.log('2')
// console.log('2')
this.noteText = newText
this.diffNoteText = newText
console.log('3')
// console.log('3')
// 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
@@ -1041,14 +1046,14 @@
}
}
console.log('Targeting Node')
console.log(node)
// console.log('Targeting Node')
// console.log(node)
//Create and set range
let squireRange = this.editor.createRange(node, cursorOffset)
squireRange.collapse(true)
this.editor.setSelection(squireRange)
console.log('cursor set')
// console.log('cursor set')
}, 20)
// }