繁体   English   中英

如何获得ACE编辑器文档的总高度?

[英]How to get the total height of ACE Editor documents?

我在互联网上搜索后发现:

editor.getSession().getDocument().getLength() * editor.renderer.lineHeight + editor.renderer.scrollBar.getWidth()

但这是假设没有换行。 如果我设置了editor.getSession().setUseWrapMode(true); 给出错误的高度,它将不起作用。

如何获得总高度?

使用session.getScreenLength() * editor.renderer.lineHeighteditor.renderer.layerConfig.maxHeight参见https://github.com/ajaxorg/ace/blob/v1.2.5/lib/ace/virtual_renderer.js#L966

我有一个棘手的解决方案,现在可以使用。

editor.getSession().documentToScreenPosition(editor.getSession().getDocument().getLength(), 0).row * editor.renderer.lineHeight + editor.renderer.scrollBar.getWidth()

很浪费

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM