Fix issue when pasting contents into textbox
There is an issue where you paste and immediately press
ctrl+s/cmd+s after, it would trigger the web browsers file
browser rather then gr-editor-view intercepting ctrl+s/cmd+s.
We fix this by setting stopPropagation() if ctrl+v/cmd+v is set.
Change-Id: I5b5ad0137dcc83277e4b2077510e1ede83c6c16d
diff --git a/web/element/codemirror-element.ts b/web/element/codemirror-element.ts
index 8b036fa..ee7b9bc 100644
--- a/web/element/codemirror-element.ts
+++ b/web/element/codemirror-element.ts
@@ -138,6 +138,14 @@
if (!e.metaKey && !e.ctrlKey) {
e.stopPropagation();
}
+
+ // There is an issue where you paste and immediately
+ // press ctrl+s/cmd+s after, it would trigger the
+ // web browsers file browser rather then gr-editor-view
+ // intercepting ctrl+s/cmd+s.
+ if ((e.metaKey || e.ctrlKey) && e.key == 'v') {
+ e.stopPropagation();
+ }
},
}),
],