5

テンプレートに TinyMCE が埋め込まれています。ここで、TinyMCE エディターのコンテンツ (実際にはテキストエリア) を値バインドしたいと考えています。

http://jsfiddle.net/cyclomarc/wtktK/10/を参照

テキストフィールドにテキストを入力すると、{{bodyText}} のテキストが更新されます。TinyMCE テキストエリアのテキストも更新したいと思います...

これを行う方法はありますか?

HTML:

<script type="text/x-handlebars">
    <h2>Tiny MCE</h2>
    {{outlet}}
</script>

<script type="text/x-handlebars" data-template-name="index">
        <form method="post" action="somepage">
            App.IndexController.bodyText value:</br>
            {{bodyText}}
            </br></br>

            Bound to Ember.TextField:<br>
            {{view Ember.TextField valueBinding='bodyText'}}

            </br></br>
            Bound to Ember.TextArea:</br>
            {{view Ember.TextArea valueBinding='bodyText'}}

        </form>
</script>

JS:

var App = Ember.Application.create({
  LOG_TRANSITIONS: true
});

App.Router.map(function () {});

App.IndexRoute = Ember.Route.extend({ });

App.IndexController = Ember.Controller.extend({
    bodyText: '...' 
});

App.IndexView = Ember.View.extend({
    didInsertElement: function(){
        tinymce.init({
            selector: "textarea"
        });
    }
});
4

1 に答える 1