Free Support Forum - groupdocs.com

Replace text covers part of the original document and unable to make comment under it


#1

Hello,


We want to be able to also comment on the text under the replace tool.

What are your suggestions to enable this?

Please see attached.

I am thinking to drive this from the UI . Your suggestions are most appreciated.

Thanks.

Leo

#2

Hi Leo,


Yes, you can achieve that. You just to do next in BLOCKED SCRIPT
1. When document loaded get all text replace elements
$(".replace_tab") - it will be all these orange elements
2. By using .each method set onClick function
$(".replace_tab").each(function (index) {
$(this).on(“click”, function () {
//do something here
});
});

3. and inside this onClick function you should check CSS “display” value of the “.doc_text_area_text mousetrap” element (text input part) and set it from “block” to “none” and back on next click.

This logic will hide/show text input part of the annotation on click on the orange part with “Replace” text

Best regards.

#3

Thanks, Pavel.


Will try this out. But will other users be able to make annotations to the text itself?

Regards,


Leo

#4

Hi Pavel,


I integrated the onClick event when the document is loaded but it is not firing the event.

Please see attached screenshot.

I suspect that the click registration is too early as I noticed that the thumbnails are still loading as soon as the document ready is invoked.

Is there any other event that I can use? Or what I am doing wrong here?

Thanks.


Leo

#5

Hi Leo,


Yes, this event doesn’t firing because elements on which you set “onClick” event doesn’t loaded yet. The simplest way is to add time delay for a few seconds. Please check this code example:
$(document).ready(setTimeout(function () {
$(".replace_tab").each(function (index) {
$(this).on(“click”, function () {
//do something here
});
});
}, 5000));

In this example I set 5 second time delay for the function which will be called on document ready.

Best regards.

#6

I did implement but found a couple of limitations where it is only enabled for previously crated but not the ones being added.


Can we inject the click event as the user highlights a text to be replaced? We are able to look a little bit more into the call stack and it looks like the “onTextSelected” mayb e a good candidate where we can add our customer event. Something atomic enough that the event is injected just-in-time.

Also, this will only work for previously added replace text entry. New ones added by the current user will not have this event.

This does not seems to be an optimized approach. Documents that we use take roughly around 45-55 pages. Depending on the environment, (latency, network speed, machine’s capacity) 5 seconds could either be too fast or too slow.

Greatly appreciate your help.


Thanks.


Leo




#7

After a few trial and error, I settled with attaching to the mouseup event.


It would be great though if you can provide us an API in GroupDocs where we can attach custom events.



#8

Hi Leo,


Glad to hear that you have found more suitable solution. I will also create a ticket for this and our product team will check if it will be possible to add such feature. Unfortunately I can share any estimate for this and could be (more likely) that it will be in the brand new annotation.

Thank you.