Opened 14 years ago
Closed 13 years ago
#6270 closed Bug (fixed)
Chrome: Difficulties pasting tables from Excel
Reported by: | Jude Allred | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | Core : Pasting | Version: | 3.4 |
Keywords: | Webkit Opera | Cc: |
Description
- open an Excel 2007 spreadsheet
- select some cells and hit ctrl+c
- using chrome, go to http://ckeditor.com/demo
- Paste the table into the editor using ctrl+v
- right click on the newly-pasted table
- [bug 1] the 'Table Properties' menu item is missing from the context menu.
- view the source. [bug 2] Notice that the newly inserted table has each <tr> wrapped in a <p>, and there is no containing <table> tag.
- [bug 3] return to wysiwyg mode- the table no longer looks like a table.
This is caused by Chrome failing to wrap the pasted HTML in a <table> tag. One workaround (which I'm currently using) is to use a special paste handler for Webkit:
if (CKEDITOR.env.webkit) { editor.ck.on('paste', function(evt) { if (evt.data.html) { //If this html contains table elements if ($('tr:first, td:first, th:first', evt.data.html).length) { //...but does not contain any <table> tags if ($('table:first', evt.data.html).length === 0) { //Wrap it in a table. evt.data.html = $('<table>'). addClass(editor.ck.config.tableClass). append(evt.data.html)[0]. outerHTML; } } } }); }
Change History (3)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Component: | General → Core : Pasting |
---|---|
Keywords: | Webkit Opera added |
Status: | new → confirmed |
Version: | → 3.4 |
Confirmed on Chrome 6;7; Opera 10.61; Safari with CKE 3.4.1 nightly and demo
Table formating is lost so "bug1" in point 6 is consequence of problems in point 7&8
comment:3 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | confirmed → closed |
note that in the above example, my editor instance is "editor.ck", not to be confused with CKEditor's internal 'editor' reference.