tinymce.PluginManager.add 不再适用于 wordpress 4.7.2
tinymce.PluginManager.add no longer working in wordpress 4.7.2
代码示例如下
(function()
{
tinymce.PluginManager.add( 'custom_class', function( editor, url )
{
// Add Button to Visual Editor Toolbar
editor.addButton('custom_class', {
type: 'menubutton',
text: 'Text Layout',
icon: false,
menu: [{
text: 'Testimonial',
onclick: function()
{
tinyMCE.activeEditor.setContent('');
editor.insertContent('<strong>Menu item 1 here!</strong> ');
}
},
{
text: 'Large Header Line',
onclick: function()
{
tinyMCE.activeEditor.setContent('');
editor.insertContent('<h4>Header</h4><em>Menu item 2 here!</em> ');
}
},
{
text: 'Normal',
onclick: function()
{
tinyMCE.activeEditor.setContent('');
editor.insertContent('Menu item 3 here! ');
}
}]
//image: url + '/icon.png',
});
});
})();
Wordpress 从 4.7.1 升级到 4.7.2 后,我无法再添加 tinymce 按钮了。
我检查过 javascript 肯定是 运行。它与 wp 4.7.1
一起工作正常
有人有想法吗?
适用于我的案例的解决方案
运行 phpmyadmin(或任何其他数据库管理解决方案)
在 table wp_options 中找到 can_compress_scripts 并将值更改为 0
代码示例如下
(function()
{
tinymce.PluginManager.add( 'custom_class', function( editor, url )
{
// Add Button to Visual Editor Toolbar
editor.addButton('custom_class', {
type: 'menubutton',
text: 'Text Layout',
icon: false,
menu: [{
text: 'Testimonial',
onclick: function()
{
tinyMCE.activeEditor.setContent('');
editor.insertContent('<strong>Menu item 1 here!</strong> ');
}
},
{
text: 'Large Header Line',
onclick: function()
{
tinyMCE.activeEditor.setContent('');
editor.insertContent('<h4>Header</h4><em>Menu item 2 here!</em> ');
}
},
{
text: 'Normal',
onclick: function()
{
tinyMCE.activeEditor.setContent('');
editor.insertContent('Menu item 3 here! ');
}
}]
//image: url + '/icon.png',
});
});
})();
Wordpress 从 4.7.1 升级到 4.7.2 后,我无法再添加 tinymce 按钮了。
我检查过 javascript 肯定是 运行。它与 wp 4.7.1
一起工作正常有人有想法吗?
适用于我的案例的解决方案 运行 phpmyadmin(或任何其他数据库管理解决方案) 在 table wp_options 中找到 can_compress_scripts 并将值更改为 0