This commit is contained in:
Kevin Jahns 2021-04-13 22:05:30 +02:00
parent 9e98fec504
commit 3a7a324a24
2 changed files with 18 additions and 1 deletions

View File

@ -815,6 +815,7 @@ export class YText extends AbstractType {
super._callObserver(transaction, parentSubs)
const event = new YTextEvent(this, transaction, parentSubs)
const doc = transaction.doc
callTypeObservers(this, transaction, event)
// If a remote change happened, we try to cleanup potential formatting duplicates.
if (!transaction.local) {
// check if another formatting item was inserted
@ -863,7 +864,6 @@ export class YText extends AbstractType {
}
})
}
callTypeObservers(this, transaction, event)
}
/**

View File

@ -5,6 +5,23 @@ import * as math from 'lib0/math.js'
const { init, compare } = Y
/**
* @param {t.TestCase} tc
*/
export const testDeltaAfterConcurrentFormatting = tc => {
const { text0, text1, testConnector } = init(tc, { users: 2 })
text0.insert(0, 'abcde')
testConnector.flushAllMessages()
text0.format(0, 3, { bold: true })
text1.format(2, 2, { bold: true })
let delta = null
text1.observe(event => {
delta = event.delta
})
testConnector.flushAllMessages()
t.compare(delta, [])
}
/**
* @param {t.TestCase} tc
*/