Go to http://rtef.info/demo.htm Switch to HTML mode Insert this code Please don't kill my brother, <img src="http://www.dcs.dk/imgNewDesign/frontBrother.gif" alt="Brother" /> Switch to RichText mode Select all content (button 1 or how ever you do it), hit unformat (button 2)
Probably should mention that unfromat calls "rteCommand('RemoveFormat') rteCommand('JustifyNone') and rteCommand('FormatBlock', '<p>') on the selected contnet.
I have the same issue when executing : document.execCommand('RemoveFormat',false,null); on a mix text / img, img are deleted. I avoid selection on img by adding "-khtml-user-select:none" on them same problem. another thing the text lost class inherit properties <div id='editor' class='textclass'> .... my text ... </div> When apply "RemoveFormat" the text CSS class might be 'textclass' ! Same problem on Chrome Regards Jeff
Created attachment 71792 [details] Patch
This bug has been fixed since http://trac.webkit.org/changeset/70283. I'm adding two more tests to make sure we're not removing any images.
Comment on attachment 71792 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=71792&action=review > LayoutTests/editing/execCommand/remove-format-image.html:2 > +<html> Don't need this tag. It just adds clutter. The doctype is useful because it forces standards mode though. > LayoutTests/editing/execCommand/remove-format-image.html:3 > +<body onload="runTests();"> Do you need to run this onload? Can't you just run the script inline? If you do that, you won't need the body tag in the test. > LayoutTests/editing/execCommand/remove-format-image.html:5 > +<div id="test1" contenteditable><storng>hello</strong> <img src="../resources/abe.png"> world</div> typo:storng
(In reply to comment #5) > > LayoutTests/editing/execCommand/remove-format-image.html:2 > > +<html> > > Don't need this tag. It just adds clutter. The doctype is useful because it forces standards mode though. I don't think having <html> adds that much of cluttering. I think most of tests that do have DOCTYPE also has html, and I'd rather conform to that trend. Are you strongly inclined to remove this before landing? > > LayoutTests/editing/execCommand/remove-format-image.html:3 > > +<body onload="runTests();"> > > Do you need to run this onload? Can't you just run the script inline? If you do that, you won't need the body tag in the test. Yes. Images aren't necessarily loaded by the time the script is ran, and we get a different result when that happens. Or otherwise we'll make this test flaky. > > LayoutTests/editing/execCommand/remove-format-image.html:5 > > +<div id="test1" contenteditable><storng>hello</strong> <img src="../resources/abe.png"> world</div> > > typo:storng Oops, thanks. Will fix.
(In reply to comment #6) > (In reply to comment #5) > > > LayoutTests/editing/execCommand/remove-format-image.html:2 > > > +<html> > > > > Don't need this tag. It just adds clutter. The doctype is useful because it forces standards mode though. > > I don't think having <html> adds that much of cluttering. I think most of tests that do have DOCTYPE also has html, and I'd rather conform to that trend. Are you strongly inclined to remove this before landing? No. Either way is fine. While I agree that many tests have the html tag, I don't personally like it. The smaller a test is, the easier it is to make sense of and maintain.
Committed r70493: <http://trac.webkit.org/changeset/70493>
Thanks for the review, Ojan.