diff --git a/src/types/YText.js b/src/types/YText.js index 93537c7b..d4114644 100644 --- a/src/types/YText.js +++ b/src/types/YText.js @@ -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) } /** diff --git a/tests/y-text.tests.js b/tests/y-text.tests.js index dbb61457..ec01b126 100644 --- a/tests/y-text.tests.js +++ b/tests/y-text.tests.js @@ -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 */