Create a new page (Add Content -> Basic page, or just visit /node/page/add). Select Text Format: Full HTML. Click on "Disable rich text".
Now, type in "<foo>" and click "Enable rich text". Your text disappears. Clicking "Disable rich text" doesn't get it back. I discovered this when I was trying to create a page with a google calendar on it. I cut-and-pasted a hunk of HTML that google gives you:
<iframe src="https://www.google.com/calendar/embed?height=600&wkst=1&bgcolor=%23FFFFFF&src=gv6qlc5qm9dugamgej6p3gv4ao%40group.calendar.google.com&color=%23125A12&ctz=America%2FNew_York" style=" border-width:0 " width="650" height="600" frameborder="0" scrolling="no"></iframe>
and must have toggled rich text by accident without noticing. By the time I realized the text was gone, I had already saved the page. Doing something as innocuous as toggling a display mode should never result in loss of data like this. Either the old data should be saved someplace, or a warning issued that data might be lost, or something. Silently loosing data is suboptimal.
Marking this critical since it involves loss of data.
Comments
Comment #1
roy smith commentedUgh, where it says:
type in ""
it's supposed to say:
type in quote left-angle-bracket foo right-angle-bracket quote
The example stuff from google got elided too, it's supposed to be a hunk of HTML inside iframe tags.
Comment #2
damien tournoud commentedThis is not a Drupal core issue, but I wonder where to assign it to.
Do you know which rich text editor module you are using?
Comment #3
roy smith commentedAh, interesting, it must be TinyMCE 3.3.9.3. Thanks. I had installed this a while ago on a test site I don't use often, and then had forgotten I even had it installed. Disabling the WYSIWYG module solves the problem nicely :-)
BTW, it looks like it's even worse than it appeared at first. You don't even have to manually toggle richt text mode back on. It looks like doing Preview is enough to toggle it back on automagically. Yuck. Wysiwyg be gone!
PS -- I see you changed this from Critical to Normal. I disagree. It may not be core, but if it causes silent data loss, it should be critical.
Comment #4
damien tournoud commentedTinyMCE doesn't have a release for 7.x, so I suppose you are using Wysiwyg.
Let's see what we can do here.
Comment #5
twodThis may seem like a simple action without consequences, but it's much more than a display mode.
TinyMCE and most other WYSIWYG editors all have to parse the existing content to a DOM for its editing iFrame, and back again when outputting the modified content. In doing so they apply filters for various reasons. If TinyMCE's not configured to allow iframes, they will simply be stripped. See #544032: Add iframes via TinyMCE and #368388: TinyMCE strips HTML not supported by plugins/buttons for workarounds.
There's no way for Wysiwyg module to know if changes made between sending content to an editor and getting it back were intended by the user or not. Either we have to accept all changes or ignore them.
The issue with the editor automatically turning itself on happens because its state isn't recorded in the backround, see #322433: Replace default editor status option(s) with intelligent logic.
Comment #6
twodI don't think there's really a bug here, but a configuration issue. Editors won't accept malformed markup because they (or rather the browser) couldn't render it in WYSIWYG mode, and they won't accept certain tags/attributes depending on various filter settings, like the new Advanced Content Filter feature in CKEditor 4.1 - which by default will remove any markup plugins haven't explicitly stated they are capable of creating. There's even a reverse mode where buttons/plugins can be automatically disabled based on which tags are allowed for a certain field (though we don't have support for this filtering in Wysiwyg).
TinyMCE have similar features with lists of tags, attributes and styles it will allow to be generated, while the rest is removed.
In essence, the editor must be correctly configured, or have the appropriate plugins, in line with what content you want it to accept and generate.
Comment #6.0
twod