Otzel.Op.Insert (otzel v0.3.2)

View Source

An operation that inserts new content at the current position.

Insert operations are the building blocks of documents in the delta format. A document is represented as a list of insert operations.

Fields

  • :content - The content to insert (string or embedded content)
  • :attrs - Optional map of formatting attributes

Examples

# Plain text insert
%Otzel.Op.Insert{content: "Hello", attrs: nil}

# Insert with formatting
%Otzel.Op.Insert{content: "Bold", attrs: %{"bold" => true}}

# Using helper function
Otzel.insert("Hello")
Otzel.insert("Bold", %{"bold" => true})

Summary

Types

t()

@type t() :: %Otzel.Op.Insert{attrs: Otzel.Attrs.t(), content: Otzel.Content.t()}

Functions

diff(left, right)

from_json(json, opts)

matching(c1, c2)

(macro)

merge_into(arg1, arg2)

Callback implementation for Otzel.Op.merge_into/2.

new(content, attrs, string_module)

size(insert)

Callback implementation for Otzel.Op.size/1.

take(insert, count)

Callback implementation for Otzel.Op.take/2.