mirror of
https://github.com/yjs/yjs.git
synced 2025-12-15 19:27:45 +01:00
[delta] useAttributes doesn't clean up empty objects
This commit is contained in:
@@ -1081,6 +1081,7 @@ export class YText extends AbstractType {
|
||||
*/
|
||||
const formattingAttribution = object.assign({}, d.usedAttribution)
|
||||
const attributesChanged = /** @type {{ [key: string]: Array<any> }} */ (formattingAttribution.attributes = object.assign({}, formattingAttribution.attributes ?? {}))
|
||||
debugger
|
||||
if (value === null) {
|
||||
delete attributesChanged[key]
|
||||
} else {
|
||||
|
||||
@@ -56,7 +56,9 @@ import * as encoding from 'lib0/encoding'
|
||||
* @return {Attribution?}
|
||||
*/
|
||||
export const createAttributionFromAttributionItems = (attrs, deleted) => {
|
||||
if (attrs == null) return null
|
||||
if (attrs == null) {
|
||||
return null
|
||||
}
|
||||
/**
|
||||
* @type {Attribution}
|
||||
*/
|
||||
|
||||
@@ -300,7 +300,7 @@ export class DeltaBuilder extends AbstractDelta {
|
||||
* @return {this}
|
||||
*/
|
||||
useAttributes (attributes) {
|
||||
this.usedAttributes = object.isEmpty(attributes) ? null : object.assign({}, attributes)
|
||||
this.usedAttributes = attributes
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ export class DeltaBuilder extends AbstractDelta {
|
||||
* @param {Attribution?} attribution
|
||||
*/
|
||||
useAttribution (attribution) {
|
||||
this.usedAttribution = object.isEmpty(attribution) ? null : object.assign({}, attribution)
|
||||
this.usedAttribution = attribution
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@ export class RelativePosition {
|
||||
* @type {number}
|
||||
*/
|
||||
this.assoc = assoc
|
||||
this.item && console.log('created relpos', this.item) // @todo remove
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user