Skip to content

Instantly share code, notes, and snippets.

@epramono
Created October 16, 2014 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epramono/945e6154ea03dcfd50dc to your computer and use it in GitHub Desktop.
Save epramono/945e6154ea03dcfd50dc to your computer and use it in GitHub Desktop.
A JavaScript keyboard extension to decode the selected text in Drafts 4.
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