我已經使用了tinymce很長一段時間了。並感謝http://github.com/spohlenz/tinymce-rails 但現在我必須包括在應用程序tinymce根據backbone-on-rails
我已經按照所有的軌道應用程序的說明。
試圖&之前,包括TinyMCE的骨幹文件後的application.js
我的骨幹模板將tinymce集成到rails + backbone中
<textarea class="tinymce" id="article_body" rows='40' cols='120' >
<%= @article.get('body') %>
</textarea>
但TinyMCE的controlls無法初始化。
你能幫我嗎?
更新1
我試圖在模板& this INITING TinyMCE的:在edit.jst.eco
<textarea class="tinymce" id="article_body<%= @article.get('id') %>" rows='40' cols='120' >
<%= @article.get('body') %>
</textarea>
<% tinyMCE.execCommand "mceAddControl", true, "article_body"[email protected]('id')%>
控制
Ø 版本texterea只出現後手動刷新(F5)
更新2
我已經嘗試添加的execCommand方法的視圖我感興趣的顯示TinyMCE的的呈現方法,包括:用更新1
更新3
試圖渲染後TinyMCE的結合相比
class Notes.Views.ArticleEdit
render: ->
$(@el).html(@template(article: @model))
tinyMCE.execCommand "mceAddControl", false, "article_body"[email protected]('id')
this
沒有變更。使用方法2:
1)
class Notes.Views.ArticleEdit
render: ->
$(@el).html(@template(article: @model))
setTimeout (->
tinyMCE.execCommand "mceAddControl", true, "article_body" + @model.get("id")
), 100
沒有變化。刷新TinyMCE的顯示
2)http://fahad19.tumblr.com/post/28158699664/afterrender-callback-in-backbone-js-views
class Notes.Views.ArticleEdit extends Backbone.View
initialize:()->
_.bindAll this, "render", "afterRender"
_this = this
@render = _.wrap(@render, (render) ->
render()
_this.afterRender()
_this
)
@model.on('change',@render,this)
@model.on('destroy',@remove,this)
afterRender: ->
console.log tinyMCE
tinyMCE.execCommand "mceAddControl", true, "article_body" + @model.get("id")
後才雖然我得到一個控制檯輸出(適當TinyMCE的對象)我不明白的TinyMCE :(
更新4
這是項目在github
更新5
我被誤認爲 - 項目只出現在路由器中的DOM中。所以我不得不編輯Notes.Routers.Articles#編輯操作
想這樣做...更新1&2 ...沒有成功 – Elmor 2013-03-06 07:42:38