Action
Syntax
Change the syntax highlighting with all setup and creates a new Drafts.
Change focus and link mode without creating a new Drafts.
Steps
-
script
// See online documentation for examples // http://drafts5-help.agiletortoise.com/ // Prompt /* --------------------- */ var lists1 = ["Markdown", "JavaScript", "Taskpaper", "Simple List", "Plain text"]; var lists2 = ["+Focus", "-Focus"]; var lists3 = ["+Link Mode", "-Link Mode"]; var lists = lists1.concat(lists2,lists3); var p = Prompt.create(); p.title = "Syntax"; p.message = "Enter syntax choice"; for (i = 0; i < lists.length; i++) { p.addButton(lists[i]); } var con = p.show(); var selected = p.buttonPressed; if (con){ if (lists1.includes(selected)) { var d = Draft.create(); d.languageGrammar = selected; d.update(); d.addTag(selected); d.update(); editor.load(d); editor.focus(); } if (selected == "+Focus") { editor.focusModeEnabled = true; } if (selected == "-Focus") { editor.focusModeEnabled = false; } if (selected == "+Link Mode") { editor.linkModeEnabled = true; } if (selected == "-Link Mode") { editor.linkModeEnabled = false; } else { ; } } else { context.cancel(); }
Options
-
After Success Default Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.