mirror of
https://github.com/yjs/yjs.git
synced 2025-12-16 03:37:50 +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 formattingAttribution = object.assign({}, d.usedAttribution)
|
||||||
const attributesChanged = /** @type {{ [key: string]: Array<any> }} */ (formattingAttribution.attributes = object.assign({}, formattingAttribution.attributes ?? {}))
|
const attributesChanged = /** @type {{ [key: string]: Array<any> }} */ (formattingAttribution.attributes = object.assign({}, formattingAttribution.attributes ?? {}))
|
||||||
|
debugger
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
delete attributesChanged[key]
|
delete attributesChanged[key]
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -56,7 +56,9 @@ import * as encoding from 'lib0/encoding'
|
|||||||
* @return {Attribution?}
|
* @return {Attribution?}
|
||||||
*/
|
*/
|
||||||
export const createAttributionFromAttributionItems = (attrs, deleted) => {
|
export const createAttributionFromAttributionItems = (attrs, deleted) => {
|
||||||
if (attrs == null) return null
|
if (attrs == null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @type {Attribution}
|
* @type {Attribution}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ export class DeltaBuilder extends AbstractDelta {
|
|||||||
* @return {this}
|
* @return {this}
|
||||||
*/
|
*/
|
||||||
useAttributes (attributes) {
|
useAttributes (attributes) {
|
||||||
this.usedAttributes = object.isEmpty(attributes) ? null : object.assign({}, attributes)
|
this.usedAttributes = attributes
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,7 +345,7 @@ export class DeltaBuilder extends AbstractDelta {
|
|||||||
* @param {Attribution?} attribution
|
* @param {Attribution?} attribution
|
||||||
*/
|
*/
|
||||||
useAttribution (attribution) {
|
useAttribution (attribution) {
|
||||||
this.usedAttribution = object.isEmpty(attribution) ? null : object.assign({}, attribution)
|
this.usedAttribution = attribution
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ export class RelativePosition {
|
|||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
this.assoc = assoc
|
this.assoc = assoc
|
||||||
this.item && console.log('created relpos', this.item) // @todo remove
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user