Creates new instance of TadCommand class.
Runs a slash command from the end of the current line in the editor.
This is really just a convenience function for the TA_command
function.
// Example
tadCmd.TA_cmdDraft();
Runs a slash command from a prompt given to the user.
This is really just a convenience function for the TA_command
function.
// Example
tadCmd.TA_cmdPrompt();
Runs a slash command.
The function accepts a single parameter that specifies a mode, Draft
or Prompt
(default).
Draft
mode, the function will scan the current line for the last forward slash and then
attempt to read everything from, and including, the slash, as a command.Prompt
mode, the user is presented with a pop-up into which to enter the command.
The command is then interprested based on the commands
settings in the library settings.
The commands
settings are a set of JSON that defines a command as the key value, and the
operation as the value, along with any parameter use. There are three operations:Any parameters are either specified in the JSON, or a placeholder of <1>
is used to indicate
that the parameters are entered after the command.
Example commands can be found in the TadLibrary
initialisation function (constructor()
).
the command entry mode the function will use. Defaults to Prompt.
// Example
tadCmd.TA_command("Draft");
Picks out the slash command from the end of the current line in the editor. The function tracks back from the current line (based on the end of and selection), splits the line by forward slashes, then grabs the last part of the array it produces. This is removed form the text and then returned. If no slash is found, nothing is returned.
// Example
tadCmd.TA_slashSplit("This is some text/run Prepare Draft");
TadCommand (Library)
This is a class that is used for running Drafts commands. These commands are based on the slash command approach of other systems.