mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Make sure that paste does not get executed multiple times
This commit is contained in:
parent
f3d77412a6
commit
4bc21dfef5
|
@ -3,8 +3,8 @@
|
||||||
* defined on the component which uses this mixin
|
* defined on the component which uses this mixin
|
||||||
*/
|
*/
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import { debounce } from 'lodash';
|
||||||
|
|
||||||
// export const copyPaste = {
|
|
||||||
export const copyPaste = Vue.extend({
|
export const copyPaste = Vue.extend({
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
@ -92,7 +92,7 @@ export const copyPaste = Vue.extend({
|
||||||
|
|
||||||
// Set clipboard event listeners on the document.
|
// Set clipboard event listeners on the document.
|
||||||
['paste'].forEach((event) => {
|
['paste'].forEach((event) => {
|
||||||
document.addEventListener(event, (e) => {
|
document.addEventListener(event, debounce((e) => {
|
||||||
// Check if the event got emitted from a message box or from something
|
// Check if the event got emitted from a message box or from something
|
||||||
// else which should ignore the copy/paste
|
// else which should ignore the copy/paste
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -118,7 +118,7 @@ export const copyPaste = Vue.extend({
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}, 1000, { leading: true }));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Reference in a new issue