more comments
This commit is contained in:
parent
6d1d46c80f
commit
8911966a7b
@ -385,6 +385,7 @@ export class Item extends AbstractStruct {
|
||||
return this.parent.client
|
||||
}
|
||||
if (this.content.constructor === ContentType && /** @type {ContentType} */ (this.content).type.constructor === YWeakLink) {
|
||||
// make sure that linked content is integrated first
|
||||
const content = /** @type {any} */ (this.content).type
|
||||
if (content._id.client !== this.id.client) {
|
||||
return content._id.client
|
||||
@ -523,8 +524,9 @@ export class Item extends AbstractStruct {
|
||||
// set as current parent value if right === null and this is parentSub
|
||||
/** @type {AbstractType<any>} */ (this.parent)._map.set(this.parentSub, this)
|
||||
if (this.left !== null) {
|
||||
// this is the current attribute value of parent. delete right
|
||||
// inherit links from block we're overriding
|
||||
this.linkedBy = this.left.linkedBy
|
||||
// this is the current attribute value of parent. delete right
|
||||
this.left.delete(transaction)
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,9 @@ export class YWeakLink extends AbstractType {
|
||||
super._integrate(y, item)
|
||||
if (item !== null) {
|
||||
transact(y, (transaction) => {
|
||||
// link may refer to a single element in multi-element block
|
||||
// in such case we need to cut of the linked element into a
|
||||
// separate block
|
||||
let sourceItem = this._linkedItem !== null ? this._linkedItem : getItemCleanStart(transaction, this._id)
|
||||
if (sourceItem.constructor === Item && sourceItem.parentSub !== null) {
|
||||
// for maps, advance to most recent item
|
||||
|
Loading…
x
Reference in New Issue
Block a user