Support » Plugin: Crayon Syntax Highlighter » Post Editor: loss of post content after switching from Text to Visual tab

  • Love the plugin but there’s quite a critical issue.
    While I never use the Visual tab in post editor, it can happen that I quickly switch to it sometimes. I use Crayon while in the Text tab, and I’ve noticed that after switching back and forth, parts of the post got lost completely.
    Any chance you could look into a “locked mode” for everything within the Crayon tags, so that whatever is in there is ignored/not displayed/not messed with, if switching to Visual tab and back to Text?
    Thank you 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author akarmenia


    Can you provide a sample of the HTML code and what happens to it after you switch to the Visual tab and back again?

    I’d rather not try to replicate the problem 😀
    Basically, in Text tab, I added some mixed html and php with crayon window and it got inserted fine (with encoded entities though).
    Then I switched to Visual and from the beginning of the code, to the very end of the post (including also some regular text after the code, not in the crayon tags), got deleted completely.

    Plugin Author akarmenia


    You could always try with a fresh post to avoid breaking anything on your site. Besides, wordpress has a history of changes you can revert to.

    What I did was copy the entire functions.php file in my theme (some 1000 lines of PHP and HTML) and added it in the HTML view. I then switched to Visual and back and did a diff. All that was modified were the spacing between the text and the Crayon tag. The contents of the pre tag containing the code were kept intact.

    What WILL break the code is if you start inserting < and > (angular brackets) unencoded into the code. This is not valid HTML! You must encode these as & lt; and & gt; so it doesn’t get picked up as HTML tags itself. The decode:true option in Crayon then decodes them back into <>.

    Note that the Tag Editor automatically encodes and decodes the brackets you entered into the dialog correctly – it’s only when you forget and add an unencoded bracket outside the dialog that it can break. It’s best to use the visual editor when possible 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Post Editor: loss of post content after switching from Text to Visual tab’ is closed to new replies.