clipboard_available getter
This commit is contained in:
parent
547ffa7a7b
commit
4c0bde0811
@ -34,7 +34,7 @@
|
|||||||
<li v-if="hosting"><i @click.stop.prevent="onClipboard" class="fas fa-clipboard"></i></li>
|
<li v-if="hosting"><i @click.stop.prevent="onClipboard" class="fas fa-clipboard"></i></li>
|
||||||
</ul>
|
</ul>
|
||||||
<neko-resolution ref="resolution" v-if="admin" />
|
<neko-resolution ref="resolution" v-if="admin" />
|
||||||
<neko-clipboard ref="clipboard" v-if="hosting && !navigator.clipboard" />
|
<neko-clipboard ref="clipboard" v-if="hosting && !clipboard_available" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -237,6 +237,10 @@
|
|||||||
return this.$accessor.settings.scroll_invert
|
return this.$accessor.settings.scroll_invert
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get clipboard_available() {
|
||||||
|
return 'clipboard' in navigator
|
||||||
|
}
|
||||||
|
|
||||||
get clipboard() {
|
get clipboard() {
|
||||||
return this.$accessor.remote.clipboard
|
return this.$accessor.remote.clipboard
|
||||||
}
|
}
|
||||||
@ -310,7 +314,7 @@
|
|||||||
|
|
||||||
@Watch('clipboard')
|
@Watch('clipboard')
|
||||||
onClipboardChanged(clipboard: string) {
|
onClipboardChanged(clipboard: string) {
|
||||||
if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
|
if (this.clipboard_available && typeof navigator.clipboard.writeText === 'function') {
|
||||||
navigator.clipboard.writeText(clipboard).catch(console.error)
|
navigator.clipboard.writeText(clipboard).catch(console.error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,7 +432,7 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hosting && navigator.clipboard && typeof navigator.clipboard.readText === 'function') {
|
if (this.hosting && this.clipboard_available && typeof navigator.clipboard.readText === 'function') {
|
||||||
navigator.clipboard
|
navigator.clipboard
|
||||||
.readText()
|
.readText()
|
||||||
.then(text => {
|
.then(text => {
|
||||||
|
Reference in New Issue
Block a user