-
Sometimes I need to open the Monaco Editor for several files and search a specific word like I can easily save what the user searches at some cookie Then my question is this: is there an event that is triggered as soon as the search box appears so I can fill its input with the value I saved on my cookie? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@batata004 We don't have that in the API of the editor, but this being JS you could try something like the following (paste at https://microsoft.github.io/monaco-editor/playground.html and Run): const editor = monaco.editor.create(document.getElementById("container"), {
value: "function hello() {\n\talert('Hello world!');\n}",
language: "javascript"
});
editor.getContribution('editor.contrib.findController')._state.onFindReplaceStateChange((e) => {
// console.log(e);
if (e.isRevealed) {
console.log(`find replace is now visible`);
}
}) |
Beta Was this translation helpful? Give feedback.
-
@alexdima thank you for helping! And if you could take a look at #2410 (comment) because you can see the suggested solution in that issue worked but to me it looks like a hack. Do you know if is possible to trigger the find/replace action? |
Beta Was this translation helpful? Give feedback.
@batata004 We don't have that in the API of the editor, but this being JS you could try something like the following (paste at https://microsoft.github.io/monaco-editor/playground.html and Run):