This doesn't seem to do what I want it to do. I am copying text from an email (Outlook) and pasting it into CKEditor and it is still pasting <div>'s instead of <p>'s. I am using the "Paste From Word" button and have implemented the enterMode entry in the config.
If the original code had divs then it would break lots of webs if they are automatically converted to p So you must check first what's the original code in outlook.
editor.on("instanceReady", function(ev){
ev.editor.on("paste", function (ev) {
var _html=ev.data.html;
//On paste, replace DIV => P
var re = new RegExp("(<DIV)([^>]*>.*?)(<\/DIV>)","gi") ;
_html = _html.replace( re, "<p$2</p>" ) ;
ev.data.html = _html;
}
}
Re: Pasting div's instead of p's
http://docs.cksource.com/ckeditor_api/s ... .enterMode
Re: Pasting div's instead of p's
Re: Pasting div's instead of p's
So you must check first what's the original code in outlook.
Re: Pasting div's instead of p's
Each paragraph shows <div> instead of <p>
I'm using Word 2007
config.enterMode = CKEDITOR.ENTER_P doesn't change anything
Re: Pasting div's instead of p's
This is bad for SEO and it makes the text appear incorrectly on my site.
I tried the "config.enterMode = CKEDITOR.ENTER_P;" fix but it didn't affect this problem.
Thanks for your help.
Re: Pasting div's instead of p's
I tried the workaround mentioned but it did not seem to correct it.
Re: Pasting div's instead of p's
Re: Pasting div's instead of p's [SOLVED]
editor.on("instanceReady", function(ev){
ev.editor.on("paste", function (ev) {
var _html=ev.data.html;
//On paste, replace DIV => P
var re = new RegExp("(<DIV)([^>]*>.*?)(<\/DIV>)","gi") ;
_html = _html.replace( re, "<p$2</p>" ) ;
ev.data.html = _html;
}
}