CodeMirror。禁用垂直滚动条 [英] CodeMirror . Disabling Vertical scroll bar

查看:665
本文介绍了CodeMirror。禁用垂直滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在使用CodeMirror在浏览器的文本区域中编辑CODE。如果我有20行以上的代码,则它将在右侧添加垂直滚动条。但是我不需要这个滚动条。相反,我需要编辑器的大小垂直增加。

I am currently using CodeMirror to edit CODE in text area in browser. If i have more than 20 lines of code, it is adding a vertical scroll bar to right. But i do not need this scroll bar. Instead i need the editor size to grow vertically.

任何人都可以帮忙吗?

推荐答案

在CodeMirror 3中,有一个选项可以禁用滚动条: scrollbarStyle: null

In CodeMirror 3, there is an option to disable the scrollbars : scrollbarStyle: "null"

来自文档:


scrollbarStyle:字符串

scrollbarStyle: string

选择滚动条实现。默认值为本地,显示本地滚动条。核心库还提供了 null标记。样式,它完全隐藏了滚动条。附加组件可以实现其他滚动条模型。

Chooses a scrollbar implementation. The default is "native", showing native scrollbars. The core library also provides the "null" style, which completely hides the scrollbars. Addons can implement additional scrollbar models.

将其与以下内容组合:

  • automatic height: height: auto & viewportMargin: Infinity (Example: http://codemirror.net/demo/resize.html)
  • wrapping lines: lineWrapping: true

然后控制父div的高度/宽度效果很好

And then controlling the height/width of the parent div works well

这篇关于CodeMirror。禁用垂直滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆