Skip to content

Commit a69c6f1

Browse files
authored
regression: slash commands render logic #7882
1 parent ee68895 commit a69c6f1

2 files changed

Lines changed: 397 additions & 359 deletions

File tree

packages/editor/src/core/extensions/slash-commands/root.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const Command = Extension.create<SlashCommandOptions>({
5353

5454
return {
5555
onStart: (props) => {
56+
// Track active dropdown
57+
props.editor.commands.addActiveDropbarExtension(CORE_EXTENSIONS.SLASH_COMMANDS);
5658
component = new ReactRenderer<CommandListInstance, SlashCommandsMenuProps>(SlashCommandsMenu, {
5759
props,
5860
editor: props.editor,
@@ -65,7 +67,7 @@ const Command = Extension.create<SlashCommandOptions>({
6567
const element = component.element as HTMLElement;
6668
element.style.position = "absolute";
6769
element.style.zIndex = "100";
68-
(props.editor.options.element || document.body).appendChild(element);
70+
document.body.appendChild(element);
6971

7072
updateFloatingUIFloaterPosition(props.editor, element);
7173
},
@@ -93,7 +95,9 @@ const Command = Extension.create<SlashCommandOptions>({
9395
return component?.ref?.onKeyDown(props) ?? false;
9496
},
9597

96-
onExit: () => {
98+
onExit: ({ editor }) => {
99+
// Remove from active dropdowns
100+
editor?.commands.removeActiveDropbarExtension(CORE_EXTENSIONS.SLASH_COMMANDS);
97101
component?.destroy();
98102
component = null;
99103
},

0 commit comments

Comments
 (0)