Php WordPress Ajax TinyMCE下拉列表不工作
经过很多努力,我让Tinymce在WordPress中使用一个名为Viajax的文件。但是,下拉菜单将不起作用 这是我的JS代码,它导致tinymce捕获我的文本字段。它工作得很好 所有下拉列表都不起作用。颜色选择器、格式、视图等下拉菜单将不会下拉。所以这是我目前的问题 这是我的加载tinymce代码:Php WordPress Ajax TinyMCE下拉列表不工作,php,jquery,ajax,wordpress,tinymce-4,Php,Jquery,Ajax,Wordpress,Tinymce 4,经过很多努力,我让Tinymce在WordPress中使用一个名为Viajax的文件。但是,下拉菜单将不起作用 这是我的JS代码,它导致tinymce捕获我的文本字段。它工作得很好 所有下拉列表都不起作用。颜色选择器、格式、视图等下拉菜单将不会下拉。所以这是我目前的问题 这是我的加载tinymce代码: wp_enqueue_script( 'tinymce_js', includes_url( 'js/tinymce/' ) . 'wp-tinymce.php', array( 'jquery
wp_enqueue_script( 'tinymce_js', includes_url( 'js/tinymce/' ) . 'wp-tinymce.php', array( 'jquery' ), false, true );
这是我的JS代码
`jQuery( document ).ready(function() {
textareaId='c_tfield1';
tinymce.init({
mode : "specific_textareas",
content_css : "PLUGINS_URL/cm-core/both-ends/css/tinymce.css",
elements : 'pre-details',
editor_selector : "tinymce",
skin: "lightgray",
statusbar : false,
plugins: "textcolor colorpicker",
textcolor_cols: "5",
browser_spellcheck: true,
toolbar: [
"bold italic | alignleft aligncenter alignright | bullist numlist outdent indent | undo redo | forecolor backcolor"
],
setup: function(editor) {
editor.on('blur', function(e) {
jQuery('#c_tfield1').html(tinymce.get('c_tfield1').getContent());
jQuery("#c_tfield1").trigger('focusout');
});
},
style_formats: [
{ title: 'Bold text', inline: 'strong' },
{ title: 'Red text', inline: 'span', styles: { color: '#ff0000' } },
{ title: 'Red header', block: 'h1', styles: { color: '#ff0000' } },
{ title: 'Badge', inline: 'span', styles: { display: 'inline-block', border: '1px solid #2276d2', 'border-radius': '5px', padding: '2px 5px', margin: '0 2px', color: '#2276d2' } },
{ title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
],
formats: {
alignleft: { selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'left' },
aligncenter: { selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'center' },
alignright: { selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'right' },
alignfull: { selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'full' },
bold: { inline: 'span', 'classes': 'bold' },
italic: { inline: 'span', 'classes': 'italic' },
underline: { inline: 'span', 'classes': 'underline', exact: true },
strikethrough: { inline: 'del' },
customformat: { inline: 'span', styles: { color: '#00ff00', fontSize: '20px' }, attributes: { title: 'My custom format' }, classes: 'example1' },
},
paste_auto_cleanup_on_paste : true,
paste_postprocess : function( pl, o ) {
o.node.innerHTML = o.node.innerHTML.replace( / +/ig, " " );
}
});
setTimeout(function(){
if (tinymce.editors.length > 0) {
tinymce.execCommand('mceFocus', true, textareaId );
tinymce.execCommand('mceRemoveEditor',true, textareaId);
tinymce.execCommand('mceAddEditor',true, textareaId);
}
}, 500);
});`
我已经创建了一个youtube视频,让你看到不正当的行为
您会注意到下拉列表没有响应。它们也不会在控制台或php日志中抛出任何错误
提前谢谢
Jay首先,格式化您的代码,使其在您的帖子中显示为代码。其次,您不需要制作youtube视频来演示问题:您只需要在此处解释错误。我很感谢你的努力,但是,解释这个问题仍然是用StackOverflow提问的正确方式。或者,如果您愿意,也可以发布屏幕图像。是否使用jQuery模式对话框显示TinyMCE?是的,Michael。我们正在使用这一个特别感谢你对这篇文章的兴趣。杰伊