Action
Run Editor JS
Runs a script diretly from Drafts editor.
Note! Be careful:
If your script updates current content, it may mess itself up.
Use during development and debuging, with full use of Drafts versioning, tools, and actions.
Then copy draft into action script when finalized, or modify a copy of this scipt to run JS Code in Drafts’ archive using eval with UUID as described in comments. Have fun :)
Steps
-
script
// Run Editor JS // RV 2020-03-05 at 18:46 EST (() => { // Runs a script diretly from Drafts editor. // Note! Be careful: // If your script updates current content, it may mess itself up. // Only intended for development and debuging purposes, // With full use of Drafts versioning, tools and actions. // Alternative code to use with spesific script saved as drafts: // // UUID of draft containing script: // const uuid = '401B8C95-29F9-4917-8364-0D769C71EE8F'; try { eval( // line 14. draft.content // Draft.find(uuid).content ) } catch (e) { if (e.line != '14') { alert(`Runtim Error: ${e.message} line: ${e.line} column: ${e.column}`) } else { alert(`Syntax Error: ${e.message} line: ${e.line} column: ${e.column} Likely a syntax error, disregard line number!`) } } } )();
Options
-
After Success Nothing Notification Error Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.