Please or Register to create posts and topics.

Making a default size of text within editor

Hi!

Great forum, as I have used this plugin for some time now. However, I am really noticing an issue where my users are posting all different sizes of fonts within the editor. This begins to be a real issue when it comes to readability and the overall appearance of the forum.

I am already using the “minimal editor”, and even with that feature turned on, users are still creating posts that have all sorts of different font sizes, especially if they copy and paste text from another sources, directly into the editor. I have already tried to correct this via some CSS by adjusting the post styling with a little success, but I still really haven’t been able to completely correct the size issues for some posts.

I need my forum to be where regardless of what a user entered within the editor, the font is exactly the same style AND size for all posts.

What is an easy solution to this?

Hello @wolfco

You can try to add the following code to your themesĀ functions.php file:

function tinymce_paste_as_text($init) {
    $init['paste_as_text'] = true;
    return $init;
}

add_filter('tiny_mce_before_init', 'tinymce_paste_as_text');

 

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Thanks for the prompt reply. Unfortunately, after adding your suggestion to the functions file correctly, that still doesn’t seem to work. Is there a way to make the text editor area a simple “text only” field? I don’t want to give users the ability to past anything other than plain text, which I can then style via css. Any ideas?

Oddly enough, I tried pasting a test here on this post (from a source that had different font styles and sizes) and the forum here automatically shows the correct adjustments by posting plain text. So I don’t why my forum isn’t doing the same? Will the function code listed above work when the minimal editor is enabled?

Hello again @wolfco

Actually I didnt apply any settings here on this forum, so there is also the possibility that this issue is caused by your theme or another plugin which is modifying the editor-behavior in some way. Regarding the minimalistic editor, you can try to use the following code-snippet instead (teeny instead of tiny in the add-filter call):

function tinymce_paste_as_text($init) {
    $init['paste_as_text'] = true;
    return $init;
}
add_filter('teeny_mce_before_init', 'tinymce_paste_as_text');

Using a normal text-editor without an instance of TinyMCE is currently not possible, because it will break other-functionalities as well. For example it would be not possible to quote other posts anymore.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!