Skip to content

Instantly share code, notes, and snippets.

@garyhodgson
Created October 31, 2008 08:21
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 garyhodgson/21258 to your computer and use it in GitHub Desktop.
Save garyhodgson/21258 to your computer and use it in GitHub Desktop.
/* This is a template command */
CmdUtils.CreateCommand({
name: "example",
icon: "http://example.com/example.png",
homepage: "http://example.com/",
author: { name: "Your Name", email: "you@example.com"},
license: "GPL",
description: "A short description of your command",
help: "how to use your command",
takes: {"input": noun_arb_text},
modifiers: {
a: noun_arb_text,
b: noun_arb_text
},
preview: function( pblock, input, mods ) {
var template = "Input: ${input}";
template += "<br/>First modifier: ${a}";
template += "<br/>Second modifier: ${b}";
pblock.innerHTML = CmdUtils.renderTemplate(template, {"input": input.text, "a": mods.a.text, "b": mods.b.text});
},
execute: function(input) {
CmdUtils.setSelection("You selected: "+input.html);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment