diff --git a/backgroundScript.js b/backgroundScript.js index c9606de..32424f1 100644 --- a/backgroundScript.js +++ b/backgroundScript.js @@ -30,15 +30,23 @@ var notifications; var conflictAction; function saveTextToFile(info) { - createFileContents(info.selectionText, function(fileContents) { - var blob = new Blob([fileContents], { - type: 'text/plain' - }); - var url = URL.createObjectURL(blob); - createFileName(function(fileName) { - var sanitizedFileName = sanitizeFileName(fileName); - startDownloadOfTextToFile(url, sanitizedFileName); - }); + chrome.tabs.executeScript({ + code: '(' + getSelectionText.toString() + ')()', + allFrames: true, + matchAboutBlank: true + }, function (results) { + if (results[0]) { + createFileContents(results[0], function(fileContents) { + var blob = new Blob([fileContents], { + type: 'text/plain' + }); + var url = URL.createObjectURL(blob); + createFileName(function(fileName) { + var sanitizedFileName = sanitizeFileName(fileName); + startDownloadOfTextToFile(url, sanitizedFileName); + }); + }); + } }); } diff --git a/manifest.json b/manifest.json index 125f53e..8e3c25d 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Save text to file", "description": "Saves highlighted text to a file.", - "version": "3.2.1", + "version": "3.2.2", "applications": { "gecko": { "id": "HighlightedTextToFile@bobbyrne01.org",