I'm trying to open the codemirror search dialog (normally activated by pressing CTRL+F)
by pressing a button:
I tried to use
window.find()
but it does not open the dialog, it only highlights the text in the editor...
DEMO
I'm trying to open the codemirror search dialog (normally activated by pressing CTRL+F)
by pressing a button:
I tried to use
window.find()
but it does not open the dialog, it only highlights the text in the editor...
DEMO
Share Improve this question edited Jun 2, 2015 at 9:30 jezrael 864k102 gold badges1.4k silver badges1.3k bronze badges asked Jan 1, 2015 at 22:38 neoDevneoDev 3,0393 gold badges38 silver badges67 bronze badges 1- using window.find will poke the view html, not the model text content, which is only exposed via the API, so you need to use the codemirror API. there are also search plugins to peruse/modify. it's also under [F3]... – dandavis Commented Jan 1, 2015 at 22:59
1 Answer
Reset to default 7You don't want to simulate the actual key press. Rather, simply run CodeMirror's find mand using execCommand
, as in http://jsfiddle/cb1fd72k/1/