Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    RichTextEditor Event.ONPASTE Workaround for Firefox, HTML/CSS mode

    SmartGWT 2.3 & 2.4

    Basically capturing the Event.ONPASTE for RichTextEditor does not work in Firefox. This is because Firefox does not support the paste event for editable content in an iframe (which RichTextEditor uses for editing).

    This is basically the code which I am using:
    Code:
    public class MyRichTextEditor extends RichTextEditor {
    	
        public MyRichTextEditor() {
            super();
            super.sinkEvents(Event.ONPASTE);
        }
    	
        @Override
        public void onBrowserEvent(Event event)
        {
            super.onBrowserEvent(event);
            switch (event.getTypeInt())
            {
                case Event.ONPASTE:
                {
                    Window.alert("Pasted event fired");
                    event.preventDefault();
                    // Code to handle event
                    break;
                }
            }
        }
    }
    I need an idea for a workaround to capture the ONPASTE event. Any ideas?

    I also need a way to tell the editor to use HTML mode and not CSS mode for Firefox. I assume that would involve dropping out to JavaScript somewhere. See this link about styleWithCSS in
    https://developer.mozilla.org/en/rich-text_editing_in_mozilla

    Thank you,
    Eric Murphy
    Booz Allen Hamilton

    #2
    Any ideas on that?

    Its useful to capture the paste event, to clean for example MS Word formatting. Maybe there's also another solution for this case?

    Comment


      #3
      It's been four years already. Did anybody found a good workaround for that? I'm trying to use onBrowserEvent exactly to remove some MS Word formatting but the method simply never gets called.

      Comment

      Working...
      X