copy to clipboard text item url #782
This commit is contained in:
@@ -21,6 +21,7 @@ export const REST = axios.create({
|
||||
crossorigin: true,
|
||||
headers: {
|
||||
'Accept': 'application/json'
|
||||
// 'Access-Control-Allow-Credentials': true
|
||||
// 'Access-Control-Allow-Origin': '*'
|
||||
// 'Access-Control-Allow-Credentials':
|
||||
}
|
||||
})
|
||||
|
||||
@@ -46,7 +46,16 @@ export default {
|
||||
this.html = `<div` +
|
||||
` class="tei${this.uuid === this.textid ? ' active' : ''}"` +
|
||||
` data-uuid="${this.uuid}"` +
|
||||
`>${this.tei}</div>`
|
||||
`>` +
|
||||
`<a` +
|
||||
` href="http://${window.apipath}/items/${this.uuid}"` +
|
||||
` title="Copy to clipboard ${this.uuid}"` +
|
||||
` class="text-item-link"` +
|
||||
` @click.prevent="onClickCopyClipboard"` +
|
||||
`>` +
|
||||
`<span class="mdi mdi-open-in-new" />` +
|
||||
`</a>` +
|
||||
`${this.tei}</div>`
|
||||
this.parseLinks()
|
||||
// this.parsePageBreaks()
|
||||
// console.log('EdText: builded html', this.html)
|
||||
@@ -143,6 +152,13 @@ export default {
|
||||
onLeaveLink (e) {
|
||||
// console.log('EdText onLeaveLink(e)', e)
|
||||
this.$emit('onLeaveLink')
|
||||
},
|
||||
onClickCopyClipboard (e) {
|
||||
e.preventDefault()
|
||||
console.log('onClickCopyClipboard', e)
|
||||
// navigator.clipboard.writeText(e.target.getAttribute('href'))
|
||||
this.$copyText(e.target.getAttribute('href'))
|
||||
return false
|
||||
}
|
||||
},
|
||||
render (h) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import InfiniteLoading from 'vue-infinite-loading'
|
||||
import VueScrollTo from 'vue-scrollto'
|
||||
import VueSelect from 'vue-select'
|
||||
import Vue2TouchEvents from 'vue2-touch-events'
|
||||
import VueClipboard from 'vue-clipboard2'
|
||||
|
||||
import App from './App'
|
||||
|
||||
@@ -33,6 +34,7 @@ Vue.use(InfiniteLoading, {
|
||||
Vue.use(VueScrollTo)
|
||||
Vue.component('v-select', VueSelect)
|
||||
Vue.use(Vue2TouchEvents)
|
||||
Vue.use(VueClipboard)
|
||||
|
||||
// https://apple.stackexchange.com/questions/17077/add-a-hosts-file-entry-without-jailbreaking
|
||||
window.apipath = process.env === 'prod' || window.location.hostname === 'dev.gdp.fr' ? `http://${window.location.hostname}/api` : 'http://localhost:8984'
|
||||
|
||||
Reference in New Issue
Block a user