Opened 10 years ago

Closed 10 years ago

#11307 closed Bug (fixed)

Paste as plain text broken when Mootools is loaded (Array's prototype contains $constructor)

Reported by: edwtests Owned by: Piotrek Koszuliński
Priority: Normal Milestone: CKEditor 4.3.2
Component: Core : Pasting Version: 4.0 Beta
Keywords: Cc:

Description (last modified by Piotrek Koszuliński)

1) Extract CKEditor full

2) Use the following settings:

CKEDITOR.editorConfig = function(config) {
    config.allowedContent = true;
};

3) Open a page with CKEditor in it.

4) Use the paste as plain text button, and paste rich text from a webpage. For example, I copied the side bar content at http://msdn.microsoft.com/en-us/library/aa288454%28v=vs.71%29.aspx

5) The text is not inserted.

See screenshot. PS: Tried with version 4.3.1 too, no change.

Short TC

  1. Download 11307.html to samples/.
  2. Follow instructions.

Attachments (6)

bug.png (39.1 KB) - added by edwtests 10 years ago.
Screenshot
papt.webm (968.3 KB) - added by Piotrek Koszuliński 10 years ago.
chrome.png (42.0 KB) - added by edwtests 10 years ago.
error on chrome
ffox.png (73.7 KB) - added by edwtests 10 years ago.
error on firefox 26
ie.png (43.4 KB) - added by edwtests 10 years ago.
error on ie11
11307.html (517 bytes) - added by Piotrek Koszuliński 10 years ago.

Download all attachments as: .zip

Change History (18)

Changed 10 years ago by edwtests

Attachment: bug.png added

Screenshot

comment:1 Changed 10 years ago by edwtests

(Sorry, I messed up the WikiFormat on the original ticket, it was my first one)

1) Extract CKEditor full

2) Use the following settings:

CKEDITOR.editorConfig = function(config) {

config.allowedContent = true;

};

3) Open a page with CKEditor in it.

4) Use the paste as plain text button, and paste rich text from a webpage. For example, I copied the side bar content at ​http://msdn.microsoft.com/en-us/library/aa288454%28v=vs.71%29.aspx

5) The text is not inserted.

See screenshot. PS: Tried with version 4.3.1 too, no change.

Version 0, edited 10 years ago by edwtests (next)

comment:2 Changed 10 years ago by Piotrek Koszuliński

Description: modified (diff)

Changed 10 years ago by Piotrek Koszuliński

Attachment: papt.webm added

comment:3 Changed 10 years ago by Piotrek Koszuliński

Keywords: paste plain text allowedContent removed
Status: newpending

I couldn't reproduce this issue (see papt.webm). On which browser do you test it? And could you check what error is thrown? Are you testing the same TC I checked?

Changed 10 years ago by edwtests

Attachment: chrome.png added

error on chrome

Changed 10 years ago by edwtests

Attachment: ffox.png added

error on firefox 26

Changed 10 years ago by edwtests

Attachment: ie.png added

error on ie11

comment:4 Changed 10 years ago by edwtests

Just attached screenshots of the consoles. On IE11 the popup to enter the text doesn't even appear, the text is pasted directly, but the error is still there.

All tests on Win7 Pro x64 Firefox 26 Chrome 32 IE11

comment:5 Changed 10 years ago by edwtests

Hello again. I have traced this down to an incompatibility with "mootools-core-1.3.1-full-compat-yc.js", which was being loaded by a base page.

You may want to close this ticket now, thanks.

Just FYI, I downloaded the uncompressed CKEditor pack and found the line with the conflict: ckeditor\core\htmlparser\filter.js:230.

if ( rulesGroup )
	return rulesGroup.exec( context, value, element, this );

I changed it to

if ( rulesGroup && typeof(rulesGroup.exec) == "function" )
	return rulesGroup.exec( context, value, element, this );

and now the feature works correctly. I have no idea which other features are affected by mootools; will try to post back if I find any.

Regards

comment:6 Changed 10 years ago by Piotrek Koszuliński

Status: pendingconfirmed
Version: 4.34.0 Beta

This incompatibility turned out to be caused by issue in CKEditor. It took a while to figure out why element.attributes becomes a reference to Object constructor, but I managed to locate this.

https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/clipboard/plugin.js#L1096

Attributes are set to an array, but they should be an object. Most likely then some code starts iterating over that array and weird things happen.

comment:7 Changed 10 years ago by Piotrek Koszuliński

Owner: set to Piotrek Koszuliński
Status: confirmedassigned

comment:8 Changed 10 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.3.2
Status: assignedreview

Pushed t/11307 on dev and tests.

comment:9 Changed 10 years ago by Piotrek Koszuliński

Description: modified (diff)
Summary: Paste as plain text broken when "config.allowedContent = true"Paste as plain text broken when Mootools is loaded (Array's prototype contains $constructor)

Changed 10 years ago by Piotrek Koszuliński

Attachment: 11307.html added

comment:10 Changed 10 years ago by Olek Nowodziński

Rebased branches on latest master.

comment:11 Changed 10 years ago by Olek Nowodziński

Status: reviewreview_passed

A single commit pushed to tests.

comment:12 Changed 10 years ago by Piotrek Koszuliński

Resolution: fixed
Status: review_passedclosed

Fixed on master with git:feba862 on dev and 60f0e27 on tests.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy