Opened 10 years ago

Closed 9 years ago

#10987 closed Bug (fixed)

[Blink] Copy-paste table within CKE breaks width percentage.

Reported by: Joel Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Blink Chrome Cc: Stephen.Eidson@…

Description

For my content widths being percentages is very important. When you copy a table with a width like 100% and the paste the same table in CKE, the width is replaced with a pixel value, which breaks layouts.

  1. Go to ckeditor.com/demo in Chrome (Opera not tested)
  2. Clear editor and add a table with a 100% width
  3. Click the table in elementspath to select it
  4. Move cursor to new paragraph
  5. Hit Ctrl-v or click paste from word to paste the table
  6. Check the table width, it is no longer fluid but horrid static pixels

Works fine in IE9

Change History (5)

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

Keywords: Blink Chrome added
Status: newconfirmed

This is a Chrome's bug. We have no control over what's copied into clipboard. You can file bug here: https://code.google.com/p/chromium/issues/list

On our side I can only imagine that storing width in some data-* attribute could help. So as there's a way to workaround this issue, I confirm this ticket.

comment:3 Changed 10 years ago by Joel

I created a (stupid) workaround for this. It only works for my situation because I know that the majority of tables in my content is 100% and I never want to see anything defined as pixels anywhere. This might be useful to someone somewhere, so here.

if(window.chrome) {
	editor.on('paste', function(even) {
		var str = even.data.dataValue;
		if(str.indexOf("<table") != -1) {
			var regex = /width:\d+px;/g;
			str = str.replace(regex, "width:100%;");
			even.data.dataValue = str;
		}
	});
}

comment:4 Changed 9 years ago by rarrarrarr

Cc: Stephen.Eidson@… added

This appears to have been fixed!

I was seeing this issue with CKEditor 4.4.7 using Chrome 43.0.2357.130 (64-bit) on osx. I noticed, however, when looking at http://ckeditor.com/demo, that the issue no longer happens.

After upgrading to the newest version of CKEditor Full 4.5.1, I'm no longer experiencing the issue.

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

Resolution: fixed
Status: confirmedclosed

Yes, CKEditor 4.5.0 introduced custom integration with the clipboard. CKEditor now doesn't let the browser copy the content - it is handled by the editor. There was also a change in the paste process. The editor uses now the Clipboard APIs (whenever possible - IEs don't support it) to access content directly from the clipboard. Previously, the pastebin was used. This, allowed us to bypass all the terrible Chrome and Webkit problems with copying content.

Read more in http://docs.ckeditor.com/#!/guide/dev_clipboard

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