Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

codemirror search simulate CTRL+F keys with javascript

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

like image 257
neoDev Avatar asked Jan 01 '15 22:01

neoDev


1 Answers

You don't want to simulate the actual key press. Rather, simply run CodeMirror's find command using execCommand, as in http://jsfiddle.net/cb1fd72k/1/

like image 116
Marijn Avatar answered Oct 15 '22 13:10

Marijn