Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
603 views
in Technique[技术] by (71.8m points)

wordpress - add font size button to TinyMCE wp_editor

I created simple wordpress plugin and I have to make it more flexible usign WYSIWYG editor inside. I have succesfully added wp_editor, but can't modify font size of a text.

According to docs:

'tinymce' (bool|array) Whether to load TinyMCE. Can be used to pass settings directly to TinyMCE using an array. Default true.

I passed some TinyMCE settings to the array:

$settings = array(
      'media_buttons' => false,
      'textarea_rows' => 3,
      'teeny'         => true,
      'quicktags' => true,
      'default_editor' => 'TinyMCE',
      'textarea_name' => $this->get_field_name( 'test' ),
      'tinymce' => array(
      'selector' => 'textarea',
      'toolbar' => "undo redo | styleselect | fontsizeselect | bold italic | alignleft aligncenter alignright alignjustify | outdent indent",
      'fontsize_formats' => "8px 10px 12px 14px 18px 24px 36px",
      'height' => 350,
      ),
    );

<?php wp_editor( $text = $test, $id = "test", $settings ); ?>

Unfortunately only height applies to the editor.

The field also saves only when typing in a text tab - in visual mode I have to manually change it to text and then type something to apply changes.

question from:https://stackoverflow.com/questions/65898116/add-font-size-button-to-tinymce-wp-editor

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...