Comparing version 13.5.21 to 13.5.22
@@ -10,2 +10,3 @@ export const generateNewClientId: typeof random.uint32; | ||
* @property {boolean} [DocOpts.autoLoad] If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically. | ||
* @property {boolean} [DocOpts.shouldLoad] Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load() | ||
*/ | ||
@@ -20,3 +21,3 @@ /** | ||
*/ | ||
constructor({ guid, collectionid, gc, gcFilter, meta, autoLoad }?: DocOpts | undefined); | ||
constructor({ guid, collectionid, gc, gcFilter, meta, autoLoad, shouldLoad }?: DocOpts | undefined); | ||
gc: boolean; | ||
@@ -168,2 +169,6 @@ gcFilter: (arg0: Item) => boolean; | ||
autoLoad?: boolean | undefined; | ||
/** | ||
* Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load() | ||
*/ | ||
shouldLoad?: boolean | undefined; | ||
}; | ||
@@ -170,0 +175,0 @@ import * as random from "lib0/random"; |
{ | ||
"name": "yjs", | ||
"version": "13.5.21", | ||
"version": "13.5.22", | ||
"description": "Shared Editing Library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/yjs.cjs", |
@@ -9,2 +9,8 @@ | ||
/** | ||
* @param {string} guid | ||
* @param {Object<string, any>} opts | ||
*/ | ||
const createDocFromOpts = (guid, opts) => new Doc({ guid, ...opts, shouldLoad: opts.shouldLoad || opts.autoLoad || false }) | ||
/** | ||
* @private | ||
@@ -65,3 +71,3 @@ */ | ||
copy () { | ||
return new ContentDoc(this.doc) | ||
return new ContentDoc(createDocFromOpts(this.doc.guid, this.opts)) | ||
} | ||
@@ -137,2 +143,2 @@ | ||
*/ | ||
export const readContentDoc = decoder => new ContentDoc(new Doc({ guid: decoder.readString(), ...decoder.readAny() })) | ||
export const readContentDoc = decoder => new ContentDoc(createDocFromOpts(decoder.readString(), decoder.readAny())) |
@@ -31,2 +31,3 @@ /** | ||
* @property {boolean} [DocOpts.autoLoad] If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically. | ||
* @property {boolean} [DocOpts.shouldLoad] Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load() | ||
*/ | ||
@@ -42,3 +43,3 @@ | ||
*/ | ||
constructor ({ guid = random.uuidv4(), collectionid = null, gc = true, gcFilter = () => true, meta = null, autoLoad = false } = {}) { | ||
constructor ({ guid = random.uuidv4(), collectionid = null, gc = true, gcFilter = () => true, meta = null, autoLoad = false, shouldLoad = true } = {}) { | ||
super() | ||
@@ -72,3 +73,3 @@ this.gc = gc | ||
this._item = null | ||
this.shouldLoad = autoLoad | ||
this.shouldLoad = shouldLoad | ||
this.autoLoad = autoLoad | ||
@@ -254,12 +255,8 @@ this.meta = meta | ||
const content = /** @type {ContentDoc} */ (item.content) | ||
if (item.deleted) { | ||
// @ts-ignore | ||
content.doc = null | ||
} else { | ||
content.doc = new Doc({ guid: this.guid, ...content.opts }) | ||
content.doc._item = item | ||
} | ||
content.doc = new Doc({ guid: this.guid, ...content.opts, shouldLoad: false }) | ||
content.doc._item = item | ||
transact(/** @type {any} */ (item).parent.doc, transaction => { | ||
const doc = content.doc | ||
if (!item.deleted) { | ||
transaction.subdocsAdded.add(content.doc) | ||
transaction.subdocsAdded.add(doc) | ||
} | ||
@@ -266,0 +263,0 @@ transaction.subdocsRemoved.add(this) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2056351
31816