Plugin: Insert text at cursor position

Integration questions/issues
Post Reply
mmeyer
Posts: 9
Joined: Fri Feb 23, 2018 8:21 am

Plugin: Insert text at cursor position

Post by mmeyer » Fri Feb 23, 2018 8:28 am

I am writing a plugin that allows the user to insert an address.

When the user selects an address it should be inserted at the current cursor position.
The address is an array of strings. Each string should be placed on a new line.

How can this be accomplished?

When trying the oParagraph.addText() approach from the helloworld example the text is always inserted flush left.
(https://api.onlyoffice.com/plugin/example)

The symboltable example seems to consider the cursor position but uses an un-documented function called "PasteHtml".
(https://github.com/ONLYOFFICE/sdkjs-plu ... oltable.js)

Regards,
M. Meyer

Maxim
Posts: 1751
Joined: Tue Oct 11, 2016 2:34 pm

Re: Plugin: Insert text at cursor position

Post by Maxim » Mon Mar 05, 2018 9:45 am

Hello mmeyer!
When trying the oParagraph.addText() approach from the helloworld example the text is always inserted flush left.
Please use oParagraph.addText() but it's not necessary to add whole text via one command.
The symboltable example seems to consider the cursor position but uses an un-documented function called "PasteHtml".
Yes, it's not documented yet. We will but you can use it - insert content in html format "PasteHtml".

tommycrestanello
Posts: 4
Joined: Tue Sep 18, 2018 10:40 am

Re: Plugin: Insert text at cursor position

Post by tommycrestanello » Tue Sep 18, 2018 10:48 am

I post here another answer for the same topic:

Insert text at cursor position is possible via API with drag & drop event?

Carl
Posts: 92
Joined: Thu Apr 12, 2018 10:00 am

Re: Plugin: Insert text at cursor position

Post by Carl » Fri Sep 21, 2018 11:58 am

Hello,

unfortunately, text insertion via drag&drop is not supported.

Post Reply