feat: migrate all copy to clipboard actions to v-clipboard

This commit is contained in:
liyasthomas
2021-07-27 18:17:41 +05:30
parent 37ad8e08fc
commit 78fccc8583
21 changed files with 120 additions and 129 deletions

View File

@@ -41,8 +41,8 @@
:lang="'json'"
:lint="false"
:options="{
maxLines: '16',
minLines: '8',
maxLines: 16,
minLines: 8,
fontSize: '12px',
autoScrollEditorIntoView: true,
showPrintMargin: false,

View File

@@ -75,7 +75,7 @@
v-tippy="{ theme: 'tooltip' }"
:title="`${$t(
'prettify_query'
)} (${getSpecialKey()}-P)`"
)} <kbd>${getSpecialKey()}</kbd><kbd>P</kbd>`"
:icon="prettifyQueryIcon"
@click.native="prettifyQuery"
/>
@@ -94,7 +94,7 @@
:on-run-g-q-l-query="runQuery"
:options="{
maxLines: Infinity,
minLines: '16',
minLines: 16,
fontSize: '12px',
autoScrollEditorIntoView: true,
showPrintMargin: false,
@@ -146,7 +146,7 @@
:lang="'json'"
:options="{
maxLines: Infinity,
minLines: '16',
minLines: 16,
fontSize: '12px',
autoScrollEditorIntoView: true,
showPrintMargin: false,
@@ -333,7 +333,7 @@
:lint="false"
:options="{
maxLines: Infinity,
minLines: '16',
minLines: 16,
fontSize: '12px',
autoScrollEditorIntoView: true,
readOnly: true,
@@ -541,7 +541,7 @@
:lang="'graphqlschema'"
:options="{
maxLines: Infinity,
minLines: '16',
minLines: 16,
fontSize: '12px',
autoScrollEditorIntoView: true,
readOnly: true,
@@ -879,12 +879,7 @@ export default defineComponent({
setTimeout(() => (this.copyVariablesIcon = "content_copy"), 1000)
},
copyToClipboard(content) {
const aux = document.createElement("textarea")
aux.innerText = content
document.body.appendChild(aux)
aux.select()
document.execCommand("copy")
document.body.removeChild(aux)
this.$clipboard(content)
this.$toast.success(this.$t("copied_to_clipboard"), {
icon: "done",
})