EditorViewContext

public class EditorViewContext

Describes the context for the EditorView. A context is used to execute the commands using EditorCommandExecutor. In a typical scenario, where there are multiple levels of EditorViews that are contained in another EditorView by virtue of being in Attachments, all the EditorViews sharing the same context automatically share the EditorCommandExecutor. i.e. the EditorCommandExecutor operates on only those EditorViews which have the same context as provided to the EditorCommandExecutor.

  • id

    Identifies the EditorViewContextuniquely.

    Declaration

    Swift

    public let id: String
  • Friendly name for the context. It is possible to create multiple EditorViewContext using the same name. A context is uniquely identified by id and not the name.

    Declaration

    Swift

    public let name: String
  • EditorView delegate at context level. This delegate will be notified about events in all the Editors that share this particular context. This is in addition to the delegate available on EditorView which works at local level for the EditorView. If you are interested in certain EditorViewDelegate events for all the editors sharing the same context e.g. an Editor with nested Editors sharing the same context.

    Note

    If the EditorView is instantiated without providing an explicit context, delegate can be set on EditorViewContext.shared which is the default context for all the editors.

    Declaration

    Swift

    public weak var delegate: EditorViewDelegate?
  • Default shared context. Use this in case there is only a single EditorView on the screen at the root level.

    Declaration

    Swift

    public static let shared: EditorViewContext
  • EditorView for this context that is currently active.

    Declaration

    Swift

    public var activeEditorView: EditorView? { get }
  • EditorView for this context that is currently selected. An editor is selected when in any of the following states even if it is read-only:

    • Gets focus
    • Selected range is changed to non-nil value
    • Is tapped on

    Declaration

    Swift

    public var selectedEditorView: EditorView? { get }
  • Initializes a new context

    Declaration

    Swift

    public convenience init(name: String)

    Parameters

    name

    Friendly name for the context.