9

Closed

HtmlEditorExtender is breaking windows position

description

HtmlEditorExtender is breaking my application position by the code bellow. Some woraround can be made?

/// Wraps ASP.NET's WebForm_OnSubmit in order to encode tags prior to submission
this._editableDiv.focus();

Ps. See the "AceofSpades25" and "mronnlun" for the workaround.
Closed May 16, 2012 at 3:52 AM by Superexpert
This issue is fixed with May 2012 release.

comments

alexcheveau wrote Oct 27, 2011 at 6:07 PM

Any solution?!

Superexpert wrote Nov 18, 2011 at 4:39 AM

Can you please provide more information what you are trying to do? Also It will help a lot if you can provide sample code for the issue. This will help us to troubleshoot and fix the issue.

alexcheveau wrote Nov 18, 2011 at 10:10 AM

Superexpert, its simple: every time a page with HtmlEditorExtender is going to postback, the behavior of the component is to force focus in himself. This behavior is breaking my window position. That why the customer does not want to use this component anymore... thanks a lot

alexcheveau wrote Nov 25, 2011 at 12:28 PM

Note that this behavior ocours even if do not use postback (UpdatePanel async post-back)

alexcheveau wrote Jan 24, 2012 at 3:12 PM

Still causing trouble in my webpage... I observe that it is more problematic when you use UpdatePanels. How so? The editor makes a focus and not go back where the scroll position was before....

mronnlun wrote Mar 5, 2012 at 11:39 AM

We have a page with a HtmlEditorExtender. On the same page is an UpdatePanel with a listbox and a button. The HtmlEditorExtender is outside the UpdatePanel. When I click the button in the updatepanel the htmleditor forces focus to itself. This happens in file
// Name: HtmlEditorExtender.HtmlEditorExtenderBehavior.debug.js
// Assembly: AjaxControlToolkit
// Version: 4.1.51116.0
// FileVersion: 4.1.51116

In the code
_editableDiv_submit: function () {
var char = 3;
var sel = null;
this._editableDiv.focus();

Please fix this FAST!

AceofSpades25 wrote Mar 6, 2012 at 4:07 PM

Still happening.. Please fix this, this is urgent =/

mronnlun wrote Mar 7, 2012 at 6:26 AM

I put the following javascript on my master page and now it's working. This is the same code as in the function that steals focus, but with the focus-line omitted. It also checks that the required objects are available, i.e. htmleditorextender in use, so it can be put i a master page.
    if (Sys.Extended && Sys.Extended.UI && Sys.Extended.UI.HtmlEditorExtenderBehavior && Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype && Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype._editableDiv_submit) {
        Sys.Extended.UI.HtmlEditorExtenderBehavior.prototype._editableDiv_submit = function () {
            //html encode
            var char = 3;
            var sel = null;

            if (Sys.Browser.agent != Sys.Browser.Firefox) {
                if (document.selection) {
                    sel = document.selection.createRange();
                    sel.moveStart('character', char);
                    sel.select();
                }
                else {
                    sel = window.getSelection();
                    sel.collapse(this._editableDiv.firstChild, char);
                }
            }

            //Encode html tags
            this._textbox._element.value = this._encodeHtml();
        };
    }

AceofSpades25 wrote Mar 7, 2012 at 8:08 AM

Thanks mronnlun! I was ajust about to try overriding the function.

That works :)

alexcheveau wrote Mar 8, 2012 at 5:52 PM

Sorry for the dumb question, but, specifically where and when you put that code in master page? Doesnt work here....

AceofSpades25 wrote Mar 8, 2012 at 7:28 PM

Insert it with script tags at any point in the page AFTER your Ajax script manager

alexcheveau wrote Mar 9, 2012 at 4:32 PM

Thanks "AceofSpades25"
But the heart of the matter is: why the "focus" if its working without it?

alexcheveau wrote May 8, 2012 at 11:53 AM

Up

Sakou wrote Jun 26, 2012 at 9:44 AM

I have the same issue with a HtmlEditorExtender inside a TabContainer that contains an pudate panel where the textbox is.

I tried mronnlun's solution but it doesnt seem to go inside your function. I don't know if i put it in the wrong place. I put it juste before the textbox code and after the AjaxToolScript call.

Is there anything I should add in the HTML Extender code or the textbox or the AjaxToolScript?

Here is what my extender looks like :
<act:HtmlEditorExtender ID="htmlEditorExtender" TargetControlID="tbDemandeMedecin" runat="server" >
                                <Toolbar> 
                                    <act:Bold />
                                    <act:Italic />
                                    <act:Underline />
                                    <act:HorizontalSeparator />
                                    <act:Cut />
                                    <act:Copy />
                                    <act:Paste />
                                    <act:HorizontalSeparator />
                                    <act:Undo />
                                    <act:Redo />
                                    <act:HorizontalSeparator />
                                    <act:JustifyLeft />
                                    <act:JustifyCenter />
                                    <act:JustifyRight />
                                </Toolbar>    
                            </act:HtmlEditorExtender>

alexcheveau wrote Jun 26, 2012 at 12:26 PM

Sakou, use the last version of the project. Should work for you.