Monday, 18 February 2019

ckeditor - get last cursor position and append html at that Angular 5

  1. i am using "ngx-ckeditor": "^0.4.0" in angular 5.
  2. here is my html code

    <ck-editor #ckeditor name="html_template" (click)="getCaretPos(ckeditor)" (change)="ckEditorChange(ckeditor)" [(ngModel)]="mailModel.html_template" [config]="ckEditorConfig">
    </ck-editor>
    
    
  3. here is my component code

    this.ckEditorConfig = {
        on: {
            instanceReady: function(e) {
                const pos = e.document.selection.getFirstPosition();
                var selection = e.editor.getSelection();
                var range = selection.getRanges()[0];
                var cursor_position = range.startOffset;
              }
        }
    };
    
    

with this code i am not able to get Cursor's last position & don't know how to append html in it?



from ckeditor - get last cursor position and append html at that Angular 5

No comments:

Post a Comment