javascript - TinyMCE with paste plugin loses formatting in Chrome -
greeting, everyone!
i have webpage textarea handles rich text via tinymce. worked fine when users pasted text variety of sources, had issue when users tried paste word content (tons of xml tags added). fixed using "paste" tinymce plugin after getting advice stack overflow posts.
firefox works fine. users can paste word or other sources (notepad++, winmerge, etc.) , formatting maintained. however, in chrome, pasting word works fine, pasting other sources loses formatting , left-justifies everything. lot of users paste code snippets textarea , losing formatting makes difficult read.
i'm using tinymce 3.5.10. tried 4.2.4 see same behavior there. below code looks using 4.2.4. php source contains textarea element "tinymce-test" id.
tinymce.init({ selector: "#tinymce-test", height: "100px", width: "99%", toolbar: "bold, italic, undo, redo", menubar: false, statusbar: false, plugins: "paste" });
my firefox version 39.0.3 , chrome version 44.0.2403.155 m.
any appreciated. thanks!
add following options:
paste_webkit_styles: "color font-size"
this allow retain color , font-size styles webkit browsers. more info here: https://www.tinymce.com/docs/plugins/paste/
Comments
Post a Comment