how to implement selection plugin in author mode
Posted: Wed Mar 17, 2021 9:59 am
Hi,
I have a problem with developing a plugin for author mode of oxygenxml editor and wonder if you might point me in the right direction.
I made a small plugin for textmode that takes the current selection by getSelection()), does some string manipulation (deleting some XML if present) and then sends the string to a database using rest api. If there is a match in the database, it sends this match back, the XML gets included again and the selection is replaced with the SelectionPluginResultImpl(newstring).
(Its about abbreviated word, so in most cases, only a one word string is selected, but sometimes including an <hi> tag around the first character. So f.i., '<hi>a</hi>bbr.' will be send to the database as 'abbr.', send back as 'abbreviation' and will be returned to oxygen as '<hi>a</hi>bbreviation')
Now, as I need to implement this for author mode I am a bit lost. Basically, I have two questions:
1) more general: what structure do I need for a selection plugin to work in author mode? Do I have to specify the mode in any way?
2) how can I get my selection in author mode similar to the get.selection function in text mode. I realsie this is more complicated due to the author modes way of presenting text, but there must be a way to do this?
Any help where to start with this would be greatly appreciated
Best
Michael
I have a problem with developing a plugin for author mode of oxygenxml editor and wonder if you might point me in the right direction.
I made a small plugin for textmode that takes the current selection by getSelection()), does some string manipulation (deleting some XML if present) and then sends the string to a database using rest api. If there is a match in the database, it sends this match back, the XML gets included again and the selection is replaced with the SelectionPluginResultImpl(newstring).
(Its about abbreviated word, so in most cases, only a one word string is selected, but sometimes including an <hi> tag around the first character. So f.i., '<hi>a</hi>bbr.' will be send to the database as 'abbr.', send back as 'abbreviation' and will be returned to oxygen as '<hi>a</hi>bbreviation')
Now, as I need to implement this for author mode I am a bit lost. Basically, I have two questions:
1) more general: what structure do I need for a selection plugin to work in author mode? Do I have to specify the mode in any way?
2) how can I get my selection in author mode similar to the get.selection function in text mode. I realsie this is more complicated due to the author modes way of presenting text, but there must be a way to do this?
Any help where to start with this would be greatly appreciated
Best
Michael