Inserting text in the Freshdesk Editor inserts it at the position of the cursor in the template not the reply

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}

2 Likes

Hi Rob,
The set value interface for the editor works for the already opened editor window and places the text after the cursor.
The texts from the successive interface API’s will be added one after the other.

Hi Gautham,

Thanks for the reply. The issue I am having is that the set value interface is not placing the text where the cursor is in the open editor but rather where the cursor was left when the agent reply template was last edited.

@RobAtOpinyin,

Seems like what you are expecting is correct.

I am finding the above statement hard to understand. If you don’t mind, can you share a screenshot or small recording or maybe articulate it in a different way?

The specific part which I did not understand is but rather the cursor was left and was last edited parts. I could only interpret as after a canned response is added, the current position of the cursor would be the end of the appended canned response.

Is my interpretation correct? If yes, I will try to reproduce it.

Hi Saif,

Difficult to create a video to show it but here are the steps to reproduce.

  1. Create a canned response with 1 line of text, a couple of carriage returns, another line of text and then another carriage return. Leave the cursor at the very last carriage return and save the canned response.
  2. Set this canned response as the default reply template for the agent.
  3. Open the reply editor and place cursor directly after the first line of text.
  4. Call set value.

Expected result = set value text will be inserted at cursor position
Actual result = set value text is inserted at end of canned response where cursor is left when canned response is saved.

1 Like

Thanks for the detailed explanation @RobAtOpinyin.

The right behaviour should be,

The value being set right after the first line of text.

How ever you see, the set value text being added at the end of (previously saved) canned response. Am I right? Let me try to reproduce the issue and keep you posted.

Hi Saif. Yes that is correct if you follow the steps I have outlined. Thanks

@RobAtOpinyin, I was able to reproduce the issue just as you described. I have taken this to engineering team for further analysis. Appreciate you for the coordination.

Hi @Saif

No problem. My pleasure.