如何在TinyMCE Editor中将光标插入文本? [英] How to insert text in TinyMCE Editor where the cursor is?

查看:740
本文介绍了如何在TinyMCE Editor中将光标插入文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的项目中使用 angular2-tinymce 库.我已经成功地在模块中集成了 tinymce .但是我找不到任何方法可以从tinymce编辑器中的光标处插入文本.

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);
  }

我看到了以下链接: link1 link2 .但是我无法在 TinymceModule

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

如何在我的代码中将在tinymce编辑器中从光标插入的文本并入?

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

推荐答案

我可以使用以下方法在tinymce编辑器中从光标位置插入文本:

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

     this.tinyMce.editor.execCommand('mceInsertContent', false, 'text');

这篇关于如何在TinyMCE Editor中将光标插入文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆