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

tidy up

parent 33f26704
No related branches found
No related tags found
No related merge requests found
...@@ -56,33 +56,11 @@ ...@@ -56,33 +56,11 @@
</p> </p>
</div> </div>
</div> </div>
<div class="btn-row">
<!-- <BaseButton buttonClass="danger" @click="deleteFlag()"
>Delete</BaseButton
> -->
<!-- <div v-if="value.read_mode == true">
<BaseButton
class="read"
buttonClass="action"
@click="readFlag()"
>Edit Mode
</BaseButton>
</div>
<div v-else>
<BaseButton
class="read"
buttonClass="action"
@click="readFlag()"
>Read Mode</BaseButton
>
</div> -->
</div>
</form> </form>
</draggable> </draggable>
</div> </div>
<!-- Same code as above when in any other mode other than move so you can drag nodes--> <!-- as above when in any other mode other than move so you can drag nodes-->
<div v-else> <div v-else>
<draggable <draggable
...@@ -146,27 +124,12 @@ ...@@ -146,27 +124,12 @@
</div> </div>
</div> </div>
<div class="btn-row"> <div class="btn-row">
<!-- <BaseButton buttonClass="danger" @click="deleteFlag()"
>Discard</BaseButton
> -->
<SvgButton buttonClass="nodes" @click.prevent="deleteFlag()" /> <SvgButton buttonClass="nodes" @click.prevent="deleteFlag()" />
<div v-if="value.read_mode == true"> <div v-if="value.read_mode == true">
<SvgButton2 buttonClass="nodes" @click.prevent="readFlag()" /> <SvgButton2 buttonClass="nodes" @click.prevent="readFlag()" />
<!-- <BaseButton
class="read"
buttonClass="action"
@click="readFlag()"
>Edit Mode
</BaseButton> -->
</div> </div>
<div v-else> <div v-else>
<SvgButton2 buttonClass="nodes" @click.prevent="readFlag()" /> <SvgButton2 buttonClass="nodes" @click.prevent="readFlag()" />
<!-- <BaseButton
class="read"
buttonClass="action"
@click="readFlag()"
>Read Mode</BaseButton
> -->
</div> </div>
</div> </div>
</form> </form>
...@@ -183,14 +146,7 @@ import SvgButton from '@/components/SvgButton' ...@@ -183,14 +146,7 @@ import SvgButton from '@/components/SvgButton'
import SvgButton2 from '@/components/SvgButton2' import SvgButton2 from '@/components/SvgButton2'
import draggable from '@/experimental/Draggable' import draggable from '@/experimental/Draggable'
//const splice = (text, idx, rem, str) =>
// text.slice(0, idx) + str + text.slice(idx + Math.abs(rem))
var readmode var readmode
// var selection
// var start
// var finish
export default { export default {
name: 'NodesLayer', name: 'NodesLayer',
...@@ -240,6 +196,7 @@ export default { ...@@ -240,6 +196,7 @@ export default {
toolmode: (state) => state.ui.mode, toolmode: (state) => state.ui.mode,
}), }),
myArray: null, myArray: null,
created() { created() {
//access the custom option using $options //access the custom option using $options
this.$options.myArray = this.myNodes this.$options.myArray = this.myNodes
...@@ -331,13 +288,8 @@ export default { ...@@ -331,13 +288,8 @@ export default {
editTrue(e) { editTrue(e) {
this.$emit('editTrue', e) this.$emit('editTrue', e)
// this.firstload = false
// // console.log(e)
}, },
// called on mouse/ cursor up and save
// may not work on mobile
insertBold() { insertBold() {
// this.text = this.nodetext // this.text = this.nodetext
const { text } = this const { text } = this
...@@ -352,70 +304,14 @@ export default { ...@@ -352,70 +304,14 @@ export default {
// not a function error? for this next line // not a function error? for this next line
textarea.focus() textarea.focus()
// if this updates the textarea then editNode should be called
// to save changes to the backend
setTimeout(() => { setTimeout(() => {
textarea.selectionStart = start + 1 textarea.selectionStart = start + 1
textarea.selectionEnd = end + 1 textarea.selectionEnd = end + 1
}) })
}, },
// TEMP
// onSelect(event) {
// const { selectionStart, selectionEnd } = event.target
// let str = this.nodetext
// str = splice(str, selectionStart, 0, '**')
// str = splice(str, selectionEnd + 1, 0, '**')
// this.text = str
// console.log(this.text)
// var nodeid = this.nodeid
// var nodetext = this.text
// this.$store.dispatch('editNode', { nodeid, nodetext })
// },
// surroundSelection(event) {
// // get the text
// const activeTextarea = event.target
// selection = activeTextarea.value.substring(
// activeTextarea.selectionStart,
// activeTextarea.selectionEnd
// )
// // obtain the index of the first selected character
// start = activeTextarea.selectionStart
// // obtain the index of the last selected character
// finish = activeTextarea.selectionEnd
// },
// makeBold() {
// var editSelection =
// selection.substring(0, start) +
// '**' +
// selection +
// '**' +
// selection.substring(finish, selection.length)
// console.log(editSelection)
// // console logs old word*new word*
// var nodeid = this.nodeid
// var updatedtext =
// this.nodetext.substring(0, start) +
// editSelection +
// this.nodetext.substring(finish + editSelection.length)
// this.$store.dispatch('editNode', { nodeid, updatedtext })
// // console.log(newText)
// // console.log(this.nodetext)
// //console.log(newText)
// // var nodetext =
// // e.target.parentElement.lastChild.previousSibling.previousSibling
// // .childNodes[0].childNodes[0].nodetext
// //this.updateNode(nodeid, newText)
// },
// updateNode(nodeid, nodetext) {
// this.$store.dispatch('editNode', { nodeid, nodetext })
// },
editNode(e) { editNode(e) {
var nodeid = e.target.id var nodeid = e.target.id
var nodetext = e.target.value var nodetext = e.target.value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment