Search code examples
asp.netfreetextbox

FreeTextBox duplicates pasted content


I am using a FreeTextBox:

<FTB:FreeTextBox ID="txtFreeTextBox" RemoveServerNameFromUrls="false" ToolbarLayout="ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu|Bold,Italic,Underline,Strikethrough;Superscript,Subscript,RemoveFormat|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList,Indent,Outdent;CreateLink,Unlink,InsertImageFromGallery,InsertRule,InsertTable|Cut,Copy,Paste;Undo,Redo,Print" runat="Server" Width="100%" BackColor="239,239,240"ImageGalleryUrl="../../ftb.imagegallery.aspx?rif=Public/RootImages/&cif=Public/RootImages/">
</FTB:FreeTextBox>

The problem is that when I paste into it, it pastes it two times. Is there something to solve this?


Solution

  • I had been experiencing this problem when using IE9 with the Browser Mode set to Internet Explorer 9 (it worked correctly in IE9 Comp View). The fix I found was to override the default CancelEvent function in my page's html. I added this right above the closing body tag:

    <script type="text/javascript">
        FTB_FreeTextBox.prototype.CancelEvent = function (ev) {
            try{
                ev.preventDefault();
                ev.stopPropagation();
            }
            catch (e) {
                if (FTB_Browser.isIE) {
                    ev.cancelBubble = true;
                    ev.returnValue = false;
                }
            }
        };
    </script>
    

    Hopefully it works for you too!