Skip to content

Brackets extension which keeps history of copied texts and allow you to paste them back

License

Notifications You must be signed in to change notification settings

technet/brackets.clipbox

Repository files navigation

Brackets ClipBox (Clipboard History)

Another simple extension which remembers last few copied texts and allow you to access them and paste back whenever needed. This will capture Ctrl+C keystrokes and store selected text in its own internal array. Then you can invoke the hot-key Ctrl+Alt+V to launch QuickOpen window, select and paste back.

This extension won't change how you normally copy text (i.e. Ctrl+C), but it seamlessly keeps history of copied texts for future reference. Clopboard history is really important when you need to copy segments from multiple locations of and paste in another location. Normally you have to copy and paste each segment one after another. But with this extension you can keep on copying these segments and then paste them all in one go.

There are some limitations, but considering 99% of common usage, these limitations won't be that significant.

Usage

  • Use Ctrl+C as usual to copy texts and continue work on editor. In background ClipBox will capture texts and store.

  • Hit Ctrl+Alt+V to invoke QuickOpen box to see the history of copied texts, and use Up and Down arrow keys to navigate through the entries. Then hit Enter to paste the selected entry back to the editor.

  • Hit Ctrl+Alt+E to clear the stored history.

  • This will store maximum of 10 history entries.

QuickOpen screenshot

Limitations

  • No Cut, only Copy In ideal environment this should capture both Copy and Cut functionality. However I implemented this just by handling the key event and then accessing the editor. During Copy operation selected text is available on the editor so we can capture a copy of it. But in the event of Cut system has already removed selected text from the editor so unless you directly access clipboard we don't have access to this text. I'm still not sure how to access clipboard directly using Javascript in this environment so left it for future enhancements.

    • I could have used direct key binding using KeyBindingManager to capture both Ctrl+C and Ctrl+X commands, then I would have implemented both scenarios successfully. Problem is that event brackets editor itself avodes ignoreCommand handling these native commands by itself. Main thing is I just wanted to implement this as a supplementary feature without breaking most primary functionality that any editor has.
  • Won't handle menu action This won't respond if you copy using the Edit -> Copy menu option. Because with my knowledge I have so far related to brackets, I cannot register another event handler to same command, so I don't know how to know whether user clicks on this menu item.

Design Considerations

  • Didn't want to introduce new hot key to make this extension usable, which will hinder the normal editor usage, instead you can use usual Ctrl+C key combination and extension will capture and build its own clipboard.

  • Didn't use KeyBindingManaer to capture the keyevent mainly because these are primary key combinations for any editor so didn't want to mess with them.

  • Utilized the QuickOpen plugin to show the stored clipboard history as it is easy to navigate and select history item.

  • Even though it uses QuickOpen it doesn't do any filtering mainly because this isn't a search feature. (probably in future releases)

Future Enhancements

  • Capture both Cut and Copy operations.
  • Handle Edit -> Cut and Edit -> Copy menu actions.
  • Filter entries by search string.

Version History

0.2.1
0.2.0
  • Settings dialog, Now you can change number of history entries and customize shortcut key combinations. (Note: you need to restart brackets in order to apply new shortcut settings)
  • Seperated language specific strings to support localization. However it only supports English in this release.
  • Code cleanup
0.1.0

Initial release with main functionality.

About

Brackets extension which keeps history of copied texts and allow you to paste them back

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages