atularen / ngx-monaco-editor

Monaco Editor component for Angular 2 and Above
https://www.npmjs.com/package/ngx-monaco-editor
MIT License
428 stars 155 forks source link

Insert the Value in the Current Cursor Position Using ngx-monaco-editor-v2 #271

Open Siva-Harish98 opened 7 months ago

Siva-Harish98 commented 7 months ago

Hi guys, I'm slightly stuck with a problem. I want to insert a value at the cursor position, but it's very difficult for me in ngx-monaco-editor-v2. I've searched a lot, but I haven't found any documentation regarding this in ngx-monaco-editor-v2. Can you pls help me to find the cursor Position and How to Insert the value

HTML <ngx-monaco-editor [options]="editorOptions" [(ngModel)]="code">

Ts file

import { Component } from '@angular/core';

@Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent { editorOptions = {theme: 'vs-dark', language: 'javascript'}; code: string= 'function x() {\nconsole.log("Hello world!");\n}'; }