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
diff --git a/gr-editor/codemirror-element.js b/gr-editor/codemirror-element.js
index 8ea2ead..94ee213 100644
--- a/gr-editor/codemirror-element.js
+++ b/gr-editor/codemirror-element.js
@@ -81,6 +81,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();
+ }
+ });
}
}