fix nicks test case

This commit is contained in:
Kevin Jahns
2025-05-05 14:17:45 +02:00
parent 00c2646031
commit 04c6fbde52
2 changed files with 7 additions and 7 deletions

View File

@@ -67,27 +67,27 @@ const output = [
"attributes": {
"italic": true
},
"attribution": {
"attribution": { // no "insert" attribution: the insertion "Hell" is not attributed to anyone
"attributes": {
"italic": [
"italic": [ // the attribute "italic" was added by Bob
"Bob"
]
}
}
},
{
"insert": "o "
"insert": "o " // the insertion "o " has no attributions
},
{
"insert": "World",
"attribution": {
"attribution": { // the insertion "World" was deleted by Bob
"delete": [
"Bob"
]
}
},
{
"insert": "attributions",
"insert": "attributions", // the insertion "attributions" was inserted by Bob
"attribution": {
"insert": [
"Bob"
@@ -95,7 +95,7 @@ const output = [
}
},
{
"insert": "!"
"insert": "!" // the insertion "!" has no attributions
}
]
```

View File

@@ -1021,7 +1021,7 @@ export const typeMapGetContent = (parent, am) => {
const tmpcs = []
am.readContent(tmpcs, prevItem)
cs = tmpcs.concat(cs)
if (cs[0].attrs == null) {
if (cs.length === 0 || cs[0].attrs == null) {
cs.splice(0, cs.findIndex(c => c.attrs != null))
break
}