嗨我想实现tinymce到角2组件为一个小论坛创建一个新的线程。 我希望将textarea(tinymce)的内容绑定到组件内部的变量上。到目前为止提交按钮的作品,但关键事件不。angular2 wysiwyg tinymce实现和双向绑定
export class ForumNewThreadComponent implements OnInit{
constructor(){}
ngOnInit():any {
tinymce.init(
{
selector: ".tinyMCE",
})
}
text:string;
submit(){
this.text = tinymce.activeEditor.getContent();
}
getTinymceContent(){
this.text = tinymce.activeEditor.getContent();
}
}
,并查看
<div class="thread-body">
{{getValue}}
<textarea class="tinyMCE" style="height:300px" (keyup)="getTinymceContent()">
</textarea>
<button class="btn btn-primary" (click)="submit()">Submit</button>
</div>
KEYUP不起作用,因为它在TinyMCE的正在发生,而不是在您的textarea –
我已经回答了这个在一个不同的问题HTTP: //thinkoverflow.com/a/39424976/235648 –