fix(docs): restore missing toHex function declaration

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Langley 2026-03-04 14:29:59 +00:00
parent 6ea1ac6565
commit 5c5b3d7215

View File

@ -130,6 +130,12 @@ function restoreCaretOffset(editor: HTMLElement, offset: number): void {
sel?.addRange(range);
}
}
/**
* Encode a UTF-8 string as a lowercase hex string, as required by
* the Automerge `set_actor_id` API.
*/
function toHex(str: string): string {
return Array.from(new TextEncoder().encode(str))
.map((b) => b.toString(16).padStart(2, "0"))
.join("");