(function () { tinymce.create('tinymce.plugins.Codoc', { init: function (ed, url) { ed.addButton('codoc', { title: 'codocの記事一覧', onclick: function () { tb_show('codocの記事一覧:', 'admin-ajax.php?action=codoc_shortcodes&height=600&width=600' + '&_wpnonce=' + CODOCEDITOR.nonce); jQuery('#TB_window').width(600); jQuery('#TB_window').addClass('codocTB'); } }); }, createControl: function (n, cm) { return null; }, getInfo: function () { return { longname: 'codoc Shortcodes', author: 'codoc.jp', authorurl: 'codoc.jp', infourl: '', version: '1.0' }; } }); tinymce.PluginManager.add('codoc', tinymce.plugins.Codoc); jQuery(document).on('click', '.return_codoc_shortcode', function () { var id = jQuery(this).data('id'); tinyMCE.activeEditor.execCommand('mceInsertContent', 0, '[codoc id="' + id + '"]'); tb_remove(); }); jQuery(document).on('click', '.submit-codoc-form', function () { // todo //alert(CODOCEDITOR.nonce) var url = 'admin-ajax.php?action=codoc_shortcodes&height=600&width=600&usercode=' + jQuery('#codoc-usercode')[0].value + '&entrycode=' + jQuery('#codoc-entrycode')[0].value + '&_wpnonce=' + CODOCEDITOR.nonce; tb_show('codocの記事一覧:',url); jQuery('#TB_window').addClass('codocTB'); }); })();