Text selet/insert box?
Post here questions and problems related to oXygen frameworks/document types.
Text selet/insert box?
Hello,
What is the name of a pop-up box like the one used for inserting tags? This one:
Does it have an API?
Can it stay open while a user is typing?
Can it have an event listener, to keep track of what they are typing?
Can it talk so a REST service, which would be used to populate it with text they might choose to insert?
Thank you,
Will
What is the name of a pop-up box like the one used for inserting tags? This one:
- image.png (11.16 KiB) Viewed 1547 times
Can it stay open while a user is typing?
Can it have an event listener, to keep track of what they are typing?
Can it talk so a REST service, which would be used to populate it with text they might choose to insert?
Thank you,
Will
-
- Posts: 1007
- Joined: Wed Nov 16, 2005 11:11 am
Re: Text selet/insert box?
Post by alex_jitianu »
Hello,
This is the content completion window and it's not accessible though the API. If you can tell me more about what you are after, the use case, then perhaps I can offer an alternative solution.
Best regards,
Alex
This is the content completion window and it's not accessible though the API. If you can tell me more about what you are after, the use case, then perhaps I can offer an alternative solution.
Best regards,
Alex
Re: Text selet/insert box?
Hi Alex,
What we are hoping to do is something like this.
We already have a machine learning model that suggests words based on other words exposed through a REST API. We send it some words, and it returns some suggestions for the next word.
We would like to have a text select box that floats over the editing area while the writer types - and while the writer types, that box keeps track of what the writer is typing, sends that information to the REST API, then displays the text results that are returned, which the writer can then click on to insert into the text, if they see the word they need.
A simple example might look something like this:
The box would be opened or closed based on a selection in the right-click menu.
Is there an oXygen API that would support that behavior?
Thank you for any ideas you might share,
Will
What we are hoping to do is something like this.
We already have a machine learning model that suggests words based on other words exposed through a REST API. We send it some words, and it returns some suggestions for the next word.
We would like to have a text select box that floats over the editing area while the writer types - and while the writer types, that box keeps track of what the writer is typing, sends that information to the REST API, then displays the text results that are returned, which the writer can then click on to insert into the text, if they see the word they need.
A simple example might look something like this:
- image.png (14.49 KiB) Viewed 1522 times
Is there an oXygen API that would support that behavior?
Thank you for any ideas you might share,
Will
-
- Posts: 1007
- Joined: Wed Nov 16, 2005 11:11 am
Re: Text selet/insert box?
Post by alex_jitianu »
Hi,
It can be done through our Java-based API as a plugin. Here are a few ideas:
1. You need a Workspace Access plugin. A good starting point is available on GitHub.
2. I think it would be easier to present these proposals in a custom side view
3. We have API to listen for editing events. The GitHub sample project demonstrates how to set a ro.sync.exml.workspace.api.listeners.WSEditorChangeListener. In its editorOpened() callback, you can get the text typed so far by the user in fashion similar to this.
4. You can add an action in the contextual menu. This action will activate/deactivate the entire functionality. The sample project from GitHub has a sample code that contributes action into the contextual menu. The method of interest is customizePopupMenu()
When you start working on it, please let me know and perhaps I can give more help. For example you should use a coalescing mechanism to avoid doing this processing in excess.
Best regards,
Alex
It can be done through our Java-based API as a plugin. Here are a few ideas:
1. You need a Workspace Access plugin. A good starting point is available on GitHub.
2. I think it would be easier to present these proposals in a custom side view
3. We have API to listen for editing events. The GitHub sample project demonstrates how to set a ro.sync.exml.workspace.api.listeners.WSEditorChangeListener. In its editorOpened() callback, you can get the text typed so far by the user in fashion similar to this.
Code: Select all
@Override
public void editorOpened(URL editorLocation) {
WSEditor editorAccess = pluginWorkspaceAccess.getEditorAccess(editorLocation, PluginWorkspace.MAIN_EDITING_AREA);
editorAccess.addEditorListener(new WSEditorListener() {
@Override
public void editorPageChanged() {
install(editorAccess);
}
});
install(editorAccess);
}
private void install(WSEditor wsEditor) {
if (wsEditor.getCurrentPageID() == EditorPageConstants.PAGE_AUTHOR) {
WSAuthorEditorPage authorPage = (WSAuthorEditorPage) wsEditor.getCurrentPage();
AuthorDocumentController documentController = authorPage.getAuthorAccess().getDocumentController();
documentController.addAuthorListener(new AuthorListenerAdapter() {
public void contentInserted(DocumentContentInsertedEvent e) {
String insertedText = e.getInsertedText();
int offset = e.getOffset();
try {
AuthorNode nodeAtOffset = documentController.getNodeAtOffset(offset);
TextContentIterator textIterator = documentController.getTextContentIterator(nodeAtOffset.getStartOffset(), offset + insertedText.length());
while (textIterator.hasNext()) {
TextContext next = textIterator.next();
}
} catch (BadLocationException e1) {
e1.printStackTrace();
}
}
});
}
}
When you start working on it, please let me know and perhaps I can give more help. For example you should use a coalescing mechanism to avoid doing this processing in excess.
Best regards,
Alex
Re: Text selet/insert box?
Hi Alex,
Thank you very much for such excellent ideas!
We already have a Workspace plugin, so that's one requirement met.
I will study what you've sent for custom side view and WSEditorChangeListener, and see what we can do.
I really appreciate your input, and will come back here with questions as we start to work on this.
Have a good one,
Will
Thank you very much for such excellent ideas!
We already have a Workspace plugin, so that's one requirement met.
I will study what you've sent for custom side view and WSEditorChangeListener, and see what we can do.
I really appreciate your input, and will come back here with questions as we start to work on this.
Have a good one,
Will
Return to “SDK-API, Frameworks - Document Types”
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