Open rvveldhuyzen opened 4 years ago
Hi Erik, Again thank you for sharing this, I have also had the issue mentioned above, resolved by also adding back in InputArea.value = data; is this correct ?. Thanks Andrew
InputArea.value = data worked for me.
Thanks
I think it can also be fixed by setting the value using the OnAfterInit trigger:
usercontrol(Test; Wysiwyg)
{
ApplicationArea = All;
trigger ControlReady()
begin
CurrPage.Test.Init();
CurrPage.Test.Load('This is a <strong>BOLD</strong> statement!');
end;
//>>ADD THIS
trigger OnAfterInit()
begin
CurrPage.Test.Load('This is a <strong>BOLD</strong> statement!');
end;
//<<ADD THIS
trigger SaveRequested(data: Text)
begin
Message(data);
end;
}
erikk has posted a video on Youtube using this control: https://www.youtube.com/watch?v=GI37tlcrX6Y
Hi Erik,
First of all thank you for putting your time and effort in providing this nice example of how to integrate a small HTML Editor into BC!
I have been playing around with it and the example works fine as is. But afterI modified the CurrPage.Test.Load from hardcoded text to a text variable (or a field from a table) like:
the addin crashes with the following error (in Event Viewer):
"message": "Cannot read property 'setData' of undefined",
I have tried to find the cause. The only thing I found Googling around is that it could be a problem with Jquery but I have no idea what to do with this info and if this is true.
I also checked the history of your repository and noticed that you commited a change in the MainScript.js in the function Load:
After I reverted this change the CurrPage.TextEdit.Load worked fine with text coming from a variable.
Is there something I can do to prevent this error because there must be a good reason you decided to change Editor.setData instead of InputArea.value or was it just for the support of readonly?
Thank you in advance for your answer!