From 7ac7ec40579fdd02aac2a00a3aefb7bbad6bfe48 Mon Sep 17 00:00:00 2001 From: sisou Date: Fri, 29 May 2020 12:37:55 +0200 Subject: [PATCH] Add paste event to AddressInput to intercept request links --- src/components/AddressInput.vue | 4 ++++ src/stories/index.stories.js | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/AddressInput.vue b/src/components/AddressInput.vue index a64e5341..9aa9c872 100644 --- a/src/components/AddressInput.vue +++ b/src/components/AddressInput.vue @@ -170,6 +170,10 @@ export default class AddressInput extends Vue { } private _onPaste(e: ClipboardEvent) { + const clipboardData = e.clipboardData; + const pastedData = clipboardData ? clipboardData.getData('text/plain') : ''; + this.$emit('paste', e, pastedData); + inputFormatOnPaste(e, this.$refs.textarea, AddressInput._parse, AddressInput._format, this._afterChange); } diff --git a/src/stories/index.stories.js b/src/stories/index.stories.js index 1f08eab8..d593f0d9 100644 --- a/src/stories/index.stories.js +++ b/src/stories/index.stories.js @@ -482,8 +482,12 @@ storiesOf('Components', module) lastValidAddress: null, }; }, + methods: { + input: action('input'), + paste: action('paste'), + }, template: `
- +
Current address: {{ address }}
valid?: {{ address === lastValidAddress }}
`,