
Security News
The Nightmare Before Deployment
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.
@tntx/custom-syntax-editor
Advanced tools
React自定义语法编辑器
安装
npm install @tntx/custom-syntax-editor
使用
import CustomEditor from "@tntx/custom-syntax-editor";
const keywords = [
// groovy 关键词
"as", "catch", "def", "enum", "for", "import", "new", "super", "throws", "while",
"assert", "class", "default", "extends", "goto", "in", "null", "switch", "trait", "break",
"const", "do", "false", "if", "instanceof", "package", "this", "true", "case", "continue", "else",
"finally", "implements", "interface", "return", "throw", "try",
// java 关键词
"abstract", "transient", "int", "strictfp", "synchronized", "boolean", "char", "do",
"final", "private", "short", "void", "double", "long", "protected", "static", "volatile",
"byte", "float", "native", "public",
// JDK 常用类
"System", "Runtime", "String", "StringBuffer", "StringBuilder", "Date", "DateFormat",
"SimpleDateFormat", "Calendar", "GregorianGalendar", "Math", "Integer", "Double", "Float",
"Boolean", "List", "HashMap", "Map", "ArrayList", "Arrays", "Random", "Iterator"
];
const Demo = props => {
const getCode = (code) => {
console.log(code);
};
return (
<CustomEditor
defaultCode="" // 默认""
readOnly={false} // 默认false
height={400} // 默认300
theme="night" // 默认day
activeLine={true} // 默认true
fold={true} // 默认true
keywords={keywords} // 默认[]
onChange={getCode}
/>
)
};
ReactDOM.render(
<Demo />,
document.getElementById('root')
);

| 参数 | 类型 | 默认值 | 是否必填 | 说明 |
|---|---|---|---|---|
| defaultCode | string | "" | 非必填 | 初始化赋值 |
| readOnly | boolean | false | 非必填 | 设置只读 |
| height | number | 300 | 非必填 | 编辑器高度 |
| theme | string | "day" | 非必填 | 主题:"day"和"night" |
| activeLine | boolean | true | 非必填 | 当前行选中标识 |
| indentUnit | number | 4 | 非必填 | tab按几个空格缩进 |
| fold | boolean | true | 非必填 | 代码折叠 |
| keywords | array | [] | 非必填 | 自定义提示关键词 |
| onChange | function | 无 | 非必填 | 返回code |
| Ctrl+F | 键盘事件 | - | 内置 | 自动格式化代码 |
FAQs
react自定义语法编辑器
The npm package @tntx/custom-syntax-editor receives a total of 5 weekly downloads. As such, @tntx/custom-syntax-editor popularity was classified as not popular.
We found that @tntx/custom-syntax-editor 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
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.

Research
/Security News
Impostor NuGet package Tracer.Fody.NLog typosquats Tracer.Fody and its author, using homoglyph tricks, and exfiltrates Stratis wallet JSON/passwords to a Russian IP address.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.