Context Menu on Right Mouse Button

35 views
Skip to first unread message

tom

unread,
Jan 18, 2011, 3:39:49 AM1/18/11
to ModelText
I'm displaying a context menu when the right mouse button is clicked.
Unfortunately, the right button collapses the user's selection. Is
there any way around this?

While I'm at it: I'm using the keyup and keypress event handlers to do
some formatting when the user enters specific characters, as you
suggest in http://www.modeltext.com/html/user-interfaces.aspx#extending.
In some cases, I'm joining two adjacent nodes by replacing them with a
single new node with the combined text. I'm having trouble getting the
caret back to the previous position via the range/container/offset
model so that the user can type without interruption. Would it be
possible to simply get/set the absolute position of the insertion
point in characters - independent of the underlying DOM model?

Thanks
Tom

Christopher Wells

unread,
Feb 2, 2011, 2:12:43 AM2/2/11
to ModelText, anta...@googlemail.com
Hello Tom,

I have just released a new build: in this release the control's
selection changes only when the left mouse button is pressed (not when
the right mouse button is pressed).

The new release also supports the preventDefault method of mouse event
instances: so you can even prevent the selection changing when the
left mouse button is pressed.

Regards,
Christopher Wells


On Jan 18, 3:39 am, tom <antaeu...@googlemail.com> wrote:
> I'm displaying a context menu when the right mouse button is clicked.
> Unfortunately, the right button collapses the user's selection. Is
> there any way around this?
>
> While I'm at it: I'm using the keyup and keypress event handlers to do
> some formatting when the user enters specific characters, as you
> suggest inhttp://www.modeltext.com/html/user-interfaces.aspx#extending.

Christopher Wells

unread,
Feb 2, 2011, 2:16:32 AM2/2/11
to ModelText, anta...@googlemail.com
Hello Tom,

I added some new code to the FileOpenAndSave sample program, as an
example of an application-defined edit to the DOM.

The code is invoked from a new "Edit/Merge Paragraphs" menu item: it
merges the user-selected block-level elements (paragraphs) with the
previous block in the document.

Anyway, this new sample code includes a new OffsetInElement class:
look at how this OffsetInElement class is implemented and used, to
maintain the apparent selection even across a transaction which
removes the selected nodes from the document.

Regards,
Christopher Wells


On Jan 18, 3:39 am, tom <antaeu...@googlemail.com> wrote:
> I'm displaying a context menu when the right mouse button is clicked.
> Unfortunately, the right button collapses the user's selection. Is
> there any way around this?
>
> While I'm at it: I'm using the keyup and keypress event handlers to do
> some formatting when the user enters specific characters, as you
> suggest inhttp://www.modeltext.com/html/user-interfaces.aspx#extending.
Reply all
Reply to author
Forward
0 new messages