etherpad-lite/doc/api/changeset_library.md
Richard Hansen 4a8c72a38c Changeset: Minimize changeset docs, add links to code
This reduces the amount of duplicate documentation, and helps keep the
documentation and code in sync.
2021-10-24 21:29:42 -04:00

1.5 KiB
Raw Blame History

Changeset Library

The changeset library provides tools to create, read, and apply changesets.

Changeset

const Changeset = require('ep_etherpad-lite/static/js/Changeset');

A changeset describes the difference between two revisions of a document. When a user edits a pad, the browser generates and sends a changeset to the server, which relays it to the other users and saves a copy (so that every past revision is accessible).

A transmitted changeset looks like this:

'Z:z>1|2=m=b*0|1+1$\n'

Attribute Pool

const AttributePool = require('ep_etherpad-lite/static/js/AttributePool');

Changesets do not include any attribute keyvalue pairs. Instead, they use numeric identifiers that reference attributes kept in an attribute pool. This attribute interning reduces the transmission overhead of attributes that are used many times.

There is one attribute pool per pad, and it includes every current and historical attribute used in the pad.

Further Reading

Detailed information about the changesets & Easysync protocol: