Change from append tags to insert at cursor

hello, below is a script by Chris Montgomery to append list of tags to a draft. I was wondering if it would be complicated to change from append to draft to insert tags at cursor. thank you

—-
/* global draft */

/**

const { content, tags } = draft;

if (tags && tags.length !== 0) {
const spacelessTags = tags.map(tag => tag.replace(’ ', ‘’));
let newTags = spacelessTags;

That whole script is based around updating the draft content so whilst straight forward to create, it’s based on the draft object rather than inclusive of the editor object you would also need to use to use the current cursor position.

I would recommend that you consider writing it from scratch. break down what you want to do into steps and build it step by step.

1 Like

I will try it. thank you for your reply