Wednesday, June 23, 2010

Re: Disable the default contextmenu in richtext editor

You are on the right track with these:
event.preventDefault();
event.stopPropagation();

But firstly, are you clear about the difference between a "Click"
event and Event.ONCONTEXTMENU?

You may be trying to suppress the click event, but you really need to
1) sink the context menu event, and 2) prevent default actions...

myElement.sinkEvents(Event.ONCONTEXTMENU)

... followed by...

event.preventDefault();
event.stopPropagation(); (this might not even be necessary)

... should do it.

<wild speculation>
If not, then another idea is that the rich text area is probably using
an IFrame, am I right? If so it may be the case that the events
belonging to *this* window, and the events belonging to the IFrame are
handled in different places.
</wild speculation>


On Jun 22, 4:56 pm, shruti <shrutiredd...@gmail.com> wrote:
> Hi,
>
> I have created my own popup menu, which I want to display in
> RichTextArea,
> and it is appearing with right mouse click. my problem is that
> default
> broswer's context menu does also appear along with my menu. is there
> any
> resolution for this?
> I have seen lots of examples and code but all of them were disabling
> broswer's default menu that shows View Source and other options, I do
> not
> want to disable it, rather my point is to disable the context menu
> which
> appears in text fields or rich text areas.
>
> i tried with different options as specified in the forums:
> event.preventDefault();
> event.stopPropagation();
>
> I would be grateful, is there anyone help me out....
>
> Thanks & regards,
> Shruti

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment