We are using igHtmlEditor 14.1.20141.1020 in an ASP.NET MVC application. Loading is done as shown below in a .cshtml file:
$.ig.loader({ scriptPath: "@Url.Content("~/js/infra/")", cssPath: "@Url.Content("~/css/third-party/infra/")", resources: "igHtmlEditor" });
$.ig.loader(function () {$('#@ViewBag.HtmlEditorId').igHtmlEditor({ inputName: "Post", width: "98%", height: "48em", showInsertObjectToolbar: false, customToolbars: GetCustomToolbar() });
When executing thr above, the following error is thrown in infragistics.ui.htmleditor.js:
this.workspace.contentWindow.document.execCommand("styleWithCSS", showUI, comandValue); // Line 913
Can someone please help us in resolving the issue?
Thanks.
Hello Furqan,
execCommand("styleWithCss") is a standard JavaScript function that is used when a document is switched to designMode or when using contentEditable. In this instance we are telling the iframe that is the main editor of the control that it should have contentEditable=true and that it should use style attributes in markup for any styling that is applied. This really shouldn't cause any conflict in Firefox as the browser is compatible with this function.
Do you see anything in the sample that I provided that is a radical departure from how you have implemented the control? Would you be able to send me a sample that reproduces the behavior?
Hi Jason,
We are using the below code to set the content:
$('#HtmlEditorId').igHtmlEditor("setContent", value, "html");
The above method is called after getting the response from server.
Actually, the loading code is what is throwing the exception which is invoked before the call to get the content from the server. So not sure if loading the content is the issue.
The sample you have provided is working fine in firefox.
What does the styleWithCSS command is doing and why is it failing? Is it an issue with any css not being available?
Thanks,
Furqan
If you want to set the content of the igHtmlEditor it is recommended to go through the editor's API and use the setContent method. Is there a reason you are setting the content on the iframe directly?
I attempted to follow a similar approach but used the setContent method. If you run the sample I have attached with this update are you able to reproduce the error you encounter in Firefox? If my sample is not a good representation of your implementation please feel free to modify the sample and send it back.
In GetCustomToolbar , for this particular scenario we are returning an empty array since we dont have any custom toolbar to be displayed. I have removed the call and the error is still reproducible.
This is how we are inserting content:
$.ajax({ url: url, cache: false, data: { ..some data }, success: function (result) { document.getElementById(iframeId).contentWindow.SetContent(result); }, failure: function (result) { } });
thanks,
Furqan,
What are you doing in the GetCustomToolbar function and how are you inserting content in to the HTML editor? So far everything I see here looks pretty standard and should work without issue. My thoughts is that most likely something is happening in that call to GetCustomToolbar(). If you remove that call do you still get the exception?