@sylumer’s suggestion is great, but I might suggest a slight tweak. If you replace the line he called out with the below, the action would continue to work both ways, because the [[selection]]
template tag returns the full text of the draft if their is no current selection – therefore you would not need two separate actions for use on full text versus current selection:
// grab current draft
const currentContent = draft.processTemplate("[[selection]]");