在 jquery.ui.dialog 中使用 codemirror 失去加载焦点
我尝试在 jquery ui 对话框中使用 codemirror 。
在这里你可以在 jsfiddle 中看到结果。 http://jsfiddle.net/HtntY/
问题是 codemirror 中的内容在首次加载时不会出现。它仅在您将焦点置于编辑器上并输入某些内容后才会出现,然后预加载的内容就会出现。
这可以以某种方式解决吗?我尝试使用刷新()函数来做到这一点,但没有成功。
谢谢你的短暂时间。
i try to use codemirror in a jquery ui dialog.
here you can see the result in jsfiddle.
http://jsfiddle.net/HtntY/
the problem is that the content in codemirror does not appear on first load. it only appears after you set focus on the editor and than type something, after that the preloaded content appears.
can this be fixed somehow. i tried to do it with the refresh() function without success.
thanks for you short time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来 jQuery UI 在 opener 运行时实际上并没有取消隐藏 DIV。将
refresh
调用设置为超时(如 http://jsfiddle.net/NP9SL/< /a> )似乎可以解决问题。Looks like jQuery UI hasn't actually unhid the DIV when the opener runs. Putting a
refresh
call in a timeout (as in http://jsfiddle.net/NP9SL/ ) seems to do the trick.我遇到了同样的问题,并最终在焦点事件之外运行 editor.refresh() ,FWIW。我想我应该提到另一个有点相关的问题。如果您尝试利用 JQueryUI 模式对话框内的 CodeMirror 对话框/搜索功能,集成搜索对话框将无法获得焦点,并且您无法在其中键入内容。有趣的是,我可以将文本粘贴到搜索字段中,但无法输入。除了将 modal 设置为 false 之外,尚未找到解决此问题的方法。
I ran into the same problem and wound up running the editor.refresh() off the focus event, FWIW. I thought I'd mention another, somewhat related problem. If you try to take advantage of the CodeMirror dialog/search functionality inside of JQueryUI modal dialog, the integrated search dialog fails to get focus and you can't type into it. Interestingly I can paste text into the search field, but I cant type. Have yet to find a way around this other than setting modal to false.