🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more
Socket
Book a DemoInstallSign in
Socket

@tntd/codemirror

Package Overview
Dependencies
Maintainers
7
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tntd/codemirror

tntd codemirror

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
7
Created
Source

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

Keywords

tntd

FAQs

Package last updated on 14 Apr 2020

Did you know?

Socket

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.

Install

Related posts