Dreamweaver DOM getCurrentLine()
我目前正在尝试创建一个小面板扩展,在 Sublime Text 2 代码编辑器上重新创建“小地图”功能,但适用于 Dreamweaver。我已成功创建视图,但我想单击小地图中的任意位置,当前页面将向下滚动到单击的当前行。 不幸的是,我只能找到 Dreamweaver DOM 的“getCurrentLines()”代码函数,它返回字符偏移量而不是行号。有谁知道如何从文档中返回当前行号?
我可以通过使用 theDOM.source.setCurrentLine(200); 硬编码一个值来向下滚动用户文档。代码,但它得到的数字让我很困惑!非常感谢任何帮助。
I'm currently trying to create a small panel extension that recreates the 'minimap' feature on the Sublime Text 2 code editor, but for Dreamweaver. I've successfully created the view but I want to click anywhere in the minimap and the current page will scroll down to the current line that was clicked.
Unfortunately, I can only find the 'getCurrentLines()' code function for the Dreamweaver DOM that returns character offsets rather that line numbers. Does anyone know how I can return the current line number from the document?
I can scroll down the user document by hard-coding a value in using the theDOM.source.setCurrentLine(200); code, but it's getting that number which is stumping me! Any help is much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
dom.getLineFromOffset() 可以采用偏移量之一并找到关联的行,但是,它应该只在文档窗口中工作,不确定这是否有助于在此“视图”中进行选择(我假设你的意思是面板)将其移动到正在编辑的文档中。
There is dom.getLineFromOffset() can take one of the offsets and find the associated line, however, that should work only in the document window, not sure if that will assist in taking a selection in this "view" (by which I assume you mean panel) to move that into the document being edited.