regression: slash commands render logic #7882

This commit is contained in:
Aaryan Khandelwal 2025-10-01 02:44:31 +05:30 committed by GitHub
parent ee68895ad3
commit a69c6f1b9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 394 additions and 356 deletions

View File

@ -53,6 +53,8 @@ const Command = Extension.create<SlashCommandOptions>({
return {
onStart: (props) => {
// Track active dropdown
props.editor.commands.addActiveDropbarExtension(CORE_EXTENSIONS.SLASH_COMMANDS);
component = new ReactRenderer<CommandListInstance, SlashCommandsMenuProps>(SlashCommandsMenu, {
props,
editor: props.editor,
@ -65,7 +67,7 @@ const Command = Extension.create<SlashCommandOptions>({
const element = component.element as HTMLElement;
element.style.position = "absolute";
element.style.zIndex = "100";
(props.editor.options.element || document.body).appendChild(element);
document.body.appendChild(element);
updateFloatingUIFloaterPosition(props.editor, element);
},
@ -93,7 +95,9 @@ const Command = Extension.create<SlashCommandOptions>({
return component?.ref?.onKeyDown(props) ?? false;
},
onExit: () => {
onExit: ({ editor }) => {
// Remove from active dropdowns
editor?.commands.removeActiveDropbarExtension(CORE_EXTENSIONS.SLASH_COMMANDS);
component?.destroy();
component = null;
},

File diff suppressed because it is too large Load Diff