
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@tntd/codemirror
Advanced tools
$ npm install @tntd/codemirror --save
import CodeMirror from "@tntd/codemirror";
// 导入对应的主题和mode文件
import 'codemirror/theme/3024-day.css';
import 'codemirror/mode/javascript/javascript.js';
<CodeMirror
mode='javascript'
theme='night'
value="789"
onChange={(value) => {
console.log(value)
}}
lineNumbers={true}
placeholder="请输入你的内容"
/>
| 参数 | 说明 | 类型 | 默认值 | 是否必须 |
|---|---|---|---|---|
| mode | 当前语言模式 | string | 无 | 否 |
| theme | 主题 | String,预置了day、night | day | 否 |
| value | 内容 | string | 无 | 否 |
| autofocus | 自动聚焦 | boolean | true | 否 |
| tabSize | 缩进 | int | 4 | 否 |
| height | 编辑器高度 | int | 300 | 否 |
| placeholder | 内容 | string | 请输入... | 否 |
| readOnly | 是否只读 | boolean | false | 否 |
| lineNumbers | 是否显示行数字 | boolean | true | 否 |
| firstLineNumber | 是否显示行数字 | int | 1 | 否 |
| indentWithTabs | - | boolean | true | 否 |
| smartIndent | - | boolean | true | 否 |
| 参数 | 说明 | 类型 | 默认值 | 是否必须 |
|---|---|---|---|---|
| onChange | 内容变化时的回调 | function(text) | 否 | |
| onBlur | 时区焦点时的回调 | function | 否 | |
| onScroll | 滚动回调 | function | 否 | |
| onRefresh | 刷新回调 | function | 否 | |
| onKeydown | 按键回调 | function | 否 | |
| onKeypress | 按键回调 | function | 否 | |
| onKeyup | 按键回调 | function | 否 | |
| onCut | 剪切回调 | function | 否 | |
| onCopy | 复制回调 | function | 否 | |
| onPaste | 粘贴回调 | function | 否 | |
| onDblClick | 双击回调 | function | 否 |
FAQs
tntd codemirror
We found that @tntd/codemirror demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.