要自定义默认样式,请执行以下操作:
$styles = array(\'width\'=>\'100%\');
$settings[\'table_default_styles\'] = json_encode($styles);
要禁用“高级”选项卡:
$settings[\'table_advtab\'] = false;
完成函数处的代码。php:
function bootstrap_classes_tinymce($settings)
{
// to customize more please visit: https://www.tiny.cloud/docs/plugins/table/#table_default_styles
// Add bootstrap class inside <table> tag
$classes = array(
array(
\'title\' => \'None\',
\'value\' => \'\'
),
array(
\'title\' => \'Table\',
\'value\' => \'table\',
),
array(
\'title\' => \'Striped\',
\'value\' => \'table table-striped table-hover\',
),
array(
\'title\' => \'Bordered\',
\'value\' => \'table table-bordered table-hover\',
),
);
$settings[\'table_class_list\'] = json_encode($classes);
// remove default style
$styles = array(\'width\'=>\'100%\');
$settings[\'table_default_styles\'] = json_encode($styles);
$settings[\'table_advtab\'] = false;
// echo\'<pre>\'; print_r($settings); echo \'</pre>\';
return $settings;
}
add_filter(\'tiny_mce_before_init\', \'bootstrap_classes_tinymce\');