EditorListFormattingProvider
public protocol EditorListFormattingProvider : AnyObject
Describes an object capable of providing style and formatting information for rendering lists in EditorView.
-
Line formatting to be used for a list item.
Declaration
Swift
var listLineFormatting: LineFormatting { get } -
Returns the marker to be drawn for list item (bullet/number etc.) for given parameters.
Note
This function is called multiple times for same index level based on TextKit layout cycles. It is advisable to cache the values if calculation/drawing is performance intensive.Declaration
Swift
func listLineMarkerFor(editor: EditorView, index: Int, level: Int, previousLevel: Int, attributeValue: Any?) -> ListLineMarkerParameters
editorEditor in which list marker is being drawn.
indexIndex of list item in the given list.
levelIndentation level of the list.
previousLevelPrevious indentation level. Using this, it can be determined if the list is being indented, outdented or is at same level.
attributeValueValue of list item attribute for given index. Nil if there is no content set in list item yet.
Return Value
Marker to be drawn for the given list item.
-
willChangeListIndentation(editor:Default implementationrange: currentLevel: indentMode: latestAttributeValueAtProposedLevel: ) Invoked before the indentation level is changed. This may be used to change the list attribute value, if needed.
Default Implementation
Declaration
Swift
func willChangeListIndentation(editor: EditorView, range: NSRange, currentLevel: Int, indentMode: Indentation, latestAttributeValueAtProposedLevel: Any?)Parameters
editorEditor in which indentation is going to be changed.
rangeRange of affected text
currentLevelCurrent nested level of list, with first level being 1.
indentModeIndentation action to be performed
latestAttributeValueAtProposedLevelList item attribute value immediately preceding the current item at the new level that the current item will be indented to. The value is
nilif preceding item does not exist at the new level.
View on GitHub
EditorListFormattingProvider Protocol Reference