简体   繁体   English

TinyMCE Javascript所见即所得编辑器不适用于Ember js

[英]TinyMCE Javascript WYSIWYG editor not working with Ember js

I am trying to use TinyMCE with ember js. 我正在尝试将TinyMCE与ember js一起使用。 Code goes as follows - 代码如下-

<script>
        tinymce.init({selector:'textarea'});
</script>

And the textarea is inside the text/x-handlebars template as follows 而且textarea在text/x-handlebars模板中,如下所示

<script type="text/x-handlebars" data-template-name="course/discussion">
 <textarea>Your content here.</textarea>  
</script>

With the following setup, the TinyMCE is not working. 使用以下设置,TinyMCE无法正常工作。

BUT, if I place the <textarea> outside the text/x-handlebars template, it seems to be working fine. 但是,如果我将<textarea>放在text/x-handlebars模板之外,则似乎工作正常。

Any pointers on how do I make TinyMCE work when the <textarea> is inside the handlebars template <textarea>位于车把模板内时,有关如何使TinyMCE工作的任何指针

Add a view and use the didInsertElement hook to set up tinymce after the template is inserted into the DOM. 将模板插入DOM后,添加一个视图并使用didInsertElement钩子来设置tinymce。

App.CourseDiscussionView = Ember.View.extend({
  didInsertElement: function () {
    tinymce.init({selector:'textarea'});
  }
});

http://emberjs.com/api/classes/Ember.View.html#event_didInsertElement http://emberjs.com/api/classes/Ember.View.html#event_didInsertElement

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM