execCommand('insertHTML') doesn't insert original content as-is.
Reported by
cyril.au...@gmail.com,
Mar 23 2016
|
||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 Steps to reproduce the problem: 1. https://jsfiddle.net/crl/gvau4uc8/2/ 2. click once 'replace': it works fine 3. click again: wrapping issue What is the expected behavior? it should stay the same after replace What went wrong? the dom is different Did this work before? N/A Chrome version: 49.0.2623.87 Channel: stable OS Version: 10.0 Flash Version: Shockwave Flash 21.0 r0 are there other ways to replace all content in a contenteditable (and keeping undo history)? or is it a bug?
,
Mar 24 2016
it happens only when h1 is the first element, so not here https://jsfiddle.net/crl/gvau4uc8/3/ if it helps
,
Jul 14 2016
,
Jul 15 2016
,
Jul 17 2017
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jul 28 2017
Simplify test.
<button id="replace">
replace
</button>
<div id="foo" contenteditable>
<h1> World</h1><ul><li>rips br's without our consent</li></ul>
</div>
<script>
replace.addEventListener('click', e=>{
foo.focus();
document.execCommand('selectAll');
document.execCommand('insertHTML',null, `<h1> World</h1><ul><li>rips br's without our consent</li>
</ul>`);
});
,
Oct 4 2017
,
Oct 4
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Oct 5
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by brajkumar@chromium.org
, Mar 24 2016Status: Untriaged (was: Unconfirmed)