You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment I am trying to add cmd + enter command with a leptos app that is using monaco. It is not clear how to do this using the current API. I found an example (below) that uses quite a bit of witch craft that I cannot follow.
The general way to incorporate keystrokes is by utilizing CodeEditorLink and having a closure that would do an action, i.e. getting the code from the TextModel and setting it in an emulator. Based on the code from the link:
Create a callback that uses the CodeEditorLink to access the Editor you're using, you'll access it via .with_editor.
You create your keystroke via KeyCode and KeyMod.
You create a reference to your editor(.as_ref()), and then you use that to store the command(.add_command()). add_command() takes three arguments which are the keybinding, the function, and the context.
And that should be it, I suggest that you look through the docs to get a better understanding of interfacing with Monaco.
Edit: I just realized that CodeEditorLink is part of interfacing with Yew, so I don't know how that works with Leptos. Hopefully with how I broke it down, you know where to go from here.
At the moment I am trying to add
cmd + enter
command with a leptos app that is using monaco. It is not clear how to do this using the current API. I found an example (below) that uses quite a bit of witch craft that I cannot follow.https://github.com/abesto/clox-rs/blob/8d6428da1f0a2253e37a003544bec1f86c544b49/web/src/main.rs#L177
The text was updated successfully, but these errors were encountered: