Page MenuHomePhabricator

Pasting Excel cells into Internet Explorer doesn't work
Open, LowPublic

Description

Pasting from Excel into Chrome works. Highlighting that content in Chrome and then pasting it into IE works.

Pasting the content straight from Excel into IE11 doesn't work.

How can I enable pasting straight from Excel?

Event Timeline

MarkAHershberger raised the priority of this task from to Needs Triage.
MarkAHershberger updated the task description. (Show Details)
MarkAHershberger added a project: VisualEditor.
MarkAHershberger added a subscriber: MarkAHershberger.

What HTML do you get if you past into a CE box? http://edg2s.github.io/content-editable-sandbox/

It doesn't seem to matter which browser I use. Chrome, FF, and IE all give: "226 LexWiki "

Pasting the same thing into a VE page on chrome gives a table with two cells.

Sorry for being an idiot -- I was pasting into the wrong box.

On Chrome, I get:

<table border="0" cellpadding="0" cellspacing="0" width="270" style="border-collapse:
 collapse;width:203pt"><tbody><tr height="80" style="height:60.0pt">
  <td height="80" align="right" width="58" style="height:60.0pt;width:44pt">226</td>
  <td width="212" style="width:159pt">LexWiki</td></tr></tbody></table>

In IE, I get:

<table width="270" style="width: 203pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"><font face="Times New Roman">
 </font><colgroup><col width="58" style="width: 44pt; mso-width-source: userset; mso-width-alt: 2121;"><font face="Times New Roman">
 </font><col width="212" style="width: 159pt; mso-width-source: userset; mso-width-alt: 7753;"><font face="Times New Roman">
 </font><tbody><tr height="80" style="height: 60pt;"><font face="Times New Roman">

  </font><td width="58" height="80" align="right" style="border: 0px black; width: 44pt; height: 60pt; background-color: transparent;"><font face="Calibri">226</font></td><font face="Times New Roman">
  </font><td width="212" style="border: 0px black; width: 159pt; background-color: transparent;"><font face="Calibri">LexWiki</font></td><font face="Times New Roman">

 </font></tr><font face="Times New Roman">
</font></tbody></table>

In FF, I get:

<table border="0" cellpadding="0" cellspacing="0" width="270"><colgroup><col width="58"><col width="212"></colgroup><tbody><tr height="80">
  <td style="height:60.0pt;width:44pt" align="right" height="80" width="58">226</td>
  <td style="width:159pt" width="212">LexWiki</td>
</tr></tbody></table>

Wow that IE html is bad. Font tags as a child of table!

So, how do I strip it? Where would I put that in the VE code?

I'll have to take a look at how the converter is handling it at the moment to see how to fix it, but I'm on holiday at the moment.

From IRC:

<edsanders> hexmode, paste sanitization happens in
          ve.ce.Surface.prototype.beforePaste
<edsanders> ve.ce.Surface.prototype.afterPaste
<edsanders> and ve.dm.ElementLinearData.prototype.sanitize
<edsanders> we have sanitization rules
<edsanders> which are strict for MediaWiki and loose for VisualEditor core

Tracked down to a call in ve.js: ve.createDocumentFromHtml.

Using my trusty console.log() -- who needs a debugger!?! -- I saw that before this call the text I want is there, but after it isn't:

			// If there were no problems, let CE do its sanitizing as it may
			// contain all sorts of horrible metadata (head tags etc.)
			// TODO: IE will always take this path, and so may have bugs with span unwapping
			// in edge cases (e.g. pasting a single MWReference)
			htmlDoc = ve.createDocumentFromHtml( this.$pasteTarget.html() );

hrm.... maybe I was wrong. looks like it is already stripped by this point.

No, I was right. I just removed all <font> tags and their children.

Ryasmeen triaged this task as Low priority.Jan 9 2015, 11:33 PM
Ryasmeen set Security to None.
Ryasmeen moved this task from To Triage to Freezer on the VisualEditor board.
Esanders added a comment.EditedMar 8 2016, 4:01 PM

Not getting any crazy font tags with Excel2016 + Edge12.

Broken with Firefox, too.

If I paste from Excel while editing a page in VE in Firefox, it's not pasted as a table at all, but just as text. If I paste into Chrome, it's pasted as table cells.

If I paste from Google Spreadsheets into Firefox, it also works.

Should it be a separate task?

Akuckartz added a subscriber: Akuckartz.