Bug 34377

Summary: Select-All does not select all content (HTML editor for iframes in designmode)
Product: WebKit Reporter: Cacycle <oq9pscb02>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Severity: Major CC: lukebenes, RandomDSdevel, rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   

Description Cacycle 2010-01-30 11:21:25 PST
The Webkit editor for iframes in designmode does not work properly in all Webkit-based browser for rich text editors such as the Wikipedia editor wikEd. Symptoms are:

1. Deleting the whole text leaves the first character's formatting behind. E.g., if the first character was red and the whole text is deleted, then all characters typed into the empty iframe will be red. It is not possible to get rid of this formatting, neither manually nor through the .execCommand interface.

2. Copy-all, followed by paste inserts strange <span class="Apple-style-span">, <font class="Apple-style-span">, and <div> (no class name or other identifier!) nodes. Repeated copy/paste cycles accumulate large amounts of this junk html. Especially problematic are the <div> tags without identifier because they cannot be filtered and create artificial paragraphs.

As a testcase edit Wikipedia with the Wikipedia richtext editor wikEd (http://en.wikipedia.org/wiki/User:Cacycle/wikEd). The html source can be shown with the source button [<br>] on the right top button bar. This button has to be enabled by placing "var wikEdShowSourceButton = true;" on your User:YourUserName/monobook.js page.
Comment 1 Alexey Proskuryakov 2010-01-30 20:27:23 PST
Please file separate bugs for each issue. A single "does not work properly" bug isn't really helpful, there are dozens of known issues that are being investigated, each with its own priority, workarounds etc.
Comment 2 Cacycle 2010-02-02 12:22:55 PST
I think that both symptoms might have the same cause, i.e. that Select-All does not select all the (hidden) content on that page. 

Meanwhile, I have noticed that Select-All followed by delete does not remove the whole content but leaves a one character wide empty text fragment. After that it is possible to move the the cursor one position to the left or use a backspace-delete. This actually gets rid of the remaining formatting from symptom 1 and is the probable cause of symptom 2.

Alexey: Do you still think I should file separate bugs for each of the symptoms? I will change the title of this bug ticket it into something more meaningful.
Comment 3 Bryce Glover 2013-04-08 17:05:50 PDT
Have you tried pasting as plain text?  I know that you can do this on the Mac OS X 10.5.8 Leopard version of Safari (5.0.6) with the keyboard shortcut ⌥⇧⌘V (Option-Shift-Command-V,) which points to the 'Edit' menu's 'Paste and Match Style' command.  Unfortunately, I don't know what this keyboard shortcut's Windows equivalent is, but I can guess that it could be Ctrl+Alt+Shift+V, the result of replacing Mac modifier keys with their Windows versions–i.e.:  Ctrl for ⌘ (Command) and Alt for ⌥.  But maybe it's too much to ask everybody to remember to use 'Paste and Match Style' instead of just 'Paste,' so maybe somebody could figure out how to force the command replacement via JavaScript?  I'd do it, but I don't know any JS.
Comment 4 Ryosuke Niwa 2019-06-06 13:50:24 PDT
Reverse-duping this to the bug 198603 which has a more clear description & a test case.

*** This bug has been marked as a duplicate of bug 198603 ***