aramk / crayon-syntax-highlighter

Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text.
https://wordpress.org/plugins/crayon-syntax-highlighter/
GNU General Public License v3.0
1.1k stars 247 forks source link

XML tags lost when post is saved and reopened in Visual mode #158

Open nolar opened 10 years ago

nolar commented 10 years ago

When I paste XML code (https://gist.github.com/nolar/9830479) to a blog post, it works fine till I save my changes. Once saved and immediately reopened, the editors shows just XML text content, but no XML tags.

The tags, however, are in the database (as < and > entities) and are shown on the public post url properly until you save the page for the second time. This second time actually saves damaged (tagless) code, and the post becomes finally corrupted.

Worth mentioning, this happens only when "visual" text editor is used. When "text" mode is used, everything fine no matter have many times I have saved the post.

I guess something is wrong with Crayon + MCE wordpress visual editor.

WordPress 3.8.1. Crayon Syntax Highlighter 2.5.0. All other plugins and themes are up to date.

Steps to reproduce:

  1. Create new post, save it as a draft or publish it.
  2. Switch to "visual" editor mode.
  3. Open code insertion dialog.
  4. Write "<root>Hello</root>"
  5. Save the code.
  6. Save the post. It will immediately reopen for further editing.
  7. Locate that code snippet and open it for editing.

What happens: "root" tags are now missing, but "Hello" text is still present.

What is expected: "root" elements to be kept intact.

step-3 step-7

nolar commented 10 years ago

Ah, my bad. It is something related to qTranslate. It removes tags even in regular text flow in visual mode. Syntax highlighter is not an issue anymore.

aramk commented 10 years ago

Ah right, I'm aware Google Translate can also distort the output a bit.