-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
wontfixThis will not be worked onThis will not be worked on
Description
I am trying to use this plugin for my editor based project using ngx-monaco-editor, i want to grey out the blocked json/code with a color so that user can know they cant edit that particular block, need ideas and help, below is the sample code.
<ngx-monaco-editor class="textarea" [options]="Options" id="editor" (onInit)="EditorInit($event)" [(ngModel)]="Title"></ngx-monaco-editor>
DataEditorInit(monacoInstance: any): void {
const monacoModel = monacoInstance.getModel();
const jsonString = this.processedDataTitle;
const objectToFind = 'segments';
const offset = jsonString.indexOf(objectToFind);
if (offset != -1) {
const position = monacoModel.getPositionAt(offset);
const startLineNumber = position.lineNumber;
const segmentJsonString = jsonString.substring(offset);
const endLineNumber = this.getEndLineNumber(
startLineNumber,
segmentJsonString
);
const constrainedInstance = constrainedEditor.constrainedEditor(
window['monaco']
);
constrainedInstance.initializeIn(monacoInstance);
const restrictions = [
{
range: [startLineNumber, 1, endLineNumber, 1],
label: 'segments',
allowMultiline: false,
},
];
constrainedInstance.addRestrictionsTo(monacoModel, restrictions);
monacoModel.toggleHighlightOfEditableAreas();
}
}
Metadata
Metadata
Assignees
Labels
wontfixThis will not be worked onThis will not be worked on