Skip to content
Snippets Groups Projects
Commit e274a094 authored by Adam Procter's avatar Adam Procter
Browse files

added shortcuts support

added n key
parent 61a570c7
Branches shortcuts1
No related tags found
No related merge requests found
# 0.1.8
_25th March 2020_
### Added
- New start of Keyboard Shortcut support, pressing n key now creates new nodes.
### Changed
- Simplified About page opening text
# 0.1.7 # 0.1.7
_15th March 2020_ _15th March 2020_
......
{ {
"name": "nodenogg.in", "name": "nodenogg.in",
"version": "0.1.7", "version": "0.1.8",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
}, },
"dependencies": { "dependencies": {
"core-js": "^3.6.4", "core-js": "^3.6.4",
"marked": "^0.8.0", "marked": "^0.8.2",
"pouchdb": "^7.2.1", "pouchdb": "^7.2.1",
"pouchdb-find": "^7.2.1", "pouchdb-find": "^7.2.1",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-context": "^5.0.0", "vue-context": "^5.1.0",
"vue-draggable-resizable": "^2.1.0", "vue-draggable-resizable": "^2.1.0",
"vue-emoji-picker": "^1.0.1", "vue-emoji-picker": "^1.0.1",
"vue-router": "^3.1.6", "vue-router": "^3.1.6",
......
...@@ -20,11 +20,15 @@ ...@@ -20,11 +20,15 @@
<form> <form>
<div v-for="value in myNodes" v-bind:key="value.node_id"> <div v-for="value in myNodes" v-bind:key="value.node_id">
<textarea <textarea
@focus="editTrue(true)"
@blur="editTrue(false)"
autofocus
v-if="nodeid == value.node_id" v-if="nodeid == value.node_id"
@input="editNode" @input="editNode"
v-model="value.node_text" v-model="value.node_text"
:id="nodeid" :id="nodeid"
class="drag-cancel" class="drag-cancel"
ref="nodetext"
></textarea> ></textarea>
</div> </div>
<h3>Reactions</h3> <h3>Reactions</h3>
...@@ -59,10 +63,20 @@ export default { ...@@ -59,10 +63,20 @@ export default {
pickupz: 99 pickupz: 99
} }
}, },
// FIXME: how do we know how to focus on the newest node ?
// FIXME: Tab between them would also be good
// var delay = 100
// var input
// mounted() {
// setTimeout(this.setFocus, delay)
// input = this.$refs.nodetext
// console.log(input)
// },
// method
// setFocus() {
// this.$refs.nodetext.focus()
// },
mounted() {
//
},
computed: mapState({ computed: mapState({
myNodes: state => state.myNodes, myNodes: state => state.myNodes,
configPositions: state => state.configPositions, configPositions: state => state.configPositions,
...@@ -134,9 +148,11 @@ export default { ...@@ -134,9 +148,11 @@ export default {
}) })
}, },
setFocus() { editTrue(e) {
// this.$refs.nodetext.focus() this.$emit('editTrue', e)
// console.log(e)
}, },
editNode(e) { editNode(e) {
var nodeid = e.target.id var nodeid = e.target.id
var nodetext = e.target.value var nodetext = e.target.value
......
export const shortcutsMixin = {
created() {
// console.log('hey mix')
},
methods: {
handleKeyPress(e) {
if (this.shortcutstate == false) {
if (e.keyCode == 78) {
// n for new
this.addNode()
}
}
}
}
}
...@@ -34,6 +34,7 @@ var remote = ...@@ -34,6 +34,7 @@ var remote =
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
shortcutstate: false,
version: process.env.VUE_APP_VERSION, version: process.env.VUE_APP_VERSION,
localnodeid: '', localnodeid: '',
global_pos_name: 'positions', global_pos_name: 'positions',
...@@ -230,6 +231,12 @@ const store = new Vuex.Store({ ...@@ -230,6 +231,12 @@ const store = new Vuex.Store({
}) })
}, },
//
SHORTCUT_STATE(state, e) {
state.shortcutstate = e
},
ADD_NODE(state, e) { ADD_NODE(state, e) {
var uniqueid = var uniqueid =
Math.random() Math.random()
...@@ -460,6 +467,10 @@ const store = new Vuex.Store({ ...@@ -460,6 +467,10 @@ const store = new Vuex.Store({
editNode: ({ commit }, { nodeid, nodetext }) => { editNode: ({ commit }, { nodeid, nodetext }) => {
commit('EDIT_NODE', { nodeid, nodetext }) commit('EDIT_NODE', { nodeid, nodetext })
}, },
shortcutState: ({ commit }, e) => {
commit('SHORTCUT_STATE', e)
},
deleteFlag: ({ commit }, e) => { deleteFlag: ({ commit }, e) => {
// var text = e.target.value // var text = e.target.value
commit('DELETE_FLAG', e) commit('DELETE_FLAG', e)
......
...@@ -2,12 +2,9 @@ ...@@ -2,12 +2,9 @@
<div class="about"> <div class="about">
<h1>About</h1> <h1>About</h1>
<p> <p>
Currently digital tools do a really poor job of extending the design nodenogg.in is designed to support a new type of co-creation, a messy
studio design thinking processes. spatial area in which you work together creating and connecting ideas and
</p> concepts
<p>
This tool is designed to support a new type of co-creation, a spatial and
messy area to work together connecting ideas and concepts.
</p> </p>
<p> <p>
Made by Adam Procter Made by Adam Procter
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
/> />
<NodesLayer <NodesLayer
@editTrue="(e) => editTrue(e)"
v-for="value in myNodes" v-for="value in myNodes"
v-bind:key="value.node_id" v-bind:key="value.node_id"
v-bind:nodeid="value.node_id" v-bind:nodeid="value.node_id"
...@@ -29,9 +30,22 @@ import OtherNodeslayer from '@/components/OtherNodeslayer.vue' ...@@ -29,9 +30,22 @@ import OtherNodeslayer from '@/components/OtherNodeslayer.vue'
import ControlsLayer from '@/components/ControlsLayer.vue' import ControlsLayer from '@/components/ControlsLayer.vue'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { shortcutsMixin } from '@/components/mixins/shortcutsMixin.js'
export default { export default {
name: 'Home', name: 'Home',
// Shortcut mixin is here so we can call the keyboard controls anytime
mixins: [shortcutsMixin],
created() {
if (typeof window !== 'undefined') {
document.addEventListener('keydown', this.handleKeyPress)
}
},
beforeDestroy() {
if (typeof window !== 'undefined') {
document.removeEventListener('keydown', this.handleKeyPress)
}
},
data: function() { data: function() {
return { return {
...@@ -48,13 +62,23 @@ export default { ...@@ -48,13 +62,23 @@ export default {
}, },
computed: mapState({ computed: mapState({
myNodes: state => state.myNodes, myNodes: state => state.myNodes,
otherNodes: state => state.otherNodes otherNodes: state => state.otherNodes,
shortcutstate: state => state.shortcutstate
}), }),
methods: { methods: {
clientAdded() { clientAdded() {
this.clientset = !this.clientset this.clientset = !this.clientset
}, },
editTrue(e) {
this.$store.dispatch('shortcutState', e)
},
// This is here to support the shortcuts
addNode() {
this.$store.dispatch('addNode')
},
offlineTriggered() { offlineTriggered() {
this.offline = true this.offline = true
}, },
......
...@@ -4511,9 +4511,9 @@ map-visit@^1.0.0: ...@@ -4511,9 +4511,9 @@ map-visit@^1.0.0:
dependencies: dependencies:
object-visit "^1.0.0" object-visit "^1.0.0"
marked@^0.8.0: marked@^0.8.2:
version "0.8.0" version "0.8.2"
resolved "https://registry.yarnpkg.com/marked/-/marked-0.8.0.tgz#ec5c0c9b93878dc52dd54be8d0e524097bd81a99" resolved "https://registry.yarnpkg.com/marked/-/marked-0.8.2.tgz#4faad28d26ede351a7a1aaa5fec67915c869e355"
md5.js@^1.3.4: md5.js@^1.3.4:
version "1.3.5" version "1.3.5"
...@@ -7198,9 +7198,9 @@ vue-clickaway@^2.2.2: ...@@ -7198,9 +7198,9 @@ vue-clickaway@^2.2.2:
dependencies: dependencies:
loose-envify "^1.2.0" loose-envify "^1.2.0"
vue-context@^5.0.0: vue-context@^5.1.0:
version "5.0.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/vue-context/-/vue-context-5.0.0.tgz#7f9a90bb00a45eba6aad1d49fdf9e0a946bf503f" resolved "https://registry.yarnpkg.com/vue-context/-/vue-context-5.1.0.tgz#cf007f4728d36c007a8fb7dcf75f61b8c8251343"
dependencies: dependencies:
vue-clickaway "^2.2.2" vue-clickaway "^2.2.2"
......
{
"folders": [
{
"path": "."
}
],
"settings": {}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment