最初のボタンの onclick 関数内でダイアログを閉じたいのですが、console.log を介して windowManager オブジェクトで見つけた close() 関数を実行しようとしましたが、機能しません。私がする時:
console.log(editor.windowManager);
次の出力が表示されます。
Object {windows: Array[1], open: function, alert: function, confirm: function, close: function}
次に、上記の出力に表示されている close 関数を次のように呼び出します
editor.windowManager.close();
そして、私は得る:
Uncaught TypeError: Cannot call method 'close' of undefined
ここに私のコードがあります
tinymce.PluginManager.add('jbimages', function (editor, url) {
function jbBox() {
editor.windowManager.open({
title: 'Upload an image',
file: url + '/dialog-v4.htm',
width: 350,
height: 135,
buttons: [{
text: 'Upload',
classes: 'widget btn primary first abs-layout-item',
disabled: false,
onclick: function(){
$('#mce_39-body iframe').contents().find('#upl').submit();
editor.windowManager.close();
}
}, {
text: 'Close',
onclick: 'close'
}]
})
}
});