@atlaskit/editor-plugin-collab-edit
Version:
Collab Edit plugin for @atlaskit/editor-core
19 lines (18 loc) • 1.08 kB
TypeScript
import { Rebaseable } from '@atlaskit/prosemirror-collab';
/**
* Compose adjacent streaming frames in the unconfirmed queue so the collab service receives one
* step per flush instead of one step per rendered chunk.
*
* This runs in the collab plugin's `transformUnconfirmed` hook, which fires *after* each frame has
* already been applied to the document. Collapsing therefore has no effect on what the local user
* sees, on undo history, or on any other plugin state — it only changes what is sent to the collab
* service, and what is used as the rebase buffer when remote steps arrive.
*
* Because the unconfirmed steps double as the rebase buffer (`rebaseSteps` applies their inverses
* to the live document), the composition must be exact. `mergeOverlappingSteps` only returns a
* merge it can prove exact, and this function degrades to a no-op whenever it declines.
*
* @param steps Rebaseable steps
* @returns Rebaseable steps, with adjacent streaming frames composed
*/
export declare function collapseStreamingSteps(steps: Rebaseable[]): Rebaseable[];