Replace <br/> with <p> on paste / paste from word in CKEditor 4


Put this code into the ckeditor.config.js file at the root of your current theme folder. In CKeditor module UI find option Load ckeditor.config.js from the theme path and set as 'Yes'

Get raw version
  1. // Replace br with p on paste
  2. CKEDITOR.on('instanceReady', function (ev) {
  3. ev.editor.on('paste', function (ev) {
  4. =\<br ?\/?\>)+/gi, '<p>');
  5. =\<div)+/gi, '<p');
  6. =\<\/div\>)+/gi, '</p>');
  7. });
  8. });