Skip to content

Commit

Permalink
Prevent limit on selected text
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyrne01 committed Dec 20, 2018
1 parent 62ab6cd commit aa06702
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
26 changes: 17 additions & 9 deletions backgroundScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]",
Expand Down

0 comments on commit aa06702

Please sign in to comment.