I’m using summernote lite font for my story section of my web site but the font that is pasted often overrides to a bad font.
If i select all and choose remove font it is good. How do i force pasted text to use std paragraph text?
I’m using summernote lite font for my story section of my web site but the font that is pasted often overrides to a bad font.
If i select all and choose remove font it is good. How do i force pasted text to use std paragraph text?
When pasting text into Summernote it also pasts the coding used originally. With a little bad luck pasting Word text will give you an extra 13 pages of unnecessary code.
Unfortunately I haven’t found a way to get clean text from pasting.
There's an event (onpaste) that can do the trick with js:
Will try to recreate something unless someone can find a better way than pure js
With a little help of the AI and this resource:
We have a solution:
dmx-bind:config="editorConfig" to the editor like:<textarea id="editor1" name="editor1" is="dmx-summernote" dmx-bind:config="editorConfig" dmx-bind:toolbar="[['style',['style']],['font',['bold','underline','clear']],['fontname',['fontname']],['color',['color']],['para',['ul','ol','paragraph']],['table',['table']],['insert',['link','picture','video']],['view',['fullscreen','codeview','help']]]">
</textarea>
<script>
dmx.global.set('editorConfig', {
callbacks: {
onPaste: function (e) {
e.preventDefault();
var clipboard = (e.originalEvent || e).clipboardData || window.clipboardData;
var text = clipboard.getData('text/plain');
document.execCommand('insertText', false, text);
}
}
});
</script>
You can see the result pasting the same on two summernote editors: