admin管理员组文章数量:1193316
I want to add custom settings to the editor, for which I am using the tiny_mce_before_init filter, as following:
function custom_tinymce_settings( $settings ) {
$settings['link_class_list'] = "[
{title: 'None', value: ''},
{title: 'Dog', value: 'dog'},
{title: 'Cat', value: 'cat'}
]";
return $settings;
}
add_filter( 'tiny_mce_before_init', 'theme\act\custom_tinymce_settings' );
The added setting comes right from the Tiny docs for v4, see link_class_list.
But it's not adding the classes to the link dialog.
Any idea on what I am doing wrong?
I want to add custom settings to the editor, for which I am using the tiny_mce_before_init filter, as following:
function custom_tinymce_settings( $settings ) {
$settings['link_class_list'] = "[
{title: 'None', value: ''},
{title: 'Dog', value: 'dog'},
{title: 'Cat', value: 'cat'}
]";
return $settings;
}
add_filter( 'tiny_mce_before_init', 'theme\act\custom_tinymce_settings' );
The added setting comes right from the Tiny docs for v4, see link_class_list.
But it's not adding the classes to the link dialog.
Any idea on what I am doing wrong?
Share Improve this question edited Aug 1, 2022 at 16:34 Tom J Nowell♦ 60.8k7 gold badges77 silver badges147 bronze badges asked Aug 1, 2022 at 14:27 Álvaro FranzÁlvaro Franz 1,0901 gold badge9 silver badges31 bronze badges 1- 1 The WordPress editor does not use the TinyMCE link dialog. It has its own. – Jacob Peattie Commented Aug 1, 2022 at 14:48
1 Answer
Reset to default 0As Jacob mentioned in the comment, WordPress adds a custom plugin to TinyMCE which uses a native window with extra features, like loading content from WordPress.
The documentation I referenced is for the TinyMCE official link plugin.
You can still use it, all you have to do is replace the wplink plugin with the link plugin in the TinyMCE settings.
本文标签: tinymceAdd custom value for linkclasslist for the classic editor
版权声明:本文标题:tinymce - Add custom value for link_class_list for the classic editor 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738479763a2089073.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论