ct: Try to preserve newlines while copying.

- For some reason, copying a multi-line field's value in Chrome does so
  whilst preserving newlines.  In the desktop app on OSX, though,
  multiline values are copied as a single line.

- Although non-standard, the .innerText property of a Node will do
  better at preserving plain-text-formatting (newlines, and such) from
  child elements.  Where it doesn't exist, fallback to whatever JQuery's
  `.text()` uses.
This commit is contained in:
Chris Taylor 2016-06-10 21:36:58 -04:00
parent 8990058bca
commit 7f19d90514
1 changed files with 1 additions and 1 deletions

View File

@ -85,7 +85,7 @@ var FieldView = Backbone.View.extend({
range.selectNodeContents(this.valueEl[0]);
selection.removeAllRanges();
selection.addRange(range);
copyRes = CopyPaste.copy(this.valueEl.text());
copyRes = CopyPaste.copy(this.valueEl[0].innerText || this.valueEl.text());
if (copyRes) {
selection.removeAllRanges();
this.trigger('copy', { source: this, copyRes: copyRes });