Hi,
In my application, I have embedded a codemirror-editor into the webpage. However, when I am searching a string/word in the codemirror editor by browser’s Ctrl+F, every time I have to manually scroll upto the position where it is found and highlighted.
How can I implement the desired functionality in codemirror-editor ? Do I need to add any addon like search/jump-to-line.js as I was reading here http://codemirror.net/doc/manual.html#addon_search or need to use the following bit of code :
cm.scrollIntoView(what: {line, ch}|{left, top, right, bottom}|{from, to}|null, ?margin: number) ?
In either case, please let me know how to use them. My code is below where mydiv is a div area, inside which I am trying to create two codemirror-editors in two tabs .
var editor1 = {
id: “editor1”,
view: “codemirror-editor”,
mode: “javascript”,
value: “”
};
var editor2 = {
id: “editor2”,
view: “codemirror-editor”,
mode: “javascript”,
value: “”,
autoheight: true
};
var ed1 = {id:“editor1”, value: “Editor-I”};
var ed2 = {id:“editor2”, value:“Editor-II”};
var op = [ed1, ed2];
var views = {
animate: false,
cells: [
editor1, editor2
]
}
var editors = {
container: "mydiv",
rows: [
{view: "tabbar",
id: "tabview",
options: op,
multiview:{ keepViews:true } // true
},
views,
{height: 300},
]
};