codemirror搜索使用javascript模拟CTRL + F键(codemirror search simulate CTRL+F keys with javascript)

编程入门 行业动态 更新时间:2024-10-20 11:47:33
codemirror搜索使用javascript模拟CTRL + F键(codemirror search simulate CTRL+F keys with javascript)

我正在尝试打开codemirror搜索对话框(通常按CTRL + F激活) 按下按钮:

我试着用

window.find()

但它没有打开对话框,它只突出显示编辑器中的文字...

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

最满意答案

您不想模拟实际按键。 相反,只需使用execCommand运行CodeMirror的find命令,如http://jsfiddle.net/cb1fd72k/1/

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/

更多推荐

本文发布于:2023-08-07 19:48:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465573.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:CTRL   javascript   codemirror   keys   simulate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!