Search code examples
codemirror

CodeMirror: external search dialog


I am building a small service based on CodeMirror where I would like to have the search box appear as a div rather than a popup as in the CodeMirror example. Further I would like to initiate the "search next" and "search previous" functions through clicks as well as via keyboard.

I am not sure how to do this, could somebody help me please?


Solution

  • You can define your own CodeMirror.prototype.openDialog method that shows the dialog the way you want (just conform to the interface). And you can run editor.execCommand("findNext") (or "findPrev") from a button's click handler to search next/previous.