Page 1 of 1

Plugin: Insert text at cursor position

PostPosted: Fri Feb 23, 2018 8:28 am
by mmeyer
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

Re: Plugin: Insert text at cursor position

PostPosted: Mon Mar 05, 2018 9:45 am
by Maxim
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".