mirror of
https://github.com/yjs/yjs.git
synced 2025-12-16 19:57:45 +01:00
lint
This commit is contained in:
@@ -944,7 +944,7 @@ export class YText extends AbstractType {
|
|||||||
* that is not attributed.
|
* that is not attributed.
|
||||||
* @type {import('../utils/Delta.js').FormattingAttributes}
|
* @type {import('../utils/Delta.js').FormattingAttributes}
|
||||||
*/
|
*/
|
||||||
let previousUnattributedAttributes = {} // contains previously known unattributed formatting
|
const previousUnattributedAttributes = {} // contains previously known unattributed formatting
|
||||||
/**
|
/**
|
||||||
* @type {import('../utils/Delta.js').FormattingAttributes}
|
* @type {import('../utils/Delta.js').FormattingAttributes}
|
||||||
*/
|
*/
|
||||||
@@ -1026,7 +1026,7 @@ export class YText extends AbstractType {
|
|||||||
case ContentFormat: {
|
case ContentFormat: {
|
||||||
const { key, value } = /** @type {ContentFormat} */ (c.content)
|
const { key, value } = /** @type {ContentFormat} */ (c.content)
|
||||||
const currAttrVal = currentAttributes[key] ?? null
|
const currAttrVal = currentAttributes[key] ?? null
|
||||||
if (attribution != null && (c.deleted || !previousUnattributedAttributes.hasOwnProperty(key))) {
|
if (attribution != null && (c.deleted || !object.hasProperty(previousUnattributedAttributes, key))) {
|
||||||
previousUnattributedAttributes[key] = c.deleted ? value : currAttrVal
|
previousUnattributedAttributes[key] = c.deleted ? value : currAttrVal
|
||||||
}
|
}
|
||||||
// @todo write a function "updateCurrentAttributes" and "updateChangedAttributes"
|
// @todo write a function "updateCurrentAttributes" and "updateChangedAttributes"
|
||||||
@@ -1088,13 +1088,12 @@ export class YText extends AbstractType {
|
|||||||
previousAttributes[key] = value
|
previousAttributes[key] = value
|
||||||
}
|
}
|
||||||
// # Update Attributions
|
// # Update Attributions
|
||||||
if (attribution != null || previousUnattributedAttributes.hasOwnProperty(key)) {
|
if (attribution != null || object.hasProperty(previousUnattributedAttributes, key)) {
|
||||||
/**
|
/**
|
||||||
* @type {import('../utils/Delta.js').Attribution}
|
* @type {import('../utils/Delta.js').Attribution}
|
||||||
*/
|
*/
|
||||||
const formattingAttribution = object.assign({}, d.usedAttribution)
|
const formattingAttribution = object.assign({}, d.usedAttribution)
|
||||||
const changedAttributedAttributes = /** @type {{ [key: string]: Array<any> }} */ (formattingAttribution.attributes = object.assign({}, formattingAttribution.attributes ?? {}))
|
const changedAttributedAttributes = /** @type {{ [key: string]: Array<any> }} */ (formattingAttribution.attributes = object.assign({}, formattingAttribution.attributes ?? {}))
|
||||||
|
|
||||||
if (attribution == null || equalAttrs(previousUnattributedAttributes[key], currentAttributes[key] ?? null)) {
|
if (attribution == null || equalAttrs(previousUnattributedAttributes[key], currentAttributes[key] ?? null)) {
|
||||||
// an unattributed formatting attribute was found or an attributed formatting
|
// an unattributed formatting attribute was found or an attributed formatting
|
||||||
// attribute was found that resets to the previous status
|
// attribute was found that resets to the previous status
|
||||||
|
|||||||
Reference in New Issue
Block a user