Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterTransformer ¶
RegisterTransformer registers a new step type.
Types ¶
type Applier ¶
type Applier interface { Apply(prosemirror.Node) (prosemirror.Node, error) json.UnmarshalerV1 json.MarshalerV1 }
Applier is an interface that all step types implement.
To register a new step type, you need to call RegisterTransformer with the step type and a function that returns a new instance of the step type.
type MarkStep ¶
type MarkStep struct { BaseStep Mark prosemirror.Mark `json:"mark"` // contains filtered or unexported fields }
func NewAddMarkStep ¶
func NewRemoveMarkStep ¶
func (*MarkStep) MarshalJSON ¶
func (*MarkStep) UnmarshalJSON ¶
type ReplaceAroundStep ¶
type ReplaceAroundStep struct { BaseStep GapFrom int `json:"gapFrom"` GapTo int `json:"gapTo"` Insert int `json:"insert"` Slice prosemirror.Slice `json:"slice"` Structure bool `json:"structure"` }
func (*ReplaceAroundStep) Apply ¶
func (s *ReplaceAroundStep) Apply(doc prosemirror.Node) (prosemirror.Node, error)
func (*ReplaceAroundStep) MarshalJSON ¶
func (s *ReplaceAroundStep) MarshalJSON() ([]byte, error)
func (*ReplaceAroundStep) UnmarshalJSON ¶
func (s *ReplaceAroundStep) UnmarshalJSON(data []byte) error
type ReplaceStep ¶
type ReplaceStep struct { BaseStep Slice prosemirror.Slice `json:"slice"` Structure bool `json:"structure,omitempty"` }
func (*ReplaceStep) Apply ¶
func (s *ReplaceStep) Apply(doc prosemirror.Node) (prosemirror.Node, error)
func (*ReplaceStep) MarshalJSON ¶
func (s *ReplaceStep) MarshalJSON() ([]byte, error)
func (*ReplaceStep) UnmarshalJSON ¶
func (s *ReplaceStep) UnmarshalJSON(data []byte) error
type Step ¶
type Step struct {
Impl Applier
}
Step is an abstract type that gets implemented by the various step types that we have. This is so that we can unmarshal the step without knowing what type it is, and then we can use the type to apply the step.
func (*Step) MarshalJSON ¶
func (*Step) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.