Hello,
I have a WebHtmlEditor control (11.1) on my page and when using Design view and typing a url or email address it is auto converted and rendered (underlined).
When typing into the HTML view, the same does no happen (which is as expected), however, the URLs and email addresses are initially underlined and appear clickable when they aren't.
Moving to the Design view and then back to HTML removes the styling (again as expected).
I therefore have 2 questions:
1. Is there a way to prevent the automatic styling of URLs and email addresses in the HTML view?2. Is it possible to disable automatic converting in the design view and force users to use the toolbar icon?
Thanks
Hi Warwick,
If you find any other issues with this matter, please let me know.
Hi,
Thanks for the replies. The latest workarounds still had an issue when clicking outside the control if on the design view. I added similar code to first workaround, ie: oEditor._html && oEditor._ie and it seemed to work correctly.
This still needs to go through our QA process but hopefully everything will be fine.
Thanks.
Hello Warwick,
Please let me know if you have any other concerns.
In the first scenario you could you could use innerText instead of innerHTML in Victor’s code, in order to prevent the encoding of characters:
function WebHtmlEditor1_KeyDown(oEditor, keyCode, oEvent) {
if (oEditor._html && oEditor._ie && keyCode < 33) setTimeout(function () {
var elems = oEditor._elem.getElementsByTagName('A'), i = elems.length;
while (i-- > 0) {
var a = elems[i];
a.parentNode.replaceChild(document.createTextNode(a.innerText), a);
}
}, 5);
And here is a possible workaround for the second case you described:
document.onclick = function () {
var elems = iged_getById("WebHtmlEditor1")._elem.getElementsByTagName('A'), i = elems.length;
This should prevent the auto-styling in these particular scenarios.
If you have any further questions, please do not hesitate to ask.
Thanks for the reply, but this too unfortunately has some issues with it:
1. In HTML view type www.google.com2. The auto-styling is prevented (good)3. Then add (without any spaces) a <p> tag, ie: www.google.com<p>4. Now add (again without any spaces) www.google.com, ie: www.google.com<p>www.google.com5. Add a space to the end of the line (or a line feed)This now gets converted to www.google.com<p>www.google.com
There is also an issue using the mouse:
1. Add www.google.com to the first line of the HTML view2. Add a couple if line feeds3. Remove the m from the end of com and re-add it4. Now click anywhere inside the control
The auto-style returns. This disappears with the next keypress though.
Since this is inherent to the way IE is handling DIVs I suspect all workarounds will have these issues. I think this needs to be addressed as part of the controls foundation code - if possible.