Created
October 16, 2014 16:16
-
-
Save epramono/945e6154ea03dcfd50dc to your computer and use it in GitHub Desktop.
A JavaScript keyboard extension to decode the 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 = decodeURIComponent(input); | |
var range = getSelectedRange(); | |
setSelectedText (output); | |
setSelectedRange (range[0], output.length); | |
} else { | |
input = getText(); | |
output = decodeURIComponent(input); | |
setText(output); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment