dortonway
dortonway

Reputation: 439

JS extension to highlight text in Alfresco document

When a document is opened, I want to accomplish the ajax-request with document text, get response and highlight words in document, which are specified in the response.

Is it possible to accomplish through Alfresco API?

So I just want to know: is it possible to inject my javascript code to document page and how to do that in Alfresco 5.2?

Thanks.

Upvotes: 0

Views: 281

Answers (1)

Vikash Patel
Vikash Patel

Reputation: 1346

This is my gitlab project to highlight searched text from Site Search dashlet and from advance search page. Please override <alf_home>\tomcat\webapps\share\components\preview\PdfJs.js this file with PdfJs-highlight-query.js

What is does if url contains query parameter like this http://localhost:8081/share/page/document-details?nodeRef=workspace://SpacesStore/10df24c1-8f2e-4f76-ab52-33b85fe6e26d&query=abc

Then if the following document contains abc then all the abc text will get hilighted

Alfresco have functionality to inline search text from within the repository documents and search the text from a document and highlight the all available text from within the document .

So for that you need to first search your document and you have to make manually search for the required text in the document .

What we have implemented is that you have to search for the required document and list of results will appear and after clicking on the document , document details page will get open and the all searched text will get highlighted within the document previewer.

This will remove your extra required click and enter search text again.

Click on search results and document details page will get open and will highlight the document previewer within available document text.

Upvotes: 2

Related Questions