jodit-pro
Version:
PRO Version of Jodit Editor
74 lines (73 loc) • 2.39 kB
TypeScript
/*!
* Jodit Editor PRO (https://xdsoft.net/jodit/)
* See LICENSE.md in the project root for license information.
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/
*/
import type { IUIElement } from "jodit/esm/types/index";
export interface IFlightPositionOptions {
/**
* Height of the flight panel in pixels
* @default 250
*/
panelHeight?: number;
/**
* Custom class name for the container
*/
containerClassName?: string;
/**
* Selector for toolbar element inside anchor
* Used to calculate toolbar bottom for positioning
* @default '.jodit-toolbar__box'
*/
toolbarSelector?: string;
/**
* Gap from edges in pixels
* @default 16
*/
gap?: number;
}
/**
* Flight Position Trait
*
* Provides smart positioning for a panel relative to an anchor element:
* - Panel is always position: fixed
* - Width matches anchor element width
* - Horizontal position matches anchor element
* - Vertical position: stays at viewport bottom OR just below anchor (whichever is higher)
*
* Similar to TinyMCE AI Assistant positioning behavior.
*/
export declare abstract class UIFlightPosition {
/**
* Install flight positioning on an element
* @param element - The UI element to position
* @param anchor - The anchor element (usually editor container) to track
* @param options - Configuration options
*/
static install(element: IUIElement, anchor: HTMLElement, options?: IFlightPositionOptions): void;
/**
* Update container position based on anchor element
*
* Positioning logic:
* 1. If editor is small and panel doesn't fit → top at toolbar bottom
* 2. If fits and editor bottom visible → bottom at editor bottom - gap
* 3. If editor bottom not visible → bottom at viewport bottom - gap
*/
private static updatePosition;
/**
* Remove flight positioning from an element
*/
static remove(element: IUIElement): void;
/**
* Check if element has flight positioning installed
*/
static isInstalled(element: IUIElement): boolean;
/**
* Update panel height
*/
static setPanelHeight(element: IUIElement, height: number): void;
/**
* Force position recalculation
*/
static refresh(element: IUIElement): void;
}