ids-editor
v0.0.28
Published
[![Npm package version](https://badgen.net/npm/v/ids-editor)](https://npmjs.com/package/ids-editor) [![Npm package total downloads](https://badgen.net/npm/dt/ids-editor)](https://npmjs.com/package/ids-editor)
Downloads
32
Readme
ids-editor
Install
npm install ids-editor
Modify "angular.json" file
{ "assets":[
...,
{ "glob": "**/*", "input": "node_modules/ids-editor/node_modules/monaco-editor", "output": "assets/monaco-editor" },
],
}
Modify "app.module.ts" file
import { IdsEditorModule } from 'ids-editor';
@NgModule({
declarations: [
...
],
imports: [
..,
IdsEditorModule
],
providers: [],
bootstrap: [...]
})
Setting IdsEditor
|Property |Type |Exaple |Description |
|---------------- |-------------------------------|----------------------------- |- |
|theme | string or ThemeProps |'vs-dark'
| theme name |
|language | string |'java'
| language used |
|content |string |'content class'
| content |
|glyphMargin |boolean |true
| |
|automaticLayout |boolean |true
| |
|wordWrapMinified |boolean |true
| |
|breakPoints |boolean |true
| breakpoints view |
|lineNumbers |boolean |true
| |
|minimap |boolean |true
| |
|actions |IdsEditorActionProps[] | [{id: "id", keys: [IdsEditorKeyMod.CtrlCmd, IdsEditorKeyCode.KEY_S], label: "Save", contextMenuGroupId:'navigator'}]
| actions|
|commands |IdsEditorCommandProps[] |[{id: "id1", keys: [IdsEditorKeyMod.CtrlCmd, IdsEditorKeyCode.KEY_7]}]
|commands|
|difference |boolean |true
|difference display|
|originalVersion |string |original content
|original content|
|suggestions.onlyImportedClasses |boolean |true
|Suggestions only imported class (JAVA)|
Example (JAVA)
component.html
<ids-editor #editor [config]="config"
(callCommand)="callCommandEditor($event)"
(callAction)="callAction($event)"
(javaClassNotFound)="javaClassNotFound($event)"
[javaMethodsNotFound]="javaMethodsNotFound"
(contentChange)="contentChange($event)"></ids-editor>
component.ts
import { IdsEditorComponent, IdsEditorConfig, IdsEditor_Language, IdsEditorKeyMod, IdsEditorKeyCode, IdsEditorMarkerSeverity, IdsEditorCallCommandResponse, IdsEditorAction } from 'ids-editor';
import { JAVA } from 'ids-editor/lib/language/java';
export class ExampleComponent {
@ViewChild('editor', { static: false }) idsEditor : IdsEditorComponent | undefined;
config : IdsEditorConfig = {
content: "HI",
language: {
name: IdsEditor_Language.JAVA,
classes: ["com.networkcontacts.it.TEST"],
methods: [
{
class: "com.networkcontacts.it.TEST",
fullName: "com.networkcontacts.it.TEST",
input: [],
jar: "com.networkcontacts.it.TEST",
method: "test()",
output: "",
throws: "",
type: ""
}
]
},
suggestions:{
onlyImportedClasses: true
},
theme: 'vs-dark',
actions: [
{id: "id", keys: [IdsEditorKeyMod.CtrlCmd, IdsEditorKeyCode.KEY_S], label: "Salva", contextMenuGroupId:'navigator'},
{id: "ida", keys: [IdsEditorKeyMod.CtrlCmd, IdsEditorKeyCode.KEY_D], label: "Elimina", contextMenuGroupId:'navigator'}
],
commands: [
{id: "id1", keys: [IdsEditorKeyMod.CtrlCmd, IdsEditorKeyCode.KEY_I]}
],
mouseWheelZoom: true,
glyphMargin: true,
breakPoints: true,
difference: true,
originalVersion: "TEST"
}
public callAction(event: any){
if(this.idsEditor){
this.idsEditor.setListError([
{line: 1, message: "asdasdasd", severity: IdsEditorMarkerSeverity.Error, nameclass: "myGlyphMarginClass"}
])
}
}
async callCommandEditor(callCommandProps : IdsEditorCallCommandResponse){
if(this.idsEditor){
// await this.idsEditor.callActionEditor(IdsEditorAction.Indent);
//-----------------------------------------------------------
//await this.idsEditor.callActionEditor(IdsEditorAction.Comment);
}
}
javaClassNotFound(event: {javaUtility: JAVA, nameClass: string}){
event.javaUtility.addClass(event.nameClass);
event.javaUtility.addMetohd({
class: event.nameClass,
fullName:event.nameClass,
input: [],
jar: event.nameClass,
method: "newMethod()",
output: "",
throws: "",
type: ""
});
}
javaMethodsNotFound(event: {javaUtility: JAVA, nameClass: string, parent: any}){
event.javaUtility.addMetohd({
class: event.nameClass,
fullName:event.nameClass,
input: [],
jar: event.nameClass,
method: "otherMethod()",
output: "",
throws: "",
type: ""
});
// If you want add list
event.javaUtility.addMetohds([{
class: event.nameClass,
fullName:event.nameClass,
input: [],
jar: event.nameClass,
method: "otherMethod()",
output: "",
throws: "",
type: ""
}]);
}
contentChange(value: string){
console.log(value);
}