代码的重要部分:
javascript tinymce插件:
init : function(ed, url) {
ed.addCommand('addVocabularyLinkCallout', function() {
ed.windowManager.open({
file : ajaxurl + '?action=addvocabularylinkbutton_function',
width : 350 + parseInt(ed.getLang('mytest.delta_width', 0)),
height : 250 + parseInt(ed.getLang('mytest.delta_height', 0)),
inline : 1
}, {
plugin_url : url
});
});
ed.addButton('addvocabularylink', {
title : 'Dodaj link do słowniczka',
cmd : 'addVocabularyLinkCallout',
image : url+'/../img/tinymce/insertpopup.png'
});
},
wordpress ajax 支持,仅适用于登录用户:
add_action('wp_ajax_addvocabularylinkbutton_function', 'addvocabularylinkbutton_function_callback');
function addvocabularylinkbutton_function_callback() {?>
<!DOCTYPE html>
<head>
<title>Create a Single Link - Button</title>
</head>
<body>
<h2>Test</h2>
</html>
<?php }; ?>
窗口本身不做任何事情并不重要,困扰我的是弹出窗口代码末尾的“0”:
<!DOCTYPE html>
<head>
<title>Create a Single Link - Button</title>
</head>
<body>
<h2>Test</h2>
</html>
0
如何摆脱它?