私の目標は、開いたダイアログボックスのボディ幅で使用するカスタムコントロールを作成することです。editor.windowManager.open
TinyMCEがwindowManagerのカスタムコントロールを追加しました
githubの標準コントロールソースクラスが見つかりましたが、プラグインを使用して新しいコントロールを追加する方法が見つかりません。 https://github.com/tinymce/tinymce/tree/master/js/tinymce/classes/ui
検索の時間が経っても、ドキュメント、チュートリアル、またはスタックオーバーフローの応答が見つかりませんでした。私はプラグインにコントロール宣言を含めようとしましたが、ReferenceError: define is not defined
があります。
tinymce.PluginManager.add('my_plugin',function(editor,url){
// My custom control declaration following standard control found in source file
define("tinymce/ui/MyControl", [ "tinymce/ui/Widget" ],
function(Widget) {
"use strict";
return Widget.extend({
/**
* Renders the control as a HTML string.
*/
renderHtml: function() {
return '<div class="my-control">'+ this.state.get('text') +'</div>';
}
});
});
// Toolbar button to open the dialog
editor.addButton('my_plugin',{
title: 'My Plugin button',
text: 'My Plugin button',
onclick: function(){
// Dialog declaration
editor.windowManager.open({
title: 'My dialog',
body: [
{ type: 'textbox', name: 'textbox', label: 'My textbox' },
{ type: 'mycontrol', name: 'mycontrol', label: 'My Control' },
],
onsubmit: function(e){
editor.insertContent(e.data.textbox);
}
});
},
});
});
// Init tinyMCE
tinymce.init({
selector: '#mytextarea',
plugins: 'my_plugin',
toolbar: 'my_plugin'
});
カスタムコントロールを追加することは可能ですが、それを実現する方法はありますか?
あなたの助けを
おかげで、私は長い間、あまりにもこれで苦労してきた