2017-03-01 37 views
0

我有這個令人討厭的事情,雖然不是一個攔截器,是非常煩人的。讓我解釋。打開後調整TinyMCE窗口

我有這樣的代碼MCE插件內:

var theWindow = editor.windowManager.open({ 
    html: '<iframe id="iframeID" src="iframeURL" frameborder="0"></iframe>', 
    buttons: [ 
    { 
     text: 'Cancel', 
     subtype: 'secondary' 

    }, 
    { 
     text: 'Submit', 
     onclick: 'submit', 
     subtype: 'primary mySubmitButton' 
    } 
    ], 
}); 

$('#iframeID').on('load', function(){ 
    selectedSnippets.on('change', function(e){ 
    theWindow.statusbar.$el.find('.mySubmitButton .mce-txt').text(text); 
    }); 
}); 

(我避免了插件聲明和代碼,將觸發簡潔的窗口開口)

好了,所以這個作品中,窗口打開,它在這個頁腳上有一個標題,一個頁腳和兩個按鈕。

我的問題現在是這樣的:我如何更新頁腳按鈕上的文字?我的意思是我可能只是用js來做。這樣的作品,但問題是按鈕定位absolute和計算上的第一渲染:

所以,我的問題是:如何地獄我重新呈現這些按鈕? TinyMCE的文檔並沒有真正的幫助(或者我可能不知道在哪裏尋找)。

並作爲一個子問題:如何禁用一鍵?

謝謝!

回答

0

我設法重新渲染分兩步按鈕的可能不那麼幹淨的方式:

// you will need to run this for each **updated** button 
theWindow.statusbar._items[0].$el.find('.mce-txt').text('my long value goes here'); 
theWindow.statusbar._items[0].updateLayoutRect(); 

// You will need to call this once 
theWindow.statusbar.reflow() 

我仍然不知道如何禁用/啓用按鈕雖然:)