Skip to content
Permalink
Browse files

Merge branch 'PRESIDECMS-1568_paste-from-word-improvement' of https:/…

  • Loading branch information...
sebduggan committed May 15, 2019
2 parents 1e89fdb + 2c2db56 commit 5ddfb0f424b39541e6f5efe37f52f33e59886aac
Showing with 15 additions and 0 deletions.
  1. +15 −0 system/assets/js/admin/presidecore/preside.richeditor.js
@@ -50,6 +50,21 @@ PresideRichEditor = ( function( $ ){
}
config.autoParagraph = autoParagraph;
config.widgetCategories = widgetCategories;
config.on = {
afterPasteFromWord: function( event ) {
var filter = event.editor.filter.clone(),
fragment = CKEDITOR.htmlParser.fragment.fromHtml( event.data.dataValue ),
writer = new CKEDITOR.htmlParser.basicWriter();

filter.disallow( 'span' ); // Strip all span elements
filter.disallow( '*(*)' ); // Strip all classes
filter.disallow( '*{*}' ); // Strip all inline-styles

filter.applyTo( fragment );
fragment.writeHtml( writer );
event.data.dataValue = writer.getHtml();
}
};

CKEDITOR.on( "instanceReady", function( event ) {
event.editor.initialdata = event.editor.getData();

0 comments on commit 5ddfb0f

Please sign in to comment.
You can’t perform that action at this time.