0.0.5 • Published 4 years ago

@tntd/codemirror v0.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

tntd codemirror组件

安装

$ 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="请输入你的内容"
/>

API

参数说明类型默认值是否必须
mode当前语言模式string
theme主题String,预置了day、nightday
value内容string
autofocus自动聚焦booleantrue
tabSize缩进int4
height编辑器高度int300
placeholder内容string请输入...
readOnly是否只读booleanfalse
lineNumbers是否显示行数字booleantrue
firstLineNumber是否显示行数字int1
indentWithTabs-booleantrue
smartIndent-booleantrue

回调事件

参数说明类型默认值是否必须
onChange内容变化时的回调function(text)
onBlur时区焦点时的回调function
onScroll滚动回调function
onRefresh刷新回调function
onKeydown按键回调function
onKeypress按键回调function
onKeyup按键回调function
onCut剪切回调function
onCopy复制回调function
onPaste粘贴回调function
onDblClick双击回调function
0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago