Monaco-editor: how can i always activate find-widget?

Created on 4 May 2018  路  5Comments  路  Source: microsoft/monaco-editor

monaco-editor version: 0.12.0
Browser: chrome
OS: ubuntu 18.04
when browser create monaco-editor object how can i activate find-widget always?

Most helpful comment

Yes, the first argument of trigger is the source. You can use api or any other string. We expose the source argument to be able to sometimes distinguish between keyboard and mouse.

i.e. editor.trigger('blabla', 'actions.find')

All 5 comments

thank you!

@alexandrudima @baekya884 Note: I might be doing something wrong, so correct me if i do so.
This doesn麓t seam to work on monaco version 0.15.5, or i was unable to make it work using trigger, but i was able to manually open it by calling the action directly: editor.getAction("actions.find").run()
Though i was unable to close it again.
(I used the dev version)
Content:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        html, body {
            overflow: hidden;
            margin: 0;
            background-color: #1e1e1e;
        }
        #container {
            height: 100vh;
            width: 100vw;
        }
    </style>
</head>
<body>
<div id="container"></div>
<script src="lib/vs/loader.js" type="application/javascript"></script>

<script type="application/javascript">
    require.config({paths: {'vs': 'lib/vs'}});
    require(['vs/editor/editor.main'], function () {

       editor =  monaco.editor.create(document.getElementById("container"), {
    value: "function hello() {\n\talert('Hello world!');\n}",
    language: "javascript"
});

    });
</script>
</body>
</html>

Result:
screenshot_91
Any idea what i might be doing wrong

Yes, the first argument of trigger is the source. You can use api or any other string. We expose the source argument to be able to sometimes distinguish between keyboard and mouse.

i.e. editor.trigger('blabla', 'actions.find')

@alexandrudima worked! Thanks for the very fast answer.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

inf9144 picture inf9144  路  3Comments

akosyakov picture akosyakov  路  3Comments

aarinsmith picture aarinsmith  路  3Comments

ststeiger picture ststeiger  路  3Comments

Kang-Jun-sik picture Kang-Jun-sik  路  3Comments