Page 1 of 1

Quick Find toolbar in Author Component

Posted: Tue Mar 18, 2014 6:30 pm
by david.badger
Hello,

We are using the oXygen Author Component v. 15.2 and have a requirement to show a simplified find dialog in the web editor. For the regular find/replace dialog, we map it to a toolbar button like this without a problem:

Code: Select all


      WSAuthorComponentEditorPage authorPage = (WSAuthorComponentEditorPage) editorComponent
.getWSEditorAccess().getCurrentPage();
Map<String, Object> authorCommonActions = authorPage
.getActionsProvider().getAuthorCommonActions();
ToolbarButton findReplaceButton = new ToolbarButton(
(Action) authorCommonActions.get("Find/Find_replace"), true);
However, I'm unable to find an action that toggles the Quick Find toolbar on and off in this manner. Is this possible in the Author Component?

If not, we will need to create our own simplified find dialog. Is there programmatic access to the internal oXygen find functions or a way to customize the existing find/replace dialog? Or will we need to use a custom dialog and findNodesByXPath to achieve something like this?

Thanks!

Re: Quick Find toolbar in Author Component

Posted: Wed Mar 19, 2014 11:14 am
by Radu
Hi David,

Unfortunately we do not yet have API which would allow you to create the quick find panel and add it to a panel for example. But we'll consider adding API for this, I will update this forum thread when this happens.
In the standalone version of Oxygen the Quick Find is a dockable toolbar and the applet does does not have support for dockable toolbars.

About this question:
Is there programmatic access to the internal oXygen find functions or a way to customize the existing find/replace dialog? Or will we need to use a custom dialog and findNodesByXPath to achieve something like this?
You have enough of API in Oxygen to create your own Find/Replace functionality but it is probably not an easy task to do. The "findNodesByXPath" will never return precise intervals in the text content inside of a node, it will return entire nodes when you are actually interested in text ranges.
The API method ro.sync.ecss.extensions.api.AuthorDocumentController.getTextContentIterator(int, int) might be more suitable for iterating over the text content starting from a certain offset (usually caret position) and searching for a certain string. After you find the string you can select it in the editor using API like WSAuthorEditorPageBase.select(int, int)

Regards,
Radu

Re: Quick Find toolbar in Author Component

Posted: Wed Mar 26, 2014 6:12 am
by david.badger
Hi Radu,

Thank you for the suggestion! We were able to implement a simplified find dialog using AuthorDocumentController.getTextContentIterator(int, int) and WSAuthorEditorPageBase.select(int, int). We also invoke WSAuthorEditorPageBase.scrollToRectangle(Rectangle) after selecting the text to make sure the user is able to see what is selected by the find operation.

Sincerely,
Dave