• Resolved flamingblade

    (@flamingblade)


    Hi everyone,

    A friend of mine has an issue with his blog and asked for my help, and now I am asking yours ??

    The issue is the following;

    He writes his post using LibreOffice on his computer.
    Then, he pastes that text directly to the WYSIWYG editor in wp-admin.

    Along with the text, pasting it will also copy this
    <span style="font-size: 14px; line-height: 1.5em;">Text here</span>

    He can’t notice the difference when he is editing the post in wp-admin, but when he sees it on his website, the text changes style according to the values it transferred via the copy+paste

    Applying font-size: 12pt!important to the parent div will do nothing.

    Any ideas on how to fix that ?

    Thank you in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • Why doesn’t he use a plain text editor to write his posts? Or, if he has to use LibreOffice, then copy & paste into a plain text editor, then copy from the plain text editor into WP.

    Applying font-size: 12pt!important to the parent div will do nothing.

    Does the parent DIV have a class or ID? Try something like this (assuming, for example, that the DIV has a class of parent_div):

    .parent_div span {
       font-size: 12pt!important;
    }

    Can you post a link to an example page?

    I am noticing similar code that appears for no reason, but how I get there is completely different from the OP.

    When editing text in the visual editor, then switching to text, I frequently see something like this:

    <span style=”font-size: 14px; line-height: 1.5em;”>

    It seems to occur when using backspace or enter to create or delete paragraphs (i.e., if this was regular HTML, it would be the same as adding or deleting <p> tags).

    I find this behavior in all of the blogs I manage, both on wordpress.com and self-hosted. No matter what the formatting of the page, the line-height is always 1.5em when this happens.

    I don’t like to see unnecessary code, and I always remove these span tags when I see them. Why are they there? How can I prevent this from happening?

    Thread Starter flamingblade

    (@flamingblade)

    Thenextweb to the rescue …

    In brief, in the edit page, find the “Clear formatting” button. It is located between the paste and the special character button, on the second row of the TinyMCE editor.

    Highlight the desired text, hit the button and formatting will be stripped from the next.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Text changes styling when pasted to editor’ is closed to new replies.