私自身のメニューを追加しようとしていて、間違ったことをしているに違いありません。ここで私が持っているもので、これまでにいくつかのサンプルコードからシェル非常に簡単である:TinyMCEメニューの追加問題(プラグイン付き)
tinymce.html - ページ私はテキストエリアと初期化コードをホスティング:あなたはプラグイン」を見ることができます
<!-- /TinyMCE -->
<script type="text/javascript">
tinyMCE.init({
mode: "textareas",
skin: "o2k7",
theme: "advanced",
plugins: "mymenu,fullpage,safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
theme_advanced_buttons1: "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
toolbar: "mymenu",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_resizing: false,
extended_valid_elements: "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
});
</script>
<!-- /TinyMCE -->
<body>
<form method="post">
<textarea name="tinyMceEditor" cols="1" rows="1" style="width:100%; height: 100%"></textarea>
</form>
</body>
は、 mymenu 'とツールバー' mymenu 'はTinyMCEの初期化中です。
プラグインの場合は、/ Plugins/mymenu /ディレクトリのeditor_plugin.jsの規則に従います。ファイルにエラーが発生した場合、警告が表示されるため、ロード中です。
editor_plugin.js:
(function() {
tinymce.create('tinymce.plugins.mymenu', {
init: function (editor, url) {
editor.addButton('mymenu', {
type: 'menubutton',
text: 'My Menu',
icon: false,
menu: [{
text: 'Data Loop',
onclick: function(){
editor.insertContent('{DataLoop}');
}
}, {
text: 'Collector Loop',
onclick: function(){
editor.insertContent('{CollectorLoop}');
}
}]
});
}
});
// Register plugin
tinymce.PluginManager.add('mymenu', tinymce.plugins.PageBreakPlugin);
})();
私はすべてが正しい持っているようですが、私には見えます。ただし、メニューは表示されません。 initコードにbuttons1-4と表示されている4つのツールバーボタン。
編集:私はシンプルにテーマを変更し、すべての先進的なボタンを削除しようとしたし、かなりの数の他のオプションをしています。ここ:(
私はこのフィドルを使ってHTMLファイルのinit部分に直接入りますが、まだメニューは表示されません:( – Andrew
できますか?あなたがやっていることのTinyMCEフィドル? –
それは事です...私はこのようなCodePenでそれをやっても問題はありません:http://codepen.io/bdogi/pen/KNRaVm。私はHTMLファイルでこれを行うと、空白になっているが大きなテキストエリアが表示されます。メニューはありません。 – Andrew