Newer
Older
<div v-for="(nodes, index) in $options.myArray" v-bind:key="index">
<div v-for="(value, index) in configPositions" v-bind:key="index">
:w="value.width"
:h="value.height"
:x="value.x_pos"
:y="value.y_pos"
:z="value.z_index"
@activated="onActivated"
@dragging="onDrag"
@resizing="onResize"
@dragstop="onDragstop"
@resizestop="onResizestop"
:drag-cancel="'.drag-cancel'"
style="border: 2px dashed black; background-color: rgb(155, 194, 216)"
<form class="nodes">
<template v-if="nodes.read_mode == false">
<textarea
@focus="editTrue(true)"
@blur="editTrue(false)"
autofocus
v-model="nodes.node_text"
@input="editNode"
:id="nodes.node_id"
placeholder="Type your thoughts and ideas here! (auto saved every keystroke)"
></textarea>
:id="nodes.node_id"
:inner-html.prop="nodes.node_text | marked"
</template>
<div class="btn-row">
<SvgButton
buttonClass="nodes"
@click.prevent="deleteFlag(nodes.node_id)"
/>
<SvgButton2
buttonClass="nodes"
@click.prevent="readFlag(nodes.node_id, nodes.read_mode)"
/>
<div class="allemoji">
<div
class="eachemoji"
v-for="(emojis, index) in configEmoji"
:key="index"
>
<template v-if="emojis.node_id == nodes.node_id">{{
emojis.emoji_text
}}</template>
import SvgButton from '@/components/SvgButton'
import SvgButton2 from '@/components/SvgButton2'
import draggable from '@/experimental/Draggable'
props: {
nodeid: String,
nodetext: String,
nodewidth: Number,
// 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
// },
// method
// setFocus() {
// this.$refs.nodetext.focus()
// },
computed: {
...mapState({
scale: (state) => state.ui.scale,
myNodes: (state) => state.myNodes,
configPositions: (state) => state.configPositions,
configConnections: (state) => state.configConnections,
configEmoji: (state) => state.configEmoji,
toolmode: (state) => state.ui.mode,
}),
nodes_filtered: function () {
return this.myNodes.filter((nodes) => {
return nodes.deleted == false
})
},
},
// this is to stop sync chasing bug
myArray: null,
created() {
//access the custom option using $options
onActivated() {
var i
for (i = 0; i < Object.keys(this.configPositions).length; i++) {
if (this.configPositions[i].node_id == this.nodeid) {
this.width = this.configPositions[i].width
this.height = this.configPositions[i].height
}
}
},
onResizestop(x, y, width, height, zindex) {
zindex = this.pickupz
var i
for (i = 0; i < Object.keys(this.configPositions).length; i++) {
if (this.configPositions[i].node_id == this.nodeid) {
this.width = this.configPositions[i].width
this.height = this.configPositions[i].height
this.pickupz = this.configPositions[i].z_index
}
}
this.width = width
this.height = height
this.$store.dispatch('movePos', {
localnodeid,
x,
y,
width,
height,
onDragstop(x, y, width, height, zindex) {
zindex = this.pickupz
width = this.width
height = this.height
if (this.configPositions[i].node_id == this.nodeid) {
this.localx = this.configPositions[i].x_pos
this.localy = this.configPositions[i].y_pos
this.pickupz = this.configPositions[i].z_index
this.$store.dispatch('movePos', {
localnodeid,
x,
y,
width,
height,
var j
for (j = 0; j < Object.keys(this.configConnections).length; j++) {
if (this.configConnections[j].start_id == this.nodeid) {
this.$store.dispatch('updateConnect', {
localnodeid,
x,
y,
})
}
if (this.configConnections[j].end_id == this.nodeid) {
this.$store.dispatch('updateConnectTwo', {
localnodeid,
x,
y,
})
}
}
var nodeid = e.target.id
var nodetext = e.target.value
this.$store.dispatch('editNode', { nodeid, nodetext })
if (confirm('Confirm discard?')) {
this.$store.dispatch('deleteFlag', { e })
} else {
// nothing happens
}
readFlag(e, f) {
readmode = f
readmode = !readmode
this.$store.dispatch('readFlag', { e, readmode })
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.vdr {
padding: 0 0.5em;
}
box-sizing: border-box;
font-family: 'Inter var', Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
border: none;
outline: none;
background-color: rgb(187, 227, 255);
scrollbar-color: yellow rgb(187, 227, 255);
}
.btn-row {
position: relative;
margin-bottom: 5px;
display: flex;
justify-content: center;
flex-wrap: wrap;
padding: 0 15px;
border-radius: 4px;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(0, auto));