mirror of
https://github.com/codex-team/editor.js
synced 2024-05-07 00:46:45 +02:00
581289c03e
* Default tunes to popover * Add the rest of default tunes * Add popover * Cleanup * Rename custom content * Cleanup * Add ability to open block settings upwards * Fix tests * Cleanup default tunes * Rename and cleanup * Add ability to display rendered custom tunes * cleanup * Rename * Add flag to close tunes popover * Cleanup * i18n * Cleanup * Fix build and tests * Fix for iframe * Add comments * Display active item, move closeOnActivate to popover * Add confirmation support to popover * Handle boolean value in confirmation param * Clarify flippable logic in popover * Comments * Pass editor element as a param of popover constructor * Fix readability * Tests * Fix flipper for confirmation element * Update confirmation config structure * Rename onClick to onActivate * Fix tests and build * Make confirmation props optional * Simplify processing tunes * Renamings * Fix text block tunes * Docs * Update event type * Move enabling confirmation state to separate method * move popover types * Unhardcode color * Support toggling * Add support of disabled items * Fix tab in empty block leading to selecting second item in popover * Remove margins for styles api settings button class * Fix arrow navigation between blocks after opening block tunes * Cleaup in default tunes code * Fix chaining confirmations * Colors * Types * Change the way flippable elements of popover custom area are set * Remove borders around popover icons * Fix untabbable inline toolbar * Fix locked scroll after closing tunes popover on mobile * Cleanup * Set max popover width * Make popover icon's border outside * Fix tab issue * Fix focus/hover issue * Reformat * Cleanup * Fix opening block tunes via keyboard * Add disableSpecialHoverAndFocusBehavior * Add deprecated comment * Cleanup * Fix popover active state * Fix checklist deletion with confirmation * Fix checklist deletion 2 * Fix popover focus * Fix popover items being impossible to flip after searching * Fix popover item highlighting issue * Update flipper.spec.ts * Fixes after review * Add Tunes Api tests * Fix multiple popover entries configured by one tune * Add tool's renderSettings() tests * Add popover confirmation state test * Fix popover width on mobile * Add popover tests * Add changelog and update version * Update changelog * Fix block tunes being unable to open after tune activation Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
80 lines
1.6 KiB
TypeScript
80 lines
1.6 KiB
TypeScript
/**
|
|
* Common parameters for both types of popover items: with or without confirmation
|
|
*/
|
|
interface PopoverItemBase {
|
|
/**
|
|
* Item icon to be appeared near a title
|
|
*/
|
|
icon: string;
|
|
|
|
/**
|
|
* Displayed text
|
|
*/
|
|
label: string;
|
|
|
|
/**
|
|
* Additional displayed text
|
|
*/
|
|
secondaryLabel?: string;
|
|
|
|
/**
|
|
* True if item should be highlighted as active
|
|
*/
|
|
isActive?: boolean;
|
|
|
|
/**
|
|
* True if item should be disabled
|
|
*/
|
|
isDisabled?: boolean;
|
|
|
|
/**
|
|
* True if popover should close once item is activated
|
|
*/
|
|
closeOnActivate?: boolean;
|
|
|
|
/**
|
|
* Item name
|
|
* Used in data attributes needed for cypress tests
|
|
*/
|
|
name?: string;
|
|
|
|
/**
|
|
* True if item should be highlighted once activated
|
|
*/
|
|
toggle?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Represents popover item with confirmation state configuration
|
|
*/
|
|
export interface PopoverItemWithConfirmation extends PopoverItemBase {
|
|
/**
|
|
* Popover item parameters that should be applied on item activation.
|
|
* May be used to ask user for confirmation before executing popover item activation handler.
|
|
*/
|
|
confirmation: Partial<PopoverItem>;
|
|
|
|
onActivate?: never;
|
|
}
|
|
|
|
/**
|
|
* Represents default popover item without confirmation state configuration
|
|
*/
|
|
export interface PopoverItemWithoutConfirmation extends PopoverItemBase {
|
|
confirmation?: never;
|
|
|
|
/**
|
|
* Popover item activation handler
|
|
*
|
|
* @param item - activated item
|
|
* @param event - event that initiated item activation
|
|
*/
|
|
onActivate: (item: PopoverItem, event?: PointerEvent) => void;
|
|
}
|
|
|
|
/**
|
|
* Represents single popover item
|
|
*/
|
|
export type PopoverItem = PopoverItemWithConfirmation | PopoverItemWithoutConfirmation
|
|
|