Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

About

This script adds Ctrl+B (bold), Ctrl+I (italic), Ctrl+K (code), and Ctrl+L (link) shortcuts to comments.

My script doesn't work exactly the same as the question/answer text editors, but it's similar. One difference is that hitting Ctrl+B when no text is selected just puts ** in the window, as opposed to putting **strong text** with "strong text" selected. This means you can use the shortcuts like you would in a word processor: hit Ctrl+B to enter bold mode, type what you want, then hit Ctrl+B again to back out. (Actually the question/answer text editors behave similar to this, but uses trickier javascript to accomplish it.)

For links, I'm using simple JS prompt() function, rather than trying to hook into the text box that is built-in for adding links questions/answers.

Download

Install | View source

Change History

  • 2012-03-26: Added support for Ctrl+L
  • 2009-07-18: Initially released

Platform

Tested on Firefox 3.6 and Chrome 9.0, on Windows 7. Requires Greasemonkey on Firefox.

License

Do whatever you want, as long as you don't sell it or claim you wrote it yourself. If you make any cool modifications, let me know!

share|improve this question
    
Awesome! Using it as we speak, and loving it! –  Cerberus Jun 2 '11 at 21:43
    
Bug Report: Press Ctrl L when editing a comment. Input a URL and press Enter (instead of clicking OK in the input dialog). Comment gets submitted immediately (after linking the selected text). –  ADTC Jan 27 at 10:50
add comment

You must log in to answer this question.

Browse other questions tagged .