feat: supported copy to clipboard utlity
This commit is contained in:
@@ -90,6 +90,7 @@ import { codegens } from "~/helpers/codegen/codegen"
|
||||
import { getRESTRequest } from "~/newstore/RESTSession"
|
||||
import { getEffectiveRESTRequest } from "~/helpers/utils/EffectiveURL"
|
||||
import { getCurrentEnvironment } from "~/newstore/environments"
|
||||
import { copyToClipboard } from "~/helpers/utils/clipboard"
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@@ -151,7 +152,7 @@ export default defineComponent({
|
||||
this.$emit("handle-import")
|
||||
},
|
||||
copyRequestCode() {
|
||||
;(this.$clipboard as any)(this.requestCode)
|
||||
copyToClipboard(this.requestCode)
|
||||
this.copyIcon = "done"
|
||||
this.$toast.success(this.$t("copied_to_clipboard").toString(), {
|
||||
icon: "done",
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
|
||||
<script>
|
||||
import TextContentRendererMixin from "./mixins/TextContentRendererMixin"
|
||||
import { copyToClipboard } from "~/helpers/utils/clipboard"
|
||||
|
||||
export default {
|
||||
mixins: [TextContentRendererMixin],
|
||||
@@ -102,7 +103,7 @@ export default {
|
||||
}, 1000)
|
||||
},
|
||||
copyResponse() {
|
||||
this.$clipboard(this.responseBodyText)
|
||||
copyToClipboard(this.responseBodyText)
|
||||
this.copyIcon = "done"
|
||||
this.$toast.success(this.$t("copied_to_clipboard"), {
|
||||
icon: "done",
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
|
||||
<script>
|
||||
import TextContentRendererMixin from "./mixins/TextContentRendererMixin"
|
||||
import { copyToClipboard } from "~/helpers/utils/clipboard"
|
||||
|
||||
export default {
|
||||
mixins: [TextContentRendererMixin],
|
||||
@@ -104,7 +105,7 @@ export default {
|
||||
}, 1000)
|
||||
},
|
||||
copyResponse() {
|
||||
this.$clipboard(this.responseBodyText)
|
||||
copyToClipboard(this.responseBodyText)
|
||||
this.copyIcon = "done"
|
||||
this.$toast.success(this.$t("copied_to_clipboard"), {
|
||||
icon: "done",
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
<script>
|
||||
import TextContentRendererMixin from "./mixins/TextContentRendererMixin"
|
||||
import { copyToClipboard } from "~/helpers/utils/clipboard"
|
||||
|
||||
export default {
|
||||
mixins: [TextContentRendererMixin],
|
||||
@@ -95,7 +96,7 @@ export default {
|
||||
}, 1000)
|
||||
},
|
||||
copyResponse() {
|
||||
this.$clipboard(this.responseBodyText)
|
||||
copyToClipboard(this.responseBodyText)
|
||||
this.copyIcon = "done"
|
||||
this.$toast.success(this.$t("copied_to_clipboard"), {
|
||||
icon: "done",
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
<script>
|
||||
import TextContentRendererMixin from "./mixins/TextContentRendererMixin"
|
||||
import { copyToClipboard } from "~/helpers/utils/clipboard"
|
||||
|
||||
export default {
|
||||
mixins: [TextContentRendererMixin],
|
||||
@@ -95,7 +96,7 @@ export default {
|
||||
}, 1000)
|
||||
},
|
||||
copyResponse() {
|
||||
this.$clipboard(this.responseBodyText)
|
||||
copyToClipboard(this.responseBodyText)
|
||||
this.copyIcon = "done"
|
||||
this.$toast.success(this.$t("copied_to_clipboard"), {
|
||||
icon: "done",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @param content The content to be copied
|
||||
*/
|
||||
export function copyToClipboard(content: string) {
|
||||
const dummy = document.createElement("input")
|
||||
const dummy = document.createElement("textarea")
|
||||
document.body.appendChild(dummy)
|
||||
dummy.value = content
|
||||
dummy.select()
|
||||
|
||||
@@ -94,7 +94,6 @@ export default {
|
||||
// Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
|
||||
plugins: [
|
||||
"~/plugins/v-tippy",
|
||||
"~/plugins/v-clipboard",
|
||||
"~/plugins/vuex-persist",
|
||||
"~/plugins/vue-rx",
|
||||
"~/plugins/vue-apollo",
|
||||
|
||||
11
package-lock.json
generated
11
package-lock.json
generated
@@ -34,7 +34,6 @@
|
||||
"socketio-wildcard": "^2.0.0",
|
||||
"splitpanes": "^2.3.8",
|
||||
"tern": "^0.24.3",
|
||||
"v-clipboard": "^2.2.3",
|
||||
"vue-apollo": "^3.0.7",
|
||||
"vue-cli-plugin-apollo": "^0.22.2",
|
||||
"vue-functional-data-merge": "^3.1.0",
|
||||
@@ -28823,11 +28822,6 @@
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/v-clipboard": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/v-clipboard/-/v-clipboard-2.2.3.tgz",
|
||||
"integrity": "sha512-Wg+ObZoYK6McHb5OOCFWvm0R7xHp0/p0G1ocx/8bO22jvA/yVY05rADbfiztwCokXBNfQuGv/XSd1ozcTFgekw=="
|
||||
},
|
||||
"node_modules/v8-compile-cache": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
|
||||
@@ -55448,11 +55442,6 @@
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||
},
|
||||
"v-clipboard": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/v-clipboard/-/v-clipboard-2.2.3.tgz",
|
||||
"integrity": "sha512-Wg+ObZoYK6McHb5OOCFWvm0R7xHp0/p0G1ocx/8bO22jvA/yVY05rADbfiztwCokXBNfQuGv/XSd1ozcTFgekw=="
|
||||
},
|
||||
"v8-compile-cache": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
"socketio-wildcard": "^2.0.0",
|
||||
"splitpanes": "^2.3.8",
|
||||
"tern": "^0.24.3",
|
||||
"v-clipboard": "^2.2.3",
|
||||
"vue-apollo": "^3.0.7",
|
||||
"vue-cli-plugin-apollo": "^0.22.2",
|
||||
"vue-functional-data-merge": "^3.1.0",
|
||||
|
||||
@@ -589,6 +589,7 @@ import { getCurrentStrategyID, sendNetworkRequest } from "~/helpers/network"
|
||||
import { getSettingSubject, useSetting } from "~/newstore/settings"
|
||||
import { addGraphqlHistoryEntry } from "~/newstore/history"
|
||||
import { logHoppRequestRunToAnalytics } from "~/helpers/fb/analytics"
|
||||
import { copyToClipboard } from "~/helpers/utils/clipboard"
|
||||
|
||||
export default defineComponent({
|
||||
components: { Splitpanes, Pane },
|
||||
@@ -878,7 +879,7 @@ export default defineComponent({
|
||||
setTimeout(() => (this.copyVariablesIcon = "content_copy"), 1000)
|
||||
},
|
||||
copyToClipboard(content) {
|
||||
this.$clipboard(content)
|
||||
copyToClipboard(content)
|
||||
this.$toast.success(this.$t("copied_to_clipboard"), {
|
||||
icon: "done",
|
||||
})
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
import Vue from "vue"
|
||||
import Clipboard from "v-clipboard"
|
||||
|
||||
Vue.use(Clipboard)
|
||||
Reference in New Issue
Block a user