[updates] createDocFromUpdates accepts DocOpts

This commit is contained in:
Kevin Jahns
2026-01-31 02:23:26 +01:00
parent c1755c5b65
commit 3a69b95146
2 changed files with 7 additions and 5 deletions

View File

@@ -569,7 +569,7 @@ export class DiffAttributionManager extends ObservableV2 {
* @param {Doc} prevDoc
* @param {Doc} nextDoc
* @param {Object} [options] - options for the attribution manager
* @param {Attributions?} [options.attrs] - the attributes to apply to the diff
* @param {import('./meta.js').ContentMap?} [options.attrs] - the attributes to apply to the diff
*/
export const createAttributionManagerFromDiff = (prevDoc, nextDoc, options) => new DiffAttributionManager(prevDoc, nextDoc, options)

View File

@@ -785,18 +785,20 @@ export const intersectUpdateWithContentIds = (update, contentIds) =>
/**
* @param {Uint8Array} update
* @param {import('./Doc.js').DocOpts} opts
*/
export const createDocFromUpdate = update => {
const ydoc = new Doc()
export const createDocFromUpdate = (update, opts = {}) => {
const ydoc = new Doc(opts)
applyUpdate(ydoc, update)
return ydoc
}
/**
* @param {Uint8Array} update
* @param {import('./Doc.js').DocOpts} opts
*/
export const createDocFromUpdateV2 = update => {
const ydoc = new Doc()
export const createDocFromUpdateV2 = (update, opts = {}) => {
const ydoc = new Doc(opts)
applyUpdateV2(ydoc, update)
return ydoc
}