Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#15673 closed defect (wontfix)

Copying from Firefox into dijit.Editor creates extra newlines

Reported by: mattwood0 Owned by: bill
Priority: undecided Milestone: tbd
Component: Editor Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:


When using Dojo 1.7.2 and Firefox 13, copying from Firefox into a dijit.Editor creates extra newlines in the data which are only seen after getting the value from the editor.

I've attached a static page that can be used to test.

First, copy sufficiently long text into the editor from Firefox. If you're viewing this ticket in Firefox you can use this conveintly provided text:

"One day I called Bill and said, 'I have a new character called the Bat-Man and I've made some crude, elementary sketches I'd like you to look at'. He came over and I showed him the drawings."

After pasting the text into the test editor, click read value and look at the console. The text will have extra newlines in it that weren't there originally.

It doesn't matter where the editor lives (Chrome, IE, Firefox), it only matters that the text was copied from Firefox. Copying from Chrome into Firefox, for example, works fine.

This may be Firefox corrupting the data in the clipboard somehow, but even having an idea about how to mitigate it would help a lot.

Attachments (1)

dijitEditorTest.html (816 bytes) - added by mattwood0 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by mattwood0

Attachment: dijitEditorTest.html added

comment:1 Changed 10 years ago by mattwood0

It looks like the static test file I uploaded actually throws an NS_ERROR_FAILURE when opening it in a file context, so you'll need to serve it up somehow or turn off those security checks.

comment:2 Changed 10 years ago by bill

Component: DijitEditor

comment:3 Changed 10 years ago by Jared Jurkiewicz

Resolution: wontfix
Status: newclosed

This is outside of the control of the editor. Paste events are native actions and the conversions are native. We cannot access the clipboard directly. Also, in HTML newlines (\n) are just treated like a space. It's sort of meaningless from a formatting perspective. So it's probably just how FireFox? is deciding to convert things.

That said, you can easily get around this issue by using the PrettyPrint? plugin, which does a lot of HTML reformatting and cleanup for you. It'll condense out newlines as part of its operation (and insert based on what you set as a line length limit (if any).

See docs:

The PrettyPrint? plugin generates pretty decently formatted HTML. Far better than letting the browser 'just decide' how it wants to format whitespace.

comment:4 Changed 10 years ago by mattwood0

Thanks, I'll try to work around it and check out the PrettyPrint plugin.

Note: See TracTickets for help on using tickets.