We use cookies to make our website more effective. By using our website you agree to our privacy policy.

Namespace: events

events

events.js is part of Aloha Editor project http://www.alohaeditor.org

Aloha Editor ● JavaScript Content Editing Library
Copyright (c) 2010-2015 Gentics Software GmbH, Vienna, Austria.
Contributors http://www.alohaeditor.org/docs/contributing.html
See:

Methods

add(obj, event, handler, opt_useCapture)

Registers an event listener to fire the given callback when a specified
event is triggered on the given object.
Name Type Description
obj Element | Document | Window Object which supports events. This includes DOM elements, the Document itself, and the Window object for example.
event string Name of the event for which to register the given callback.
handler function Function to be invoked when event is triggered on the given object.
opt_useCapture boolean optional Optional. Whether to add the handler in the capturing phase.

dispatch()

This function is missing documentation.
TODO
  • Complete documentation.

hasKeyModifier(event){boolean}

Given an event object, checks whether the ctrl key is depressed.
Name Type Description
event Event

is(obj){boolean}

Returns true if the given value is a native browser event object.
Name Type Description
obj *

isSelectionEvent(obj){boolean}

Returns true if the given value is a Selection Event object as created by
aloha.selections.selectionEvent.
Name Type Description
obj *

nextTick(fn)

Runs the given function after the current event handler returns
to the browser.

Currently implemented just with setTimeout() which is specced to
have a minimum timeout value of 4 milliseconds. Alternate
implementations are possible that are faster, for example:
https://github.com/NobleJS/setImmediate
Name Type Description
fn function a function to call

preventDefault(event)

Flags the given event to prevent native handlers from performing default
behavior for it.
Name Type Description
event Event

remove(obj, event, handler, opt_useCapture)

Detaches the specified event callback from the given event.
Name Type Description
obj Element | Document | Window Object which supports events. This includes DOM elements, the Document itself, and the Window object for example.
event string Name of the event to detach.
handler function Function to be de-registered.
opt_useCapture boolean optional Optional. Must be true if the handler was registered with a true useCapture argument.

setup(editor, doc)

Sets up all editing browser events to call `editor` on the given
document.
Name Type Description
editor function
doc Document
See:

stopPropagation(event)

Stops this event from bubbling any further up the DOM tree.
Name Type Description
event Event

suppress(event)

"Suppresses" the given event such that it will not trigger default
behavior and nor propagate. This will prevent any parent handlers up of
the DOM tree from being notified of this event.
Name Type Description
event Event
comments powered by Disqus