Skip to content

Commit

Permalink
chore(docs): Fix pressing / in an example editor starts a search
Browse files Browse the repository at this point in the history
  • Loading branch information
personalizedrefrigerator committed Nov 12, 2024
1 parent 50f710f commit ed628dd
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ const addCodeMirrorEditor = (
changes: { from: 0, insert: initialText },
});

// Overrides the Typedoc search shortcut. Because the upstream shortcut uses the "keypress" event,
// we override the same event:
editor.dom.addEventListener('keypress', (event) => {
if (event.key === '/') {
// Prevent other event listeners from handling the event.
event.stopPropagation();
}
});

return {
getText() {
return editor.state.doc.toString();
Expand Down

0 comments on commit ed628dd

Please sign in to comment.