Skip to content

Commit 9a3f03a

Browse files
authored
fix: dispatch suggestion menu as a separate transaction (#1614)
Dispatching in the same transaction that modified content could cause positions to be different because of appendedTransactions (e.g. Unique-id plugin) So, this changes to only dispatch the menu in a separate transaction so that there will likely not be any other content modifications by a meta only dispatch
1 parent b884b61 commit 9a3f03a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/core/src/extensions/SuggestionMenu/SuggestionPlugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,13 @@ export class SuggestionMenuProseMirrorPlugin<
292292
props: {
293293
handleTextInput(view, _from, _to, text) {
294294
if (triggerCharacters.includes(text)) {
295+
view.dispatch(view.state.tr.insertText(text));
295296
view.dispatch(
296297
view.state.tr
297-
.insertText(text)
298-
.scrollIntoView()
299298
.setMeta(suggestionMenuPluginKey, {
300299
triggerCharacter: text,
301300
})
301+
.scrollIntoView()
302302
);
303303

304304
return true;

0 commit comments

Comments
 (0)