打开后Tweak TinyMCE Window

Tweak TinyMCE Window after opening

我有一个烦人的事情,虽然不是 blocker-blocker,但非常烦人。让我解释一下。

我在 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);
  });
});

(为简洁起见,我避免了插件声明和将触发 window 打开的代码)

好的,这样就可以了,window 打开了,它确实有一个标题、一个页脚和页脚上的两个按钮。

我现在的问题是:如何更新页脚按钮上的文本?我的意思是我 可以 简单地用 js 来做。这行得通,但问题是按钮定位 absolute 并在第一次渲染时计算:

所以,我的问题是:我 re-render 这些按钮到底是怎么弄的? TinyMCE 的文档并没有真正帮助(或者我可能不知道 what/where 去寻找)。

作为一个子问题:如何禁用一个按钮?

谢谢!

我设法以一种可能不太干净的方式分两步重新呈现按钮:

// 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()

我仍然不知道如何 disable/enable 按钮 :)