Reputation: 540
Here is playground: http://jsfiddle.net/n6W27/1/
try to Ctrl+A Ctrl+C Ctrl+V and see that contenteditable node was duplicated(at least for me in firefox). The original question is how could I force only plain-text input into contenteditable block? And the derived question is "Why the !@#$ node duplicated next to original one?"
Edit1: There is only one block in this demo, so I put caret inside editable block and then select all, copy, and paste
Edit2: result screenshot
Upvotes: 1
Views: 818
Reputation: 185933
If you can, change the element type to DIV. That will clear your issue.
<div class="edit" contenteditable>ABC</div>
If you don't want your field to be block-level, set the display property to "inline-block":
.edit {
display: inline-block;
}
Live demo: http://jsfiddle.net/n6W27/2/
Upvotes: 2