T
T
TANK_IST2014-01-31 20:40:32
css
TANK_IST, 2014-01-31 20:40:32

How to insert clear text into a block with contenteditable?

There is such a bug/feature in webkit that when copying text, the style of this text is also copied somewhere. This is clearly seen in the example .
If you are currently in chrome or another browser with webkit, copy Lorem ipsum into the top box. Then you will notice that the text style has been transferred to the field.
If the copied text in chrome is pasted into this field only from Mozilla, then the result will be the same.
If you copy the text in Mozilla and paste it into this field from any browser, then the text will be without style.
Of course, you can make a hack so that this is not visible:

.t * {
     //тот же стиль текста что и в поле
}

But I want the text to be inserted initially clean. Is it possible to do something?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Leonid, 2014-02-01
@leonid-lapidus

Try to do something like this on the onChange event in a div with editable content
$('#myDiv').html( $('#myDiv').text() );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question