fxmontigny / ng2-ace-editor

Ace editor integration with typescript for angular 4 - 5
MIT License
200 stars 93 forks source link

Cursor/ Mouse pointer doesn't seem to update at correct location in the editor #101

Open saurabhchavan opened 6 years ago

saurabhchavan commented 6 years ago

Issue: The edit happens at the incorrect location on the editor.

Package Version: Angular 6

ace-editor

 <ace-editor 
          id = "editor"
          #editor class="editor"
          [readOnly]="false"
          [mode]="'json'"
          [theme]="'monokai'"
          [autoUpdateContent]="false"
          (textChanged)="onChange($event)" 
          [options]="options"
          [(text)]="text"></ace-editor>
// editor
import 'brace';
import 'brace/theme/monokai';
import 'brace/mode/json';

  @ViewChild('editor') editor;
  @Input() text;

 options: any = {
    showPrintMargin: false,
    showInvisibles: true,
    highlightGutterLine: false,
    highlightActiveLine: false,
    fadeFoldWidgets: true,
    showLineNumbers: true,
    howGutter: true,
    fontSize: 16,
    wrap: false,
    mode: 'ace/mode/json'
};

  onChange(event) {
    this.text = event;
  }
itaimoorali commented 5 years ago

@saurabhchavan any Update on this. i am having the same issue. Do you have any workaround.??

saurabhchavan commented 5 years ago

No I couldn’t get it to work. So I switch to using monaco editor.

hunghoang94 commented 4 years ago

The solution is to add this CSS to your code. Because ng2-ace-editor only accept monospace font

.ace_line {
    span {
      font-family: monospace !important;
    }
  }
javadoffuad commented 4 years ago

::ng-deep { .ace_line, .ace_line span { font-family: monospace !important; } }