3

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?

Bart
  • 19,692
  • 7
  • 68
  • 77
bokkie
  • 1,477
  • 4
  • 21
  • 40
  • Just tried to parse in you're code and add newest version of FTB. Doesn't paste two times here... – Thomas Sep 20 '12 at 12:10
  • I have just tried it with rightclick and paste and that way it works fine, but with ctrl + v it doubles it – bokkie Sep 24 '12 at 12:01

1 Answers1

3

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!

Peter Mourfield
  • 1,885
  • 1
  • 19
  • 38
  • I think I will need a little help as my knowledge of javascript is close to 0 :). I have tried your code, but instead of FTB_FreeTextBox I used FTB:FreeTextBox, it sais FreeTextBox is undefined. Inside the FreeTextBox there is no OnCancel that I could use. I don't have body tags as I am using a masterpage, so I have Contents, and I am using an UpdatePanel too. Could you please tell me how to approach this? thanks – bokkie Sep 24 '12 at 12:13
  • This JavaScript gets rendered out by the control at run-time. Since you are using a MasterPage I would try putting the code right about the tag on your view page. – Peter Mourfield Sep 24 '12 at 14:26
  • I don't know who FTB_FreeTextBox is...is it the name of the control when it is rendered? cause when I inspect the element with chrome it doesn't appear as a control, but as 5 divs, each with different IDs:content_content_txtFreeTextBox_designEditorArea and so on. If I leave it FTB_FreeTextBox it sais it is undefined. – bokkie Sep 25 '12 at 15:00
  • FreeTextBox emits this global javascript as a part of the WebResource.axd. You can see this by using your browsers developer tools (FireBug for FireFox, F12 for IE). This solution works for me by placing the code at the bottom of the aspx file. You situation is different so if you are using jQuery you may want to wrap this override in a $(document).ready() call so that the override isn't attempted until the DOM is loaded. – Peter Mourfield Sep 27 '12 at 14:07
  • Dumb question here but why not change the FTB-FreeTextBox.js file to match your code? I see this code in the FTB=FreeTextBox.js FTB_FreeTextBox.prototype.CancelEvent = function(ev) { if (FTB_Browser.isIE) { ev.cancelBubble = true; ev.returnValue = false; } else { ev.preventDefault(); ev.stopPropagation(); } }; – OutOFTouch Dec 22 '14 at 15:09