Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8586806932 | ||
|
|
981340139f |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.6.5",
|
"version": "13.6.6",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.6.5",
|
"version": "13.6.6",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lib0": "^0.2.74"
|
"lib0": "^0.2.74"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.6.5",
|
"version": "13.6.6",
|
||||||
"description": "Shared Editing Library",
|
"description": "Shared Editing Library",
|
||||||
"main": "./dist/yjs.cjs",
|
"main": "./dist/yjs.cjs",
|
||||||
"module": "./dist/yjs.mjs",
|
"module": "./dist/yjs.mjs",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
AbstractType, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Item, StructStore, Transaction // eslint-disable-line
|
YText, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Item, StructStore, Transaction // eslint-disable-line
|
||||||
} from '../internals.js'
|
} from '../internals.js'
|
||||||
|
|
||||||
import * as error from 'lib0/error'
|
import * as error from 'lib0/error'
|
||||||
@@ -47,28 +47,30 @@ export class ContentFormat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} offset
|
* @param {number} _offset
|
||||||
* @return {ContentFormat}
|
* @return {ContentFormat}
|
||||||
*/
|
*/
|
||||||
splice (offset) {
|
splice (_offset) {
|
||||||
throw error.methodUnimplemented()
|
throw error.methodUnimplemented()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {ContentFormat} right
|
* @param {ContentFormat} _right
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
mergeWith (right) {
|
mergeWith (_right) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Transaction} transaction
|
* @param {Transaction} _transaction
|
||||||
* @param {Item} item
|
* @param {Item} item
|
||||||
*/
|
*/
|
||||||
integrate (transaction, item) {
|
integrate (_transaction, item) {
|
||||||
// @todo searchmarker are currently unsupported for rich text documents
|
// @todo searchmarker are currently unsupported for rich text documents
|
||||||
/** @type {AbstractType<any>} */ (item.parent)._searchMarker = null
|
const p = /** @type {YText} */ (item.parent)
|
||||||
|
p._searchMarker = null
|
||||||
|
p._hasFormatting = true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ export const cleanupYTextAfterTransaction = transaction => {
|
|||||||
// cleanup in a new transaction
|
// cleanup in a new transaction
|
||||||
transact(doc, (t) => {
|
transact(doc, (t) => {
|
||||||
iterateDeletedStructs(transaction, transaction.deleteSet, item => {
|
iterateDeletedStructs(transaction, transaction.deleteSet, item => {
|
||||||
if (item instanceof GC || needFullCleanup.has(/** @type {YText} */ (item.parent))) {
|
if (item instanceof GC || !(/** @type {YText} */ (item.parent)._hasFormatting) || needFullCleanup.has(/** @type {YText} */ (item.parent))) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const parent = /** @type {YText} */ (item.parent)
|
const parent = /** @type {YText} */ (item.parent)
|
||||||
@@ -859,9 +859,14 @@ export class YText extends AbstractType {
|
|||||||
*/
|
*/
|
||||||
this._pending = string !== undefined ? [() => this.insert(0, string)] : []
|
this._pending = string !== undefined ? [() => this.insert(0, string)] : []
|
||||||
/**
|
/**
|
||||||
* @type {Array<ArraySearchMarker>}
|
* @type {Array<ArraySearchMarker>|null}
|
||||||
*/
|
*/
|
||||||
this._searchMarker = []
|
this._searchMarker = []
|
||||||
|
/**
|
||||||
|
* Whether this YText contains formatting attributes.
|
||||||
|
* This flag is updated when a formatting item is integrated (see ContentFormat.integrate)
|
||||||
|
*/
|
||||||
|
this._hasFormatting = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -911,7 +916,7 @@ export class YText extends AbstractType {
|
|||||||
const event = new YTextEvent(this, transaction, parentSubs)
|
const event = new YTextEvent(this, transaction, parentSubs)
|
||||||
callTypeObservers(this, transaction, event)
|
callTypeObservers(this, transaction, event)
|
||||||
// If a remote change happened, we try to cleanup potential formatting duplicates.
|
// If a remote change happened, we try to cleanup potential formatting duplicates.
|
||||||
if (!transaction.local) {
|
if (!transaction.local && this._hasFormatting) {
|
||||||
transaction._needFormattingCleanup = true
|
transaction._needFormattingCleanup = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user