Yes I am a cat
Yes I am a cat

Reputation: 279

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

Upvotes: 4

Views: 2575

Answers (3)

Meysam Khoshbakht
Meysam Khoshbakht

Reputation: 310

$("#editor").redactor({
    pasteBeforeCallback: function (html) {
        return html.replace(/<p>\s*<\/p>/g, " ");
    }
});

Upvotes: 1

Shad Gagnon
Shad Gagnon

Reputation: 513

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.

Upvotes: 1

EpokK
EpokK

Reputation: 38092

You need to set paragraphy and linebreaks settings like this :

$('#redactor').redactor({
    linebreaks: true,
    paragraphy: false
});

Upvotes: 9

Related Questions