From c7fa0b6427e6975a0c821b981e423e6c9e7c7cfc Mon Sep 17 00:00:00 2001 From: Henrik Skupin Date: Tue, 16 May 2017 11:13:01 +0200 Subject: [PATCH] Only use comma separator for extension list in text fields. --- extension/chrome/content/nightly.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extension/chrome/content/nightly.js b/extension/chrome/content/nightly.js index 71f8003..75cbb9c 100644 --- a/extension/chrome/content/nightly.js +++ b/extension/chrome/content/nightly.js @@ -391,10 +391,12 @@ insertExtensions: function() { if (element) { var type = element.localName.toLowerCase(); if ((type == "input") || (type == "textarea")) { + // Input fields don't support new lines, so fallback to a comma separated list + var separator = (type == "input") ? ", " : "\n"; nightly.getExtensionList(function(text) { var newpos = element.selectionStart + text.length; var value = element.value; - element.value = value.substring(0, element.selectionStart) + text.join(", ") + + element.value = value.substring(0, element.selectionStart) + text.join(separator) + value.substring(element.selectionEnd); element.selectionStart = newpos; element.selectionEnd = newpos; @@ -408,7 +410,7 @@ insertExtensions: function() { copyExtensions: function() { nightly.getExtensionList(function(text) { if (text) - nightly.copyText(text.join(", ")); + nightly.copyText(text.join("\n")); }); },