admin管理员组文章数量:1130349
I use WordPress with TinyMCE in Chinese.
It needs double white spaces in the beginning of each paragraph. But the editor will automatically removing all spaces(white space and nbsp; code) in the beginning of the paragraph when I toggle the editor between WYSIWYG mode and HTML mode.
When I used WordPress 3.8, I could stop it doing this with these code
add_filter('tiny_mce_before_init', 'preserve_nbsp_chars');
function preserve_nbsp_chars($initArray) {
$initArray['entities'] = $initArray['entities'].',160,nbsp';
return $initArray;
}
The bad thing is it does not work after I updated WP to 4.0.
I use WordPress with TinyMCE in Chinese.
It needs double white spaces in the beginning of each paragraph. But the editor will automatically removing all spaces(white space and nbsp; code) in the beginning of the paragraph when I toggle the editor between WYSIWYG mode and HTML mode.
When I used WordPress 3.8, I could stop it doing this with these code
add_filter('tiny_mce_before_init', 'preserve_nbsp_chars');
function preserve_nbsp_chars($initArray) {
$initArray['entities'] = $initArray['entities'].',160,nbsp';
return $initArray;
}
The bad thing is it does not work after I updated WP to 4.0.
Share Improve this question edited Sep 24, 2014 at 4:01 Mark Kaplun 23.8k7 gold badges43 silver badges65 bronze badges asked Sep 24, 2014 at 3:36 sunsam7sunsam7 111 gold badge1 silver badge2 bronze badges2 Answers
Reset to default 4An ugly workaround I have always used in WordPress to add spaces is use <b> </b>
It's ugly, but it works.
//[nbsp] shortcode
function nbsp_shortcode( $atts, $content = null ) {
$content = ' ';
return $content;
}
add_shortcode( 'nbsp', 'nbsp_shortcode' );
Then call it like this:
[nbsp]
Instead of:
Hat tip to this post on wordpress: https://wordpress/support/topic/prevent-nbsp-characters-from-getting-removed-by-the-visual-editor
I use WordPress with TinyMCE in Chinese.
It needs double white spaces in the beginning of each paragraph. But the editor will automatically removing all spaces(white space and nbsp; code) in the beginning of the paragraph when I toggle the editor between WYSIWYG mode and HTML mode.
When I used WordPress 3.8, I could stop it doing this with these code
add_filter('tiny_mce_before_init', 'preserve_nbsp_chars');
function preserve_nbsp_chars($initArray) {
$initArray['entities'] = $initArray['entities'].',160,nbsp';
return $initArray;
}
The bad thing is it does not work after I updated WP to 4.0.
I use WordPress with TinyMCE in Chinese.
It needs double white spaces in the beginning of each paragraph. But the editor will automatically removing all spaces(white space and nbsp; code) in the beginning of the paragraph when I toggle the editor between WYSIWYG mode and HTML mode.
When I used WordPress 3.8, I could stop it doing this with these code
add_filter('tiny_mce_before_init', 'preserve_nbsp_chars');
function preserve_nbsp_chars($initArray) {
$initArray['entities'] = $initArray['entities'].',160,nbsp';
return $initArray;
}
The bad thing is it does not work after I updated WP to 4.0.
Share Improve this question edited Sep 24, 2014 at 4:01 Mark Kaplun 23.8k7 gold badges43 silver badges65 bronze badges asked Sep 24, 2014 at 3:36 sunsam7sunsam7 111 gold badge1 silver badge2 bronze badges2 Answers
Reset to default 4An ugly workaround I have always used in WordPress to add spaces is use <b> </b>
It's ugly, but it works.
//[nbsp] shortcode
function nbsp_shortcode( $atts, $content = null ) {
$content = ' ';
return $content;
}
add_shortcode( 'nbsp', 'nbsp_shortcode' );
Then call it like this:
[nbsp]
Instead of:
Hat tip to this post on wordpress: https://wordpress/support/topic/prevent-nbsp-characters-from-getting-removed-by-the-visual-editor
本文标签: tinymceHow to stop editor removing space (ampnbsp) in the beginning of the paragraph
版权声明:本文标题:tinymce - How to stop editor removing space (&nbsp;) in the beginning of the paragraph 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749068461a2311194.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论