import { PluginKey } from 'prosemirror-state'; import { Extension } from '../../core/Extension.js'; /** * Find the nearest ancestor element that creates a containing block for `position: fixed`. * This happens when any ancestor has: transform, filter, backdrop-filter, perspective, * will-change (transform/perspective), or contain (paint/layout/strict/content). * * Per CSS Containing Block specification (https://www.w3.org/TR/css-position-3/#containing-block-for-abspos): * A positioned element with `position: fixed` is normally positioned relative to the viewport. * However, if any ancestor has certain CSS properties, that ancestor becomes the containing * block instead, causing `position: fixed` to behave relative to that ancestor rather than * the viewport. * * @param {HTMLElement} element - Starting element to search from * @returns {HTMLElement|null} The containing block ancestor, or null if fixed is relative to viewport * @throws {Error} Never throws - errors from getComputedStyle are caught and logged */ export function findContainingBlockAncestor(element: HTMLElement): HTMLElement | null; /** * Configuration options for ContextMenu * @typedef {Object} ContextMenuOptions * @property {boolean} [disabled] - Disable the context menu entirely (inherited from editor.options.disableContextMenu) * @property {number} [cooldownMs=5000] - Cooldown duration in milliseconds to prevent rapid re-opening * @category Options */ /** * Plugin state structure for ContextMenu * @typedef {Object} ContextMenuState * @property {boolean} open - Whether the context menu is currently visible * @property {string|null} selected - ID of the currently selected menu item * @property {number|null} anchorPos - Document position where the menu was anchored * @property {Object|null} menuPosition - CSS positioning {left: string, top: string} * @property {string} [menuPosition.left] - Left position in pixels (e.g., "100px") * @property {string} [menuPosition.top] - Top position in pixels (e.g., "28px") * @property {boolean} disabled - Whether the menu functionality is disabled */ /** * Transaction metadata for ContextMenu actions * @typedef {Object} ContextMenuMeta * @property {'open'|'select'|'close'|'updatePosition'} type - Action type * @property {number} [pos] - Document position (for 'open' action) * @property {number} [clientX] - X coordinate for context menu positioning (for 'open' action) * @property {number} [clientY] - Y coordinate for context menu positioning (for 'open' action) * @property {string} [id] - Menu item ID (for 'select' action) */ export const ContextMenuPluginKey: PluginKey; /** @deprecated Use ContextMenuPluginKey instead */ export const SlashMenuPluginKey: PluginKey; /** * @module ContextMenu * @sidebarTitle Context Menu * @snippetPath /snippets/extensions/context-menu.mdx * * @fires contextMenu:open - Emitted when menu opens, payload: {menuPosition: {left, top}} * @fires contextMenu:close - Emitted when menu closes, no payload */ export const ContextMenu: Extension>; /** @deprecated Use ContextMenu instead */ export const SlashMenu: Extension>; /** * Configuration options for ContextMenu */ export type ContextMenuOptions = { /** * - Disable the context menu entirely (inherited from editor.options.disableContextMenu) */ disabled?: boolean | undefined; /** * - Cooldown duration in milliseconds to prevent rapid re-opening */ cooldownMs?: number | undefined; }; /** * Plugin state structure for ContextMenu */ export type ContextMenuState = { /** * - Whether the context menu is currently visible */ open: boolean; /** * - ID of the currently selected menu item */ selected: string | null; /** * - Document position where the menu was anchored */ anchorPos: number | null; /** * - CSS positioning {left: string, top: string} */ menuPosition: Object | null; /** * - Left position in pixels (e.g., "100px") */ left?: string | undefined; /** * - Top position in pixels (e.g., "28px") */ top?: string | undefined; /** * - Whether the menu functionality is disabled */ disabled: boolean; }; /** * Transaction metadata for ContextMenu actions */ export type ContextMenuMeta = { /** * - Action type */ type: "open" | "select" | "close" | "updatePosition"; /** * - Document position (for 'open' action) */ pos?: number | undefined; /** * - X coordinate for context menu positioning (for 'open' action) */ clientX?: number | undefined; /** * - Y coordinate for context menu positioning (for 'open' action) */ clientY?: number | undefined; /** * - Menu item ID (for 'select' action) */ id?: string | undefined; }; //# sourceMappingURL=context-menu.d.ts.map