#6610 closed defect (bug) (fixed)
When saving in Firefox, TinyMCE alters the inside of <pre> and <code> tags.
Reported by: | asandler | Owned by: | azaozz |
---|---|---|---|
Milestone: | 2.5.1 | Priority: | normal |
Severity: | normal | Version: | 2.5 |
Component: | TinyMCE | Keywords: | tinymce, has-patch |
Focuses: | Cc: |
Description
When saving a post or a page in Firefox, tinymce removes tabulation characters used for indentation. It also removes extra space characters.
Seen on Firefox 2.0.0.13 and Firefox 3b5.
Attachments (1)
Change History (7)
#2
@
17 years ago
You're right. <code> and <pre> are two different tags. I assumed same problem would happen with <code>. Anyway, I am interested in <pre> tag because this is the tag that tinymce inserts when using "preformatted" style. And I've seen at least four people reporting this problem, so it's not only me.
Another part of this problem is that tinymce removes tabulation (one you normally get by pressing TAB button on your keyboard) symbols as well. Actually, you cannot use TAB directly - it changes focused element of the page (it is another bug, because it works in IE7. only you have to press TAB twice for the first time). However you can paste it from another editor and this is usually what people do with the code (people don't yet write programs in tinymce lol).
#3
@
17 years ago
The editor also adds an empty line after each line. This empty line disappears after saving and comes back again when editing the post.
To reproduce:
- Browse to write a new post.
- Switch to HTML view.
- Write something with several lines between pre tags.
- Switch to Visual view - there is an empty line after each line.
This happens in firefox and ie6 (I didn't test with other browsers).
Doron
#4
@
17 years ago
- Keywords has-patch added; editor firefox space indentation pre code indent tab tabulation removed
The <pre> and <code> tags are quite different. Generally <code> is an inline phrase element like <strong> and <em>, so it doesn't preserve white space or line breaks.
The only HTML tag that preserves white space is <pre>, however there's a small bug in the js wpautop that eventually will remove some spaces if you switch Visual to HTML mode and back several times. I'm working on a patch for this for 2.5.1, until then, for best results format the inside of the <pre> tags from HTML mode prior to saving the post.