Monaco-editor: Open search panel programmatically

Created on 6 Aug 2017  路  5Comments  路  Source: microsoft/monaco-editor

When you do cmd+f in the Monaco Editor, you get the find/search box appear.

Is there a way to have this open when the editor loads, with pre-populated text?

monaco-editor version: 0.9.0
Browser: chrome
OS: macOS
Steps or JS usage snippet reproducing the issue:

Most helpful comment

You can run editor.getAction('actions.find').run().

All 5 comments

You can run editor.getAction('actions.find').run().

Is it at all possible to prepopulate the search box with arbitrary strings, like @owennicol asks? The only thing I've managed to do so far with the function you mentioned, @rebornix, is to search for the text that is currently selected.

@owennicol I already added an answer to your question on SO:
https://stackoverflow.com/a/51291297/596082

how to close the search panel programmatically?

@ijse I found the close event ID is closeFindWidget in this useful snippets. https://github.com/Microsoft/monaco-editor/issues/823#issuecomment-470754000

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akosyakov picture akosyakov  路  3Comments

Spongman picture Spongman  路  3Comments

galyech picture galyech  路  3Comments

zeegin picture zeegin  路  3Comments

inf9144 picture inf9144  路  3Comments