7

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

jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252
neoDev
  • 2,879
  • 3
  • 33
  • 66
  • 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 Jan 01 '15 at 22:59

1 Answers1

7

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/

Marijn
  • 8,691
  • 2
  • 34
  • 37
  • 1
    ok now I added also buttons for "findNext", "findPrev", but it does not work for "replace" and "replaceAll".. why? – neoDev Jan 07 '15 at 14:29