Created
October 16, 2014 16:14
-
-
Save epramono/4e63a1be039edbf1a0dd to your computer and use it in GitHub Desktop.
A JavaScript keyboard extension to encode selected text in Drafts 4.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var input = getSelectedText(); | |
var output = ""; | |
if (input) { | |
output = encodeURIComponent(input); | |
var range = getSelectedRange(); | |
setSelectedText (output); | |
setSelectedRange (range[0], output.length); | |
} else { | |
input = getText(); | |
output = encodeURIComponent(input); | |
setText(output); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment