Added paste event to quick notes allowing for quick note to submit the second data is pasted in

Added option on quick note to submit with enter or CTRL + ENTER
Removed a console log statement.
This commit is contained in:
Max G 2020-02-14 05:31:38 +00:00
parent 8833a213a7
commit b2f241dbba
3 changed files with 47 additions and 7 deletions

View File

@ -79,7 +79,7 @@
totals(newVal, oldVal){
if(oldVal && newVal && newVal[this.numberId] != oldVal[this.numberId]){
console.log('New number ', newVal[this.numberId])
// console.log('New number ', newVal[this.numberId])
this.oldNumber = oldVal[this.numberId]
this.newNumber = newVal[this.numberId]
@ -90,7 +90,6 @@
this.animateUp = true
}
setTimeout( () => {
this.animateUp = false
this.animateDown = false

View File

@ -28,6 +28,7 @@
<i class="green archive icon"></i>Archived
<!-- <span>{{ $store.getters.totals['archivedNotes'] }}</span> -->
</div>
</div>
<div class="eight wide column" v-if="showClear">

View File

@ -7,11 +7,31 @@
<i class="paper plane outline icon"></i>
<div class="content">
Quick
<div class="sub header">Add new information with great speed</div>
<div class="sub header">Rapidly save text</div>
</div>
</h2>
</div>
<div class="sixteen wide middle aligned column">
<div class="ui compact basic button"
v-on:click="enterToSubmit = !enterToSubmit">
<i v-if="enterToSubmit" class="green toggle on icon"></i>
<i v-else class="toggle off icon"></i>
<span v-if="enterToSubmit">Save after Enter press</span>
<span v-else>CTRL + Enter to Save</span>
</div>
<div class="ui compact basic button"
v-on:click="pasteToSubmit = !pasteToSubmit">
<i v-if="pasteToSubmit" class="green check circle outline icon"></i>
<i v-else class="circle outline icon"></i>
Save after Pasting
</div>
</div>
<div class="ui sixteen wide column">
<div class="ui form">
<div class="field">
@ -21,14 +41,15 @@
ref="fastInput"
v-model="newText"
v-on:keydown="checkKeyup"
v-on:paste="onPaste"
placeholder="Push to the top of the quick note."
></textarea>
</div>
<div class="field">
<div v-on:click="appendQuickNote" class="ui green button">Save (CRTL + Enter)</div>
<div v-on:click="appendQuickNote" class="ui green button">Save</div>
<div v-if="quickNoteId" class="ui right floated basic button" v-on:click="$router.push('/attachments/note/'+quickNoteId)">
<i class="folder open outline icon"></i>
Quick Files + Links
Files
</div>
<div v-if="quickNoteId" v-on:click="openNoteEdit" class="ui right floated basic button">
<i class="file outline icon"></i>
@ -57,7 +78,9 @@
return {
newText: '',
savedQuickNoteText: '',
quickNoteId: null
quickNoteId: null,
pasteToSubmit: true,
enterToSubmit: true,
}
},
beforeCreate: function(){
@ -95,9 +118,17 @@
element.style.height = 'auto';
element.style.height = (element.scrollHeight + padding) +'px';
//Enter Key submits by default
if(event.keyCode == 13 && this.enterToSubmit == true){
this.appendQuickNote()
return
}
//Alternate submit
//If command+enter or control+enter is pressed, submit
if((event.metaKey || event.ctrlKey) && [13].includes(event.keyCode)){
if((event.metaKey || event.ctrlKey) && [13].includes(event.keyCode) && this.enterToSubmit == false){
this.appendQuickNote()
return
}
},
appendQuickNote(){
@ -122,6 +153,15 @@
this.quickNoteId = results.data.id
})
},
onPaste(event){
if(this.pasteToSubmit == true){
setTimeout( () => {
this.appendQuickNote()
}, 10)
}
return true
},
}
}
</script>