OutlineEditor

Maps an Outline into an editable text buffer.

The outline editor maintains the hoisted item, folded items, filter path, and selected items. It uses this state to determine which items are displayed and selected in the text buffer.

Finding Outline Editors

.getOutlineEditors()

Retrieves all open OutlineEditor s.

Return Values
Returns an Array of OutlineEditor s.
.getOutlineEditorsForOutline(outline)

Return Array of all OutlineEditor s associated with the given Outline .

Argument Description
outline Edited Outline .

Outline

::outline

Outline that is edited.

State

::hoistedItem

Root of all items displayed in the text buffer.

::focusedItem

Focused item in the text buffer. Similar to ::hoistedItem , but the hoisted item is never displayed in the text buffer, while ::focusedItem is displayed (and temporarily expanded) to show any children.

::itemPathFilter

Item path formatted String . When set only matching items display in the text buffer.

Folding Items

::fold()

Toggle folding status of current selection.

::isExpanded(item)

Return true of the given item is expanded.

Argument Description
item Item to check.
::isFiltered(item)

Return true of the given item has some of its children visible and others hidden.

Argument Description
item Item to check.
::isCollapsed(item)

Return true of the given item is collapsed.

Argument Description
item Item to check.
::setExpanded(items)

Expand the given item(s).

Argument Description
items Item or Array of items to expand.
::setCollapsed(items)

Collapse the given item(s).

Argument Description
items Item or Array of items to collapse.

Displayed Items

::displayedItems

Array of visible Item s in editor (readonly).

::firstDisplayedItem

First displayed Item in editor (readonly).

::lastDisplayedItem

Last displayed Item in editor (readonly).

::isDisplayed(item)

Determine if an Item is displayed in the editor’s text buffer. A displayed item isn’t neccessarily visible because it might be scrolled off screen. Displayed means that its body text is present and editable in the buffer.

Argument Description
item Item to test.
Return Values
Returns Boolean indicating if item is displayed.
::forceDisplayed(item, showAncestors?)

Force the given Item to display in the editor’s text buffer, expanding ancestors, removing filters, and unhoisting items as needed.

Argument Description
item Item to make displayed.
showAncestors? Boolean defaults to false.
::forceHidden(item, hideDescendants?)

Remove the given Item (s) from display in the editor’s text buffer, leaving all other items in place.

Argument Description
item Item (s) to hide.
hideDescendants? Boolean defaults to false.
::getNextDisplayedItem(item)
Argument Description
item Item
Return Values
Returns next displayed Item relative to given item.
::getPreviousDisplayedItem(item)
Argument Description
item Item
Return Values
Returns previous displayed Item relative to given item.

Text Buffer

::textLength

Read-only text buffer Number length.

::getItemOffsetForLocation(location)

Translate from a text buffer location to an Item offset.

Argument Description
location Text buffer character Number location.
Return Values
Returns Object with item and offset properties.
::getLocationForItemOffset(item, offset)

Translate from item offset to the nearest valid text buffer location.

Argument Description
item Item to lookup.
offset Number offset into the items text.
Return Values
Returns text buffer character offset Number .
::getTextInRange(location, length)

Get text in the given range.

Argument Description
location Number character location.
length Number character range length.
::replaceRangeWithString(location, length, string)

Replace the given range with a string.

Argument Description
location Number character location.
length Number character range length.
string String to insert.
::replaceRangeWithItems(location, length, items)

Replace the given range with a items.

Argument Description
location Number character location.
length Number character range length.
items Array of Item s to insert.

Selection

::selection

Read-only Selection snapshot.

::moveSelectionToRange(focusLocation, anchorLocation?)

Set selection by character locations in text buffer.

Argument Description
focusLocation Selection focus character Number location.
anchorLocation? Selection anchor character Number location.
::moveSelectionToItems(headItem, headOffset?, anchorItem?, anchorOffset?)

Set selection by Item .

Argument Description
headItem Selection head Item
headOffset? Selection head offset index. Or undefined when selecting at item level.
anchorItem? Selection anchor Item
anchorOffset? Selection anchor offset index. Or undefined when selecting at item level.

Scrolling

::scrollBy(xDelta, yDelta)

Adjust ::scrollPoint by the given delta.

Argument Description
xDelta Number scroll point x delta.
yDelta Number scroll point y delta.
::scrollRangeToVisible(location, length)

Scroll the given range to visible in the text buffer.

Argument Description
location Number character location.
length Number character range length.
::getRectForRange(location, length)

Get rectangle for the given character range.

Argument Description
location Number character location.
length Number character range length.
Return Values
Returns Object with x, y, width, and height keys.
::getCharacterIndexForPoint(x, y)

Get character index for the given point.

Argument Description
x Number x position.
y Number y position.
Return Values
Returns Number character index.

Item Serialization

::serializeRange(location, length, options)

Get item serialization from the given range.

Argument Description
location Number character location.
length Number character range length.
options Serialization options as defined in ItemSerializer .

results matching ""

    No results matching ""