Create PopUp Menu Customizer
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Create PopUp Menu Customizer
Hello,
We use Author web in version 26.0.0, and we are looking for an equivalent of the method :
For our desktop version, with oxygen sdk, we use a popUpMenuCustomizer which implements AuthorPopupMenuCustomizer.
We use it to provide user grammatical correction.
Here is a use case :
- Open a document
- Add the following sentence : She do something
- Launch our grammatical correction action
- Place cursor on "do" word
- Display popUpMenu with right click
- PopUpMenu show possible corrections elements on the top and common actions underneath.
Is it possible to do the same things in Author Web ?
If yes, can we use the addPopUpMenuCustomizer method or should we use an other API ?
Thanks,
Regards,
Isabelle
We use Author web in version 26.0.0, and we are looking for an equivalent of the method :
Code: Select all
((WSAuthorEditorPage) wsEditorAccess.getCurrentPage()).addPopUpMenuCustomizer
We use it to provide user grammatical correction.
Here is a use case :
- Open a document
- Add the following sentence : She do something
- Launch our grammatical correction action
- Place cursor on "do" word
- Display popUpMenu with right click
- PopUpMenu show possible corrections elements on the top and common actions underneath.
Is it possible to do the same things in Author Web ?
If yes, can we use the addPopUpMenuCustomizer method or should we use an other API ?
Thanks,
Regards,
Isabelle
-
- Site Admin
- Posts: 172
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Create PopUp Menu Customizer
Post by Bogdan Dumitru »
Hello Isabelle,
There is an API that you can use to customize spelling suggestions, see SpellcheckingEngine and WebappSpellchecker.
This allows you to define and install a custom SpellcheckingEngine, somewhat like this:
To install it on every AuthorDocumentModel you can use a WorkspaceAccessPluginExtension:
There is an API that you can use to customize spelling suggestions, see SpellcheckingEngine and WebappSpellchecker.
This allows you to define and install a custom SpellcheckingEngine, somewhat like this:
Code: Select all
AuthorDocumentModel.getSpellchecker().setSpellcheckingEngine("it", new YourSpellcheckingEngine());
Code: Select all
public class EditorListener implements WorkspaceAccessPluginExtension {
@Override
public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
WebappPluginWorkspace webappPluginWorkspace = (WebappPluginWorkspace) pluginWorkspaceAccess;
webappPluginWorkspace.addEditingSessionLifecycleListener(new WebappEditingSessionLifecycleListener() {
@Override
public void editingSessionStarted(String sessionId, AuthorDocumentModel documentModel) {
// TODO: install spellcheck engine in the "documentModel".
}
});
}
[...]
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Re: Create PopUp Menu Customizer
Hello Bogdan,
Thank you for your idea, but it does not suit our need.
A SpellCheckingProblemInfoWithSuggestions has only the following attributs :
- startOffset - The start offset of the word.
- endOffset - The end offset of the word.
- lang - ISO Name for the language of the word.
- word - The word found at the offsets.
- suggestions - List of suggestions, should not be null.
But we need the type of the error (Misspelling, Grammar or Other, like style issues, ex : two white space instead of one) and we also need the detail of the error.
Your solution does not provide a way to handle those elements.
That is why we need to manage our own spell checker and we need to implement a PopupMenuCustomizer.
Is it possible or not ?
And if yes, how can we do it ?
Thanks,
Regards,
Isabelle
Thank you for your idea, but it does not suit our need.
A SpellCheckingProblemInfoWithSuggestions has only the following attributs :
- startOffset - The start offset of the word.
- endOffset - The end offset of the word.
- lang - ISO Name for the language of the word.
- word - The word found at the offsets.
- suggestions - List of suggestions, should not be null.
But we need the type of the error (Misspelling, Grammar or Other, like style issues, ex : two white space instead of one) and we also need the detail of the error.
Your solution does not provide a way to handle those elements.
That is why we need to manage our own spell checker and we need to implement a PopupMenuCustomizer.
Is it possible or not ?
And if yes, how can we do it ?
Thanks,
Regards,
Isabelle
-
- Site Admin
- Posts: 234
- Joined: Wed Aug 30, 2023 2:33 pm
Re: Create PopUp Menu Customizer
Hello,
For the use case where there are two white spaces instead of one, Web Author automatically detects the empty spaces, and if there is more than one empty space, it automatically corrects the error after saving the document.
Regarding "misspelling", if there are two repeated words one after the other in a paragraph, for example, the duplicated word is considered as misspelled instead of being recognized as a duplicate. Is this the scenario you are referring to ?
Best Regards,
Cosmin
For the use case where there are two white spaces instead of one, Web Author automatically detects the empty spaces, and if there is more than one empty space, it automatically corrects the error after saving the document.
Regarding "misspelling", if there are two repeated words one after the other in a paragraph, for example, the duplicated word is considered as misspelled instead of being recognized as a duplicate. Is this the scenario you are referring to ?
Best Regards,
Cosmin
Cosmin Eftenie
www.oxygenxml.com
www.oxygenxml.com
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Re: Create PopUp Menu Customizer
Hello Cosmin,
Not only this scenario, we have a lot of rules for Misspelling, Grammar and style errors.
We are not looking for an other solution, we want to implement our own solution.
And for that we need to customize the pop up menu, like we have done before we the oxygen sdk and the classe : AuthorPopupMenuCustomizer
Regards,
Isabelle
Not only this scenario, we have a lot of rules for Misspelling, Grammar and style errors.
We are not looking for an other solution, we want to implement our own solution.
And for that we need to customize the pop up menu, like we have done before we the oxygen sdk and the classe : AuthorPopupMenuCustomizer
Regards,
Isabelle
-
- Site Admin
- Posts: 172
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Create PopUp Menu Customizer
Post by Bogdan Dumitru »
Hi Isabelle,
There is no dedicated API that you can use but you might be able to implement your use-case using the non-persistent highlight API.
Render non-persistent highlights for spelling errors with the error type specified as highlight additional data, see the example from this post: "highlighter.addHighlight(startOffset, endOffset, null, attrs)" that adds a custom class.
Then add actions in the contextual menu that get enabled depending on the highlight present on the caret position.
There is no dedicated API that you can use but you might be able to implement your use-case using the non-persistent highlight API.
Render non-persistent highlights for spelling errors with the error type specified as highlight additional data, see the example from this post: "highlighter.addHighlight(startOffset, endOffset, null, attrs)" that adds a custom class.
Then add actions in the contextual menu that get enabled depending on the highlight present on the caret position.
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
-
- Posts: 168
- Joined: Fri Jan 20, 2017 1:11 pm
Re: Create PopUp Menu Customizer
Hello Bogdan,
For information, the link you gave does not work.
Thanks,
Regards,
Isabelle
For information, the link you gave does not work.
Can you tell me more on how can I add actions dynamically in contextual menu.Bogdan Dumitru wrote: ↑Tue Nov 21, 2023 6:19 pm Then add actions in the contextual menu that get enabled depending on the highlight present on the caret position.
Thanks,
Regards,
Isabelle
-
- Site Admin
- Posts: 172
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Create PopUp Menu Customizer
Post by Bogdan Dumitru »
Hi,
Sorry about the broken link. The correct link is: viewtopic.php?p=72796#p72796
And here you can find a tutorial that shows how to add actions, look for addToContextMenu: https://www.oxygenxml.com/maven/com/oxy ... ction.html
Sorry about the broken link. The correct link is: viewtopic.php?p=72796#p72796
And here you can find a tutorial that shows how to add actions, look for addToContextMenu: https://www.oxygenxml.com/maven/com/oxy ... ction.html
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service