When you call the client interface API as follows to insert text in the ticket reply window the text is inserted at the position the cursor is left in the agent reply template not the position of the cursor in the actual editor.
client.interface.trigger(“setValue”, { id: “editor”, text: ‘Hello’, replace: false}