I have a WebHtmlControl on a page and some existing code to check if the text of the control has changed. This is done by simply storing the original value when the form loads and comparing it to the current value using the KeyDown and AfterAction client side events.
I have recently enabled the HTML Editor feature and included more toolbar options and now have an issue where changing the styling, ie: highlighting text and changing the text colour, is not detected. This is because the text hasn't changed, just the markup.
I have implemented a similar piece of code that stores the value in document.getElementById("txtEmailHTMLBody_tw").innerHTML when loaded and compares this using the same actions defined above.
The problem i have is that the comparison does not evaluate as expected as it appears the styling/markup has not yet changed, ie: the AfterAction fires before modifying the innerHTML property.
Is there another way of doing this? It has to be client side and i'm using version 11.1.20111.2135.
Thanks in advance.
Hi Warwick IC Sytemst Ltd,
Thank you for posting in the community.
Note that the current html markup in the editor may be accessed on the client by using something similar to:
iged_getById("WebHtmlEditor1").getText();
As you have noted, the markup in the HTMLEditor is not changed in time on AfterAction. I can therefore suggest that you use the setTimeout javascript function in order to check for a change in the markup and execute some logic if needed. For instance:
function WebHtmlEditor1_AfterAction(oEditor, actID, oEvent, p4, p5, p6, p7, p8, act){ //log the markup in the editor in the browser console in 10 ms. setTimeout("console.log(iged_getById('WebHtmlEditor1').getText());",10);}
Hope this helps.
Hello,
Unfortunately, getText() does exactly that. It returns the text of the control, not the markup.
Also, I am already using a 100ms delay to resolve a previous issue I had.
Further investigation suggests that making some text bold or underlined works as expected - ie: can be seen by the AfterAction event. However, highlighting (fore colour) or modifying the text colour does not.
Is this not a bug?Thanks.
Hi Warwick,
Thank you for report.
There was an issue in WebHtmlEditor, which was missed while testing and nobody reported. It did not raise events related to content-change actions triggered by color-editor.
The difference between content of editor within AfterAction event and after delay, happened because application tested that output for the "ClosePopup" action (2nd parameter "actID" in handler). That functionality is correct, because closing popup notification/event is not related to changes of editor content.
That issue has been fixed and Before/AfterAction events for FontColor/FontHighlight will be raised.Note: events with same values of actID are also raised before color-editor is opened. In order to check, which event is raised before color editor is opened, and which is raised when color-editor is closed, an application may use 9th "act" parameter in event handler. If its value is equal to "pop", then it means open/pop action for color-editor. If that parameter is missing (null or undefined), then it means that color-editor is closed.