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 EditorView
s that are contained in another EditorView
by virtue of being in Attachment
s, all the EditorView
s sharing the same
context automatically share the EditorCommandExecutor
. i.e. the EditorCommandExecutor
operates on only those EditorView
s which have the same
context as provided to the EditorCommandExecutor
.
-
Identifies the
EditorViewContext
uniquely.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 byid
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 onEditorView
which works at local level for theEditorView
. If you are interested in certainEditorViewDelegate
events for all the editors sharing the same context e.g. an Editor with nested Editors sharing the same context.Note
If theEditorView
is instantiated without providing an explicit context,delegate
can be set onEditorViewContext.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.