0

I am trying to use angular2-tinymce library in my project. I have successfully integrated tinymce in my module. But i could not find any way to insert text from where the cursor is in the tinymce editor.

// in add-progress-note.module.ts file
@NgModule({
  declarations: [
    AddProgressNotePage,
  ],
  imports: [
    IonicPageModule.forChild(AddProgressNotePage),
    TinymceModule.withConfig({
      menubar: false,
      plugins: ['textcolor'],
      toolbar: 'forecolor',
      resize: false,
      statusbar: false
    })
  ]
})

// in add-progress-note.html file           
<ion-row class="note-editor" id="noteArea">
            <app-tinymce class="note-input-textarea" [(ngModel)]='noteText' (ngModelChange)="onChangeNote()"></app-tinymce>
</ion-row>

// in add-progress-note.ts file
  onChangeNote(): void {
    console.log(this.noteText);
  }

I have see these links: link1 and link2. But i could not write the callback in setup config of TinymceModule

How to incorporate text inserting from cursor in tinymce editor in my code?

Setu Kumar Basak
  • 11,460
  • 9
  • 53
  • 85
  • Are you trying to do this via a toolbar button? A menu? Something else? What would trigger this insertion? – Michael Fromin Feb 14 '18 at 05:10
  • I have a button in my page just below tinymce editor. And when i will click on the button, i will generate a text and i would like to append this text in the tinymce editor just where the cursor is. – Setu Kumar Basak Feb 14 '18 at 05:52

1 Answers1

0

I could insert text from cursor position in tinymce editor using below approach:

     this.tinyMce.editor.execCommand('mceInsertContent', false, 'text');
Ilan Schemoul
  • 1,461
  • 12
  • 17
Setu Kumar Basak
  • 11,460
  • 9
  • 53
  • 85