The config.forcePasteAsPlainText in the configuration file and the option in the ckeditor module profile configuration page for forcing as plain text are no longer working properly. They are no longer stripping out all of the junk from Microsoft Word. In previous versions of CKEditor, all of the extra code and formatting from MS Word was stripped out when copy/pasting. It used to work if you hit CTRL+V in the CKEditor window, and if you actually pressed the Paste button on the toolbar. Now it only works properly if you hit the Paste button in CKEditor -- if you press CTRL+V, it adds in all of junk from MS Word.

Drupal 6.25
CKEditor 3.6.3
CKEditor - WYSIWYG HTML editor 6.x-1.11+4-dev (2012-May-14)
Browser: Firefox 12.0
OS: Windows 7 x86
Application: MS Word 2010

CommentFileSizeAuthor
#2 jlea9378_screenshots_ckeditor.zip1.21 MBjlea9378
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dczepierga’s picture

Status: Active » Postponed (maintainer needs more info)

Hi,

I check this and i only change option in CKEditor profile (Advanced options section) and for me everything works fine... could u paste any example of text which u try to paste or send me file with this text?
I will try to reproduce this with your document...

Greetings

jlea9378’s picture

Status: Postponed (maintainer needs more info) » Active
FileSize
1.21 MB

It's not working fine for us. We've been using ckeditor for over a year now, and this didn't start happening until a few weeks ago, about the time that I updated from 3.6.2 to 3.6.3. However it could have been from updating the ckeditor module also.

It doesn't matter what the Word document is. If you paste in the contents of the Word doc using CTRL+V, then it inserts XML and CSS junk. See attached screenshots.

Below is my config file:

/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

/*
 WARNING: Clear the browser cache after you modify this file.
 If you do not do this, you may notice that the browser is ignoring all your changes.
 */
CKEDITOR.editorConfig = function(config) {
  config.indentClasses = [ 'rteindent1', 'rteindent2', 'rteindent3', 'rteindent4' ];

  // [ Left, Center, Right, Justified ]
  config.justifyClasses = [ 'rteleft', 'rtecenter', 'rteright', 'rtejustify' ];

  // The minimum editor width, in pixels, when resizing it with the resize handle.
  config.resize_minWidth = 450;

//Set to 'encode' if you want to obfuscate emails with javascript
config.emailProtection = 'encode';
config.forcePasteAsPlainText = true;
config.font_names = 'Lucida/Lucida Grande,Lucida Sans Unicode,helvetica,verdana,arial,sans-serif;' +
  'Arial;Verdana';
config.font_defaultLabel = 'Lucida';
config.fontSize_defaultLabel = 'small';
config.fontSize_sizes = 'small;smaller;x-small;xx-small;medium;larger;large;x-large';

  // Protect PHP code tags (<?...?>) so CKEditor will not break them when
  // switching from Source view to WYSIWYG.
  // Uncommenting this line doesn't mean the user will not be able to type PHP
  // code in the source. This kind of prevention must be done in the server
  // side
  // (as does Drupal), so just leave this line as is.
  config.protectedSource.push(/<\?[\s\S]*?\?>/g); // PHP Code
  config.protectedSource.push(/<code>[\s\S]*?<\/code>/gi); // Code tags
  config.extraPlugins = '';

  /*
   * Append here extra CSS rules that should be applied into the editing area.
   * Example: 
   * config.extraCss = 'body {color:#FF0000;}';
   */
  config.extraCss = '';
  /**
   * Sample extraCss code for the "marinelli" theme.
   */
  //config.extraCss += "body{background:#FFF;text-align:left;font-size:0.8em;}";
  //config.extraCss += "#primary ol, #primary ul{margin:10px 0 10px 25px;}";

  config.extraCss += "body{background:#FFF;text-align:left;font-size:0.8em;}";
  config.extraCss += "#primary ol, #primary ul{margin:10px 0 10px 25px;}";

  /**
   * CKEditor's editing area body ID & class.
   * See http://drupal.ckeditor.com/tricks
   * This setting can be used if CKEditor does not work well with your theme by default.
   */
  /**
   * Sample bodyClass and BodyId for the "marinelli" theme.
   */
   //config.bodyClass = 'singlepage';
   //config.bodyId = 'primary';

};

/*
 * Sample toolbars
 */

//Toolbar definition for basic buttons
//Drupal.settings.cke_toolbar_DrupalBasic = [ [ 'Format', 'Bold', 'Italic', '-', 'NumberedList','BulletedList', '-', 'Link', 'Unlink', 'Image' ] ];
Drupal.settings.cke_toolbar_DrupalBasic = [ ['Format','Bold','Italic','-','NumberedList','BulletedList'] ];


//Toolbar definition for Advanced buttons
/*Drupal.settings.cke_toolbar_DrupalAdvanced = [
    ['Source'],
    ['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker', 'Scayt'],
    ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
    ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'],
    ['Maximize', 'ShowBlocks'],
    '/',
    ['Format'],
    ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
    ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
    ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'],
    ['Link','Unlink','Anchor','Linkit','LinkToNode','LinkToMenu'],
    ['DrupalBreak', 'DrupalPageBreak']
];*/
Drupal.settings.cke_toolbar_DrupalAdvanced = [
    ['Source'],
    ['Cut','Copy','Paste','-','SpellChecker','Scayt'],
    ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
    '/',
    ['Link','Unlink','Anchor','Linkit','LinkToNode','LinkToMenu'],
    ['Image','MediaEmbed','Flash','Table','HorizontalRule','SpecialChar'],
    '/',
    ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
    ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
    ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    '/',
    ['Format','Font','FontSize'],
    ['TextColor','BGColor'],
    ['Maximize','ShowBlocks'],
];

// Toolbar definiton for all buttons
/*Drupal.settings.cke_toolbar_DrupalFull = [
    ['Source'],
    ['Cut','Copy','Paste','PasteText','PasteFromWord','-','SpellChecker','Scayt'],
    ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
    ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar'],
    '/',
    ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
    ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
    ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiRtl','BidiLtr'],
    ['Link','Unlink','Anchor','Linkit','LinkToNode','LinkToMenu'],
    '/',
    ['Format','Font','FontSize'],
    ['TextColor','BGColor'],
    ['Maximize','ShowBlocks'],
    ['DrupalBreak','DrupalPageBreak']
];*/

Drupal.settings.cke_toolbar_DrupalFull = [
    ['Source'],
    ['Cut','Copy','Paste','-','SpellChecker','Scayt'],
    ['Undo','Redo','Find','Replace','-','SelectAll','RemoveFormat'],
    '/',
    ['Link','Unlink','Anchor','Linkit','LinkToNode','LinkToMenu'],
    ['Image','MediaEmbed','Flash','Table','HorizontalRule','SpecialChar'],
    ['DrupalBreak','DrupalPageBreak'],
    '/',
    ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
    ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
    ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    '/',
    ['Format','Font','FontSize'],
    ['TextColor','BGColor'],
    ['Maximize','ShowBlocks'],
];
mkesicki’s picture

Title: ForcePasteAsPlainText not working » ForcePasteAsPlainText not working [library problem]

@guys,
I checked this and contacted with CKEditor library developers. It looks like problem in CKEditor.
Here is ticket for it: http://dev.ckeditor.com/ticket/8968.

jlea9378’s picture

Thanks, Michal.

dczepierga’s picture

Status: Active » Postponed
jlea9378’s picture

Status: Postponed » Needs review

I just discovered that ckeditor 3.6.4 was released and includes a patch to resolve this problem. I reviewed it and it solves the problem related to pasting from MS Word or Outlook using CTRL+V. However, pasting from the firefox Edit menu still results in XML and CSS code being pasted in along with the content. I read the notes on the bug tracker that Michal mentioned, and the developer said something about it being fixed entirely in v4. Was he referring to a future release, version 4.0.0?

dczepierga’s picture

Status: Needs review » Postponed

@jlea9378, yes he referring to CKEditor 4 which is in development now and should be released soon.
This bug it's only library problem and we cannot do anything with it, so u must wait for new CKEditor release.

Greetings

jlea9378’s picture

ok thanks. The patch fixed the ctrl+v problem, which was the biggest issue. I doubt anyone uses the browser's edit menu to paste.