2017-03-01 59 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() 

我仍然不知道如何禁用/启用按钮虽然:)