Global

Type Definitions

ExtensionPriority

Extension point process order.

Type:
  • module:ft/core/extensions.PriorityNormal | module:ft/core/extensions.PriorityFirst | module:ft/core/extensions.PriorityLast | Number

forEachNodeInSetCallback(each)

A callback for processing each node in a set.

nodeset.forEachNodeInSet(function (eachNode) {
    console.log(eachNode.text());
});
Parameters:
Name Type Description
each module:ft/core/node.Node

Each node in the set.

forEachNodeInRangeCallback(node, line, location, length, fullySelected)

A callback for processing each line in a range.

range.forEachNodeInRange(function (node, line, location, length, fullySelected) {
    console.log(eachNode.text());
});
Parameters:
Name Type Description
node module:ft/core/node.Node

Each node.

line Number

Line number.

location Number

Node relative range start location.

length Number

Node relative range length.

fullySelected Boolean

True if the node is fully selected by the range.

LineChar

A location represented by a line number and a character offset into that line.

Type:
  • Object
Properties:
Name Type Description
line Number

Zero based line number.

ch Number

Zero based character offset into the line.

Rect

A rectangle.

Type:
  • Object
Properties:
Name Type Description
top Number
bottom Number
left Number
right Number
width Number
height Number

KeyMap

Key maps are ways to associate keys with functionality. A key map is an object mapping strings that identify the keys to functions that implement their functionality.

This editor uses the CodeMirror key map implementation with two changes:

  1. CodeMirror keymaps pass a CodeMirror instance as the first parameter to callback functions, while FoldingText key maps pass the FoldingText editor instance.

  2. FoldingText keymaps will first try to perform any named command declared in the FoldingText editor. If no matching command is found then commands declared at the CodeMirror level will be tried.

Type:
  • Object
Properties:
Name Type Argument Description
name string <optional>

Command

Command declared in the editor using the 'com.foldingtext.editor.commands' extension point.

Type:
  • Object
Properties:
Name Type Description
name String

Command's name.

description String

Command's description.

TargetResult

Type:
  • Object
Properties:
Name Type Description
node module:ft/core/node.Node
lineCh LineChar
attributes Object

RenderLineWidgetOptions

Options control how line widgets get displayed.

The options are the same as the options describe in CodeMirror's addLineWidget feature with two additions:

  1. overlay - A boolean, if given a value of true then the widget will draw over the node's line instead of getting inserted before or after it.

  2. positionWidget - A function that takes widgets calculated width and heigh as parameters and returns and object with (all optional) top, bottom, left, and right style properties. This function gives the widget renderer the opportunity to precisely position the widget after the node's text has been inserted into the node's DOM element.

Type:
  • Object