ListCommand

public class ListCommand : EditorCommand

Command that can be used to toggle list attributes of selected range of text. If the length of selected range of text is 0, the attributes are applied on the current line of text.

  • Undocumented

    Declaration

    Swift

    public init()
  • Name of the command

    Declaration

    Swift

    public var name: CommandName { get }
  • Value to be set for attribute .listItem when applying to a range of text. This value is returned back by ListFormattingProvider when querying list marker for a given index. This may be used to store info that helps generate appropriate markers for e.g. storing context related to bullet vs ordered lists.

    Note

    When set to nil before running execute, it removes list formatting from the selected range of text.

    Declaration

    Swift

    public var attributeValue: Any?
  • Executes the command with value of attributeValue for .listItem attribute. If the attributeValue is nil, executing removed list formatting from the selected range of text.

    Declaration

    Swift

    public func execute(on editor: EditorView)

    Parameters

    editor

    Editor to execute the command on.

  • Executes the command with value of attributeValue for .listItem attribute.

    Declaration

    Swift

    public func execute(on editor: EditorView, attributeValue: Any?)

    Parameters

    editor

    Editor to execute the command on.

    attributeValue

    Value of .listItem attribute. Use nil to remove list formatting.