$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>visual editor - How can I change TinyMCE's default block format?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

visual editor - How can I change TinyMCE's default block format?

matteradmin8PV0评论

I have a particular post type where I want the editor's default format block to be H3. So, when you create a new empty post and begin typing in the editor, the text would automatically default to being an H3.

Currently the default is set to be a Paragraph, which means even if I create some text and set it to be Heading 3 (H3), when I create a new line the block format automatically goes back to Paragraph, too.

As a test, I even removed all the block formats except for H3, but that didn't work—the block format dropdown displays "Heading 3," but the text is still formatted as a paragraph (<p>).

To be clear, I do still want control over the block format. I just want to be able to change the default.

Here's my failed attempt to remove everything except H3:

function set_h3_default($init) {
  $block_formats = array(
    'Heading 3=h3',
  );
  $init['block_formats'] = implode(';', $block_formats);

  return $init;
}
add_filter('tiny_mce_before_init', 'set_h3_default');

Post a comment

comment list (0)

  1. No comments so far