Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redactor wysiwyg - why does paste from word not working

I've been using the Redactor Wysiwyg editor on a job post form. However, though their website mentions super cleaning on paste from word, I get a lot of extra empty <p> and <br />, even though in the word markup there is a single paragraph break. Any ideas what might be causing that? Anybody else has the same problem?

Thanks! Maria

like image 412
Yes I am a cat Avatar asked Dec 21 '22 07:12

Yes I am a cat


2 Answers

You need to set paragraphy and linebreaks settings like this :

$('#redactor').redactor({
    linebreaks: true,
    paragraphy: false
});
like image 121
EpokK Avatar answered Dec 22 '22 20:12

EpokK


in my case, some text or paragraphs was disappearing when I paste from Word to Redactor 10 in Internet Explorer. There the solution worked for me:

$('#redactor').redactor({
    pasteCallback: function(html) {
        html = html.replace("<font>", ""); // Fix Word to IE
        html = html.replace("</font>", ""); // Fix Word to IE
        return html;
    },
});

When I remove <font> tag generated by Microsoft Word before the paste, everything work fine.

like image 28
Shad Gagnon Avatar answered Dec 22 '22 21:12

Shad Gagnon