Skip to content

This chrome extension allows you to easily save highlighted text from any website to the browser's storage. With a single click on the extension's icon, the highlighted text is saved, an alert is shown to confirm the action and the text is ready to be exported to a text file.

Notifications You must be signed in to change notification settings

alwaz-shahid/chrome-extension-to-copy-save-text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Copy Highlighted Text

A simple chrome extension that allows you to copy highlighted text and save it to the browser's storage. The extension also allows you to export the saved text to a text file.

Installation

To install the extension, you need to download the source code and load it into your chrome browser as an "unpacked extension".

  • Download the source code from GitHub
  • Open the chrome browser and navigate to chrome://extensions/
  • Enable the "Developer mode" toggle in the top right corner
  • Click on the "Load unpacked" button and select the folder where you have the source code
  • The extension should now be installed and you should see it in the extension list
  • You should now see the extension's icon on the top right corner of your chrome browser

Usage

  • Click on the extension's icon after highlighting text on any website.
  • The text will be saved in the browser storage and an alert will be shown to confirm it.
  • To export the saved text to a text file, right-click on the extension's icon, and select "Export Highlighted Text" from the context menu.

Notes

  • The extension uses the browser's local storage to save the highlighted text.
  • The exported text file will be named "highlighted_text.txt" and it will be downloaded to the default download folder.
  • In case of any conflict, chrome will prompt to save the file with a different name or overwrite the existing one.

Functionalities

The provided code creates a context menu item "Export Highlighted Text" on browser_action and sets an onClicked event listener to it. Once the menu item is clicked, the function "exportData" is called which retrieves the highlightedText from chrome.storage.local and passes it to "downloadTextFile" function. The "downloadTextFile" function creates a text file with the passed text and downloads it.

Additionally, the code also sets an onClicked event listener for browser action which retrieves the currently selected text from the active tab and if there is any text selected, it concatenates it with previously saved highlightedText and saves it to chrome.storage.local.

Contribution

You are welcome to contribute to the project by submitting pull requests or by reporting issues.

## License This code is open-sourced under the MIT license

About

This chrome extension allows you to easily save highlighted text from any website to the browser's storage. With a single click on the extension's icon, the highlighted text is saved, an alert is shown to confirm the action and the text is ready to be exported to a text file.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published