Stop propagation for all keys but exempt the save button This fixes an issue where if using contenteditable (default on mobile) and you typed "/", it would get intercepted within the app. Change-Id: I3bdf83bd64595c6238bb46736104fd0e668100c0 (cherry picked from commit 6a27089c51237743a8e7cae03837f921b0028b3b)
diff --git a/gr-editor/codemirror-element.js b/gr-editor/codemirror-element.js index ff6785d..c49d6a1 100644 --- a/gr-editor/codemirror-element.js +++ b/gr-editor/codemirror-element.js
@@ -80,6 +80,13 @@ new CustomEvent('content-change', {detail: {value: e.getValue()}}) ); }); + this._nativeMirror.getInputField().addEventListener('keydown', e => { + // Exempt the ctrl/command+s key from preventing events from propagating + // through the app. This is because we use it to save changes. + if (!e.metaKey && !e.ctrlKey) { + e.stopPropagation(); + } + }); } }