Gathering detailed insights and metrics for @alilc/lowcode-plugin-base-monaco-editor
Gathering detailed insights and metrics for @alilc/lowcode-plugin-base-monaco-editor
Gathering detailed insights and metrics for @alilc/lowcode-plugin-base-monaco-editor
Gathering detailed insights and metrics for @alilc/lowcode-plugin-base-monaco-editor
An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系
npm install @alilc/lowcode-plugin-base-monaco-editor
Typescript
Module System
Node Version
NPM Version
TypeScript (82.17%)
JavaScript (11.89%)
SCSS (3.47%)
Less (1.39%)
HTML (0.81%)
Handlebars (0.21%)
Shell (0.04%)
CSS (0.01%)
Total Downloads
90,430
Last Day
96
Last Week
371
Last Month
1,540
Last Year
24,783
202 Stars
219 Commits
143 Forks
18 Watching
43 Branches
36 Contributors
Latest Version
1.1.2
Package Id
@alilc/lowcode-plugin-base-monaco-editor@1.1.2
Unpacked Size
646.62 kB
Size
180.32 kB
File Count
29
NPM Version
8.19.2
Node Version
16.18.0
Publised On
14 Apr 2023
Cumulative downloads
Total Downloads
Last day
152.6%
96
Compared to previous day
Last week
49.6%
371
Compared to previous week
Last month
15.8%
1,540
Compared to previous month
Last year
-40%
24,783
Compared to previous year
This is monaco-editor's react port for lowcode environments.
It removes those obstacles when using monaco-editor directly:
And it supports some of the monaco-editor typescript definitions without referring to monaco-editor directly.
BTW. Style is seperate from index.js. Use import '@alilc/lowcode-plugin-base-monaco-editor/lib/style';
for styling.
prop | description | type annotation |
---|---|---|
value | value, controlled | string |
defaultValue | defaultValue for creating model, uncontrolled | string |
language | language of the editor | string |
theme | theme of the editor, `"light" | "vs-dark"` |
options | Monaco editor options | Record<string, any> |
requireConfig | config passing to require, can be used to upgrade monaco-editor | Record<string, any> |
path | path of the current model, useful when creating a multi-model editor | string |
saveViewState | whether to save the models' view states between model changes or not | boolean |
className | className of wrapper | string |
width | width of wrapper | `number |
height | height of wrapper | `number |
enableOutline | whether to enable outline of wrapper or not | boolean |
style | style of wrapper | CSSProperties |
editorWillMount | callback after monaco's loaded and before editor's loaded | (monaco: IMonacoInstance) => void |
editorDidMount | callback after monaco's loaded and after editor's loaded | (monaco: IMonacoInstance, editor: IEditorInstance) => void |
1<SingleMonacoEditorComponent 2 value={val} 3 language="json" 4 onChange={(next) => { 5 setValue(next); 6 }} 7 supportFullScreen={true} 8/>
1<LowcodePluginBaseMonacoEditor.MonacoDiffEditor 2 original={JSON.stringify({a: 1}, null, 2)} 3 value={JSON.stringify({b: 2}, null, 2)} 4 height={100} 5 language="json" 6/>
1import React, { Component } from 'react';
2import ReactDOM from 'react-dom';
3import SingleMonacoEditorComponent from '@alilc/lowcode-plugin-base-monaco-editor';
4
5function App() {
6 const [files, setFiles] = React.useState({
7 'a.json': {
8 name: 'a.json',
9 language: 'json',
10 value: '{ "a": 1 }',
11 },
12 'b.js': {
13 name: 'b.js',
14 language: 'javascript',
15 value: 'var a = 1',
16 },
17 'c.sql': {
18 name: 'c.sql',
19 language: 'sql',
20 value: 'SELECT * from table where id = 1',
21 },
22 })
23 const [fileName, setFileName] = React.useState("a.json");
24 const file = files[fileName];
25
26 return (
27 <div>
28 {Object.keys(files).map(key => (
29 <button
30 key={key}
31 disabled={key === fileName}
32 onClick={() => {
33 setFileName(key)
34 }}
35 >
36 {key}
37 </button>
38 ))}
39 <SingleMonacoEditorComponent
40 height={40}
41 path={file.name}
42 language={file.language}
43 defaultValue={file.value}
44 saveViewState={true}
45 onChange={(next) => {
46 setFiles(v => ({
47 ...v,
48 [file.name]: {
49 ...v[file.name],
50 value: next,
51 },
52 }))
53 }}
54 />
55 </div>
56 );
57}
58
59ReactDOM.render(<App />, mountNode);
1import { controller } from '@alilc/lowcode-plugin-base-monaco-editor'; 2 3// configure Monaco to be singleton 4controller.updateMeta({ singleton: true }); 5 6// Get all metadata 7controller.getMeta(); 8 9// register a custom method 10controller.registerMethod('methodName', (a, b, c) => { }); 11 12// call custom methods 13const ret = controller.call('methodName', a, b, c);
This is forked from monaco-react. Thanks for suren-atoyan's effort for making monaco editor appoachable.
No vulnerabilities found.
No security vulnerabilities found.