Try the fastest and simplest way to install ONLYOFFICE

Plugin: Insert text at cursor position

Integration questions/issues

Plugin: Insert text at cursor position

Postby 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
mmeyer
 
Posts: 9
Joined: Fri Feb 23, 2018 8:21 am

Re: Plugin: Insert text at cursor position

Postby 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".
Maxim
 
Posts: 1576
Joined: Tue Oct 11, 2016 2:34 pm


Return to Plugins

Who is online

Users browsing this forum: No registered users and 0 guests