Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e40fc442d | ||
|
|
035e350062 | ||
|
|
bf338d8040 |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.5.47",
|
"version": "13.5.48",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.5.47",
|
"version": "13.5.48",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lib0": "^0.2.49"
|
"lib0": "^0.2.49"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.5.47",
|
"version": "13.5.48",
|
||||||
"description": "Shared Editing Library",
|
"description": "Shared Editing Library",
|
||||||
"main": "./dist/yjs.cjs",
|
"main": "./dist/yjs.cjs",
|
||||||
"module": "./dist/yjs.mjs",
|
"module": "./dist/yjs.mjs",
|
||||||
|
|||||||
@@ -363,19 +363,26 @@ const formatText = (transaction, parent, currPos, length, attributes) => {
|
|||||||
* @function
|
* @function
|
||||||
*/
|
*/
|
||||||
const cleanupFormattingGap = (transaction, start, curr, startAttributes, currAttributes) => {
|
const cleanupFormattingGap = (transaction, start, curr, startAttributes, currAttributes) => {
|
||||||
let end = curr
|
/**
|
||||||
const endAttributes = map.copy(currAttributes)
|
* @type {Item|null}
|
||||||
|
*/
|
||||||
|
let end = start
|
||||||
|
/**
|
||||||
|
* @type {Map<string,ContentFormat>}
|
||||||
|
*/
|
||||||
|
const endFormats = map.create()
|
||||||
while (end && (!end.countable || end.deleted)) {
|
while (end && (!end.countable || end.deleted)) {
|
||||||
if (!end.deleted && end.content.constructor === ContentFormat) {
|
if (!end.deleted && end.content.constructor === ContentFormat) {
|
||||||
updateCurrentAttributes(endAttributes, /** @type {ContentFormat} */ (end.content))
|
const cf = /** @type {ContentFormat} */ (end.content)
|
||||||
|
endFormats.set(cf.key, cf)
|
||||||
}
|
}
|
||||||
end = end.right
|
end = end.right
|
||||||
}
|
}
|
||||||
let cleanups = 0
|
let cleanups = 0
|
||||||
let reachedEndOfCurr = false
|
let reachedCurr = false
|
||||||
while (start !== end) {
|
while (start !== end) {
|
||||||
if (curr === start) {
|
if (curr === start) {
|
||||||
reachedEndOfCurr = true
|
reachedCurr = true
|
||||||
}
|
}
|
||||||
if (!start.deleted) {
|
if (!start.deleted) {
|
||||||
const content = start.content
|
const content = start.content
|
||||||
@@ -383,11 +390,11 @@ const cleanupFormattingGap = (transaction, start, curr, startAttributes, currAtt
|
|||||||
case ContentFormat: {
|
case ContentFormat: {
|
||||||
const { key, value } = /** @type {ContentFormat} */ (content)
|
const { key, value } = /** @type {ContentFormat} */ (content)
|
||||||
const startAttrValue = startAttributes.get(key) || null
|
const startAttrValue = startAttributes.get(key) || null
|
||||||
if ((endAttributes.get(key) || null) !== value || startAttrValue === value) {
|
if (endFormats.get(key) !== content || startAttrValue === value) {
|
||||||
// Either this format is overwritten or it is not necessary because the attribute already existed.
|
// Either this format is overwritten or it is not necessary because the attribute already existed.
|
||||||
start.delete(transaction)
|
start.delete(transaction)
|
||||||
cleanups++
|
cleanups++
|
||||||
if (!reachedEndOfCurr && (currAttributes.get(key) || null) === value && (startAttributes.get(key) || null) !== value) {
|
if (!reachedCurr && (currAttributes.get(key) || null) === value && startAttrValue !== value) {
|
||||||
if (startAttrValue === null) {
|
if (startAttrValue === null) {
|
||||||
currAttributes.delete(key)
|
currAttributes.delete(key)
|
||||||
} else {
|
} else {
|
||||||
@@ -395,6 +402,9 @@ const cleanupFormattingGap = (transaction, start, curr, startAttributes, currAtt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!reachedCurr && !start.deleted) {
|
||||||
|
updateCurrentAttributes(currAttributes, /** @type {ContentFormat} */ (content))
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user