fix #474 - formatting bug
This commit is contained in:
parent
e9189365ee
commit
1c999b250e
@ -382,12 +382,17 @@ const cleanupFormattingGap = (transaction, start, curr, startAttributes, currAtt
|
|||||||
switch (content.constructor) {
|
switch (content.constructor) {
|
||||||
case ContentFormat: {
|
case ContentFormat: {
|
||||||
const { key, value } = /** @type {ContentFormat} */ (content)
|
const { key, value } = /** @type {ContentFormat} */ (content)
|
||||||
if ((endAttributes.get(key) || null) !== value || (startAttributes.get(key) || null) === value) {
|
const startAttrValue = startAttributes.get(key) || null
|
||||||
|
if ((endAttributes.get(key) || null) !== value || 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 (!reachedEndOfCurr && (currAttributes.get(key) || null) === value && (startAttributes.get(key) || null) !== value) {
|
||||||
currAttributes.delete(key)
|
if (startAttrValue === null) {
|
||||||
|
currAttributes.delete(key)
|
||||||
|
} else {
|
||||||
|
currAttributes.set(key, startAttrValue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
@ -206,7 +206,6 @@ export const testDeltaBug = _tc => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
ytext.applyDelta(addingSpace)
|
ytext.applyDelta(addingSpace)
|
||||||
debugger
|
|
||||||
const addingList = [
|
const addingList = [
|
||||||
{
|
{
|
||||||
retain: 12
|
retain: 12
|
||||||
@ -411,7 +410,6 @@ export const testDeltaBug = _tc => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
t.compare(result, expectedResult)
|
t.compare(result, expectedResult)
|
||||||
debugger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user