ProsemirrorEx.Transform.StepResult (prosemirror_ex v0.3.0)

Copy Markdown View Source

The result of applying a step. Contains either a new document or a failure value.

Ports StepResult from prosemirror-transform/src/step.ts.

Summary

Functions

Create a failed step result.

Call Node.replace with the given arguments. Create a successful result if it succeeds, and a failed one if it throws a ReplaceError.

Create a successful step result.

Types

t()

@type t() :: %ProsemirrorEx.Transform.StepResult{
  doc: ProsemirrorEx.Model.Node.t() | nil,
  failed: String.t() | nil
}

Functions

fail(message)

Create a failed step result.

from_replace(doc, from, to, slice)

Call Node.replace with the given arguments. Create a successful result if it succeeds, and a failed one if it throws a ReplaceError.

ok(doc)

Create a successful step result.