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

Namespace: selections

selections

selections.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

Methods

Context(doc){Object}

Creates a new selection context.

Will create a DOM element at the end of the document body to be used to
represent the caret position.
Name Type Description
doc Document

focus(boundary)

Ensures that the given boundary is visible inside of the viewport by
scolling the view port if necessary.
Name Type Description
boundary Boundary

is(obj){boolean}

Returns true if obj is a selection as returned by a selection context
object.
Name Type Description
obj *

is(obj){boolean}

Returns true if the given value is a Range object as created by
document.createRange()
Name Type Description
obj *

middleware(event){AlohaEvent}

Updates selection
Name Type Description
event AlohaEvent

select(selection, start, end, focus){Selection}

Selects the given boundaries and visualizes the caret position.

Returns the updated Selection object, that can be reassigned to
aloha.editor.selection
Name Type Description
selection Selection
start Boundary
end Boundary
focus string optional optional. "start" or "end". Defaults to "end"

selectionEvent(editor, event){AlohaEvent}

Creates an event object that will contain the following properties:


type
nativeEvent
editable
selection
dnd
preventSelection
Name Type Description
editor Editor
event Event

show(caret, boundary)

Renders the given element at the specified boundary to represent the
caret position.
Name Type Description
caret Element
boundary Boundary
comments powered by Disqus