2017-05-22 17:32:52 +00:00
|
|
|
<template lang="pug">
|
2017-05-27 02:43:34 +00:00
|
|
|
transition(:duration="400")
|
|
|
|
.modal(v-show='isShown', v-cloak)
|
|
|
|
transition(name='modal-background')
|
|
|
|
.modal-background(v-show='isShown')
|
|
|
|
.modal-container
|
|
|
|
transition(name='modal-content')
|
|
|
|
.modal-content(v-show='isShown')
|
|
|
|
header.is-blue
|
2017-05-30 01:58:33 +00:00
|
|
|
span {{ $t('modal.anchortitle') }}
|
2017-05-27 02:43:34 +00:00
|
|
|
section
|
|
|
|
p.control.is-fullwidth
|
|
|
|
input.input(type='text', ref='anchorURLinput', v-model='anchorURL')
|
|
|
|
footer
|
2017-05-30 01:58:33 +00:00
|
|
|
a.button.is-grey.is-outlined(v-on:click='cancel') {{ $t('modal.discard') }}
|
|
|
|
a.button.is-blue(v-clipboard='anchorURL', @success="clipboardSuccess", @error="clipboardError") {{ $t('modal.copyclipboard') }}
|
2017-05-21 03:21:16 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: 'anchor',
|
|
|
|
data () {
|
2017-05-22 17:32:52 +00:00
|
|
|
return {}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
anchorURL () {
|
|
|
|
return window.location.href.split('#')[0] + '#' + this.$store.state.anchor.hash
|
|
|
|
},
|
|
|
|
isShown () {
|
|
|
|
return this.$store.state.anchor.shown
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
cancel () {
|
2017-06-10 14:41:15 +00:00
|
|
|
this.$store.dispatch('anchor/close')
|
2017-05-22 17:32:52 +00:00
|
|
|
},
|
|
|
|
clipboardSuccess () {
|
|
|
|
this.$store.dispatch('alert', {
|
|
|
|
style: 'blue',
|
|
|
|
icon: 'clipboard',
|
2017-05-30 01:58:33 +00:00
|
|
|
msg: this.$t('modal.anchorsuccess')
|
2017-05-22 17:32:52 +00:00
|
|
|
})
|
2017-06-10 14:41:15 +00:00
|
|
|
this.$store.dispatch('anchor/close')
|
2017-05-22 17:32:52 +00:00
|
|
|
},
|
|
|
|
clipboardError () {
|
|
|
|
this.$store.dispatch('alert', {
|
|
|
|
style: 'red',
|
|
|
|
icon: 'clipboard',
|
2017-05-30 01:58:33 +00:00
|
|
|
msg: this.$t('modal.anchorerror')
|
2017-05-22 17:32:52 +00:00
|
|
|
})
|
|
|
|
this.$refs.anchorURLinput.select()
|
2017-05-21 03:21:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|