X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/fd45d280b4fea6446fbd0b0a5c044d6e4723d004..refs/pull/5721/head:/public/libs/tinymce/tinymce.d.ts diff --git a/public/libs/tinymce/tinymce.d.ts b/public/libs/tinymce/tinymce.d.ts index 7516267ce..d68dc5746 100644 --- a/public/libs/tinymce/tinymce.d.ts +++ b/public/libs/tinymce/tinymce.d.ts @@ -22,8 +22,8 @@ interface PathBookmark { isFakeCaret?: boolean; forward?: boolean; } -declare type Bookmark = StringPathBookmark | RangeBookmark | IdBookmark | IndexBookmark | PathBookmark; -declare type NormalizedEvent = E & { +type Bookmark = StringPathBookmark | RangeBookmark | IdBookmark | IndexBookmark | PathBookmark; +type NormalizedEvent = E & { readonly type: string; readonly target: T; readonly isDefaultPrevented: () => boolean; @@ -33,7 +33,7 @@ declare type NormalizedEvent = E & { readonly isImmediatePropagationStopped: () => boolean; readonly stopImmediatePropagation: () => void; }; -declare type MappedEvent = K extends keyof T ? T[K] : any; +type MappedEvent = K extends keyof T ? T[K] : any; interface NativeEventMap { 'beforepaste': Event; 'blur': FocusEvent; @@ -76,7 +76,7 @@ interface NativeEventMap { 'touchcancel': TouchEvent; 'wheel': WheelEvent; } -declare type EditorEvent = NormalizedEvent; +type EditorEvent = NormalizedEvent; interface EventDispatcherSettings { scope?: any; toggleEvent?: (name: string, state: boolean) => void | boolean; @@ -101,27 +101,24 @@ declare class EventDispatcher { once(name: K, callback: (event: EditorEvent>) => void, prepend?: boolean): this; has(name: string): boolean; } -declare const enum UndoLevelType { - Fragmented = "fragmented", - Complete = "complete" -} +type UndoLevelType = 'fragmented' | 'complete'; interface BaseUndoLevel { type: UndoLevelType; bookmark: Bookmark | null; beforeBookmark: Bookmark | null; } interface FragmentedUndoLevel extends BaseUndoLevel { - type: UndoLevelType.Fragmented; + type: 'fragmented'; fragments: string[]; content: ''; } interface CompleteUndoLevel extends BaseUndoLevel { - type: UndoLevelType.Complete; + type: 'complete'; fragments: null; content: string; } -declare type NewUndoLevel = CompleteUndoLevel | FragmentedUndoLevel; -declare type UndoLevel = NewUndoLevel & { +type NewUndoLevel = CompleteUndoLevel | FragmentedUndoLevel; +type UndoLevel = NewUndoLevel & { bookmark: Bookmark; }; interface UndoManager { @@ -140,7 +137,7 @@ interface UndoManager { ignore: (callback: () => void) => void; extra: (callback1: () => void, callback2: () => void) => void; } -declare type SchemaType = 'html4' | 'html5' | 'html5-strict'; +type SchemaType = 'html4' | 'html5' | 'html5-strict'; interface ElementSettings { block_elements?: string; boolean_attributes?: string; @@ -152,6 +149,7 @@ interface ElementSettings { void_elements?: string; whitespace_elements?: string; transparent_elements?: string; + wrap_block_elements?: string; } interface SchemaSettings extends ElementSettings { custom_elements?: string; @@ -223,13 +221,16 @@ interface Schema { getSpecialElements: () => SchemaRegExpMap; isValidChild: (name: string, child: string) => boolean; isValid: (name: string, attr?: string) => boolean; + isBlock: (name: string) => boolean; + isInline: (name: string) => boolean; + isWrapper: (name: string) => boolean; getCustomElements: () => SchemaMap; addValidElements: (validElements: string) => void; setValidElements: (validElements: string) => void; addCustomElements: (customElements: string) => void; addValidChildren: (validChildren: any) => void; } -declare type Attributes$1 = Array<{ +type Attributes$1 = Array<{ name: string; value: string; }> & { @@ -269,8 +270,8 @@ declare class AstNode { isEmpty(elements: SchemaMap, whitespace?: SchemaMap, predicate?: (node: AstNode) => boolean): boolean; walk(prev?: boolean): AstNode | null | undefined; } -declare type Content = string | AstNode; -declare type ContentFormat = 'raw' | 'text' | 'html' | 'tree'; +type Content = string | AstNode; +type ContentFormat = 'raw' | 'text' | 'html' | 'tree'; interface GetContentArgs { format: ContentFormat; get: boolean; @@ -351,16 +352,16 @@ interface Quirks { refreshContentEditable(): void; isHidden(): boolean; } -declare type DecoratorData = Record; -declare type Decorator = (uid: string, data: DecoratorData) => { +type DecoratorData = Record; +type Decorator = (uid: string, data: DecoratorData) => { attributes?: {}; classes?: string[]; }; -declare type AnnotationListener = (state: boolean, name: string, data?: { +type AnnotationListener = (state: boolean, name: string, data?: { uid: string; nodes: any[]; }) => void; -declare type AnnotationListenerApi = AnnotationListener; +type AnnotationListenerApi = AnnotationListener; interface AnnotatorSettings { decorate: Decorator; persistent?: boolean; @@ -420,8 +421,8 @@ interface UploadFailure { message: string; remove?: boolean; } -declare type ProgressFn = (percent: number) => void; -declare type UploadHandler = (blobInfo: BlobInfo, progress: ProgressFn) => Promise; +type ProgressFn = (percent: number) => void; +type UploadHandler = (blobInfo: BlobInfo, progress: ProgressFn) => Promise; interface UploadResult$2 { url: string; blobInfo: BlobInfo; @@ -449,7 +450,7 @@ interface InlineCmdPattern extends InlineBasePattern { readonly cmd: string; readonly value?: any; } -declare type InlinePattern = InlineFormatPattern | InlineCmdPattern; +type InlinePattern = InlineFormatPattern | InlineCmdPattern; interface BlockBasePattern { readonly start: string; } @@ -462,14 +463,14 @@ interface BlockCmdPattern extends BlockBasePattern { readonly cmd: string; readonly value?: any; } -declare type BlockPattern = BlockFormatPattern | BlockCmdPattern; -declare type Pattern = InlinePattern | BlockPattern; +type BlockPattern = BlockFormatPattern | BlockCmdPattern; +type Pattern = InlinePattern | BlockPattern; interface DynamicPatternContext { readonly text: string; readonly block: Element; } -declare type DynamicPatternsLookup = (ctx: DynamicPatternContext) => Pattern[]; -declare type RawDynamicPatternsLookup = (ctx: DynamicPatternContext) => RawPattern[]; +type DynamicPatternsLookup = (ctx: DynamicPatternContext) => Pattern[]; +type RawDynamicPatternsLookup = (ctx: DynamicPatternContext) => RawPattern[]; interface AlertBannerSpec { type: 'alertbanner'; level: 'info' | 'warn' | 'error' | 'success'; @@ -519,7 +520,7 @@ interface CustomEditorInit { getValue: () => string; destroy: () => void; } -declare type CustomEditorInitFn = (elm: HTMLElement, settings: any) => Promise; +type CustomEditorInitFn = (elm: HTMLElement, settings: any) => Promise; interface CustomEditorOldSpec extends FormComponentSpec { type: 'customeditor'; tag?: string; @@ -532,7 +533,7 @@ interface CustomEditorNewSpec extends FormComponentSpec { scriptUrl: string; settings?: any; } -declare type CustomEditorSpec = CustomEditorOldSpec | CustomEditorNewSpec; +type CustomEditorSpec = CustomEditorOldSpec | CustomEditorNewSpec; interface DropZoneSpec extends FormComponentWithLabelSpec { type: 'dropzone'; } @@ -548,7 +549,9 @@ interface HtmlPanelSpec { } interface IframeSpec extends FormComponentWithLabelSpec { type: 'iframe'; + border?: boolean; sandboxed?: boolean; + streamContent?: boolean; transparent?: boolean; } interface ImagePreviewSpec extends FormComponentSpec { @@ -562,10 +565,12 @@ interface InputSpec extends FormComponentWithLabelSpec { maximized?: boolean; enabled?: boolean; } +type Alignment = 'start' | 'center' | 'end'; interface LabelSpec { type: 'label'; label: string; items: BodyComponentSpec[]; + align?: Alignment; } interface ListBoxSingleItemSpec { text: string; @@ -575,7 +580,7 @@ interface ListBoxNestedItemSpec { text: string; items: ListBoxItemSpec[]; } -declare type ListBoxItemSpec = ListBoxNestedItemSpec | ListBoxSingleItemSpec; +type ListBoxItemSpec = ListBoxNestedItemSpec | ListBoxSingleItemSpec; interface ListBoxSpec extends FormComponentWithLabelSpec { type: 'listbox'; items: ListBoxItemSpec[]; @@ -618,21 +623,58 @@ interface TextAreaSpec extends FormComponentWithLabelSpec { maximized?: boolean; enabled?: boolean; } -interface UrlInputSpec extends FormComponentWithLabelSpec { - type: 'urlinput'; - filetype?: 'image' | 'media' | 'file'; +interface BaseToolbarButtonSpec { enabled?: boolean; + tooltip?: string; + icon?: string; + text?: string; + onSetup?: (api: I) => (api: I) => void; } -interface UrlInputData { - value: string; - meta: { - text?: string; - }; +interface BaseToolbarButtonInstanceApi { + isEnabled: () => boolean; + setEnabled: (state: boolean) => void; + setText: (text: string) => void; + setIcon: (icon: string) => void; } -declare type BodyComponentSpec = BarSpec | ButtonSpec | CheckboxSpec | TextAreaSpec | InputSpec | ListBoxSpec | SelectBoxSpec | SizeInputSpec | SliderSpec | IframeSpec | HtmlPanelSpec | UrlInputSpec | DropZoneSpec | ColorInputSpec | GridSpec | ColorPickerSpec | ImagePreviewSpec | AlertBannerSpec | CollectionSpec | LabelSpec | TableSpec | PanelSpec | CustomEditorSpec; -interface BarSpec { - type: 'bar'; - items: BodyComponentSpec[]; +interface ToolbarButtonSpec extends BaseToolbarButtonSpec { + type?: 'button'; + onAction: (api: ToolbarButtonInstanceApi) => void; +} +interface ToolbarButtonInstanceApi extends BaseToolbarButtonInstanceApi { +} +interface ToolbarGroupSetting { + name: string; + items: string[]; +} +type ToolbarConfig = string | ToolbarGroupSetting[]; +interface GroupToolbarButtonInstanceApi extends BaseToolbarButtonInstanceApi { +} +interface GroupToolbarButtonSpec extends BaseToolbarButtonSpec { + type?: 'grouptoolbarbutton'; + items?: ToolbarConfig; +} +interface CardImageSpec { + type: 'cardimage'; + src: string; + alt?: string; + classes?: string[]; +} +interface CardTextSpec { + type: 'cardtext'; + text: string; + name?: string; + classes?: string[]; +} +type CardItemSpec = CardContainerSpec | CardImageSpec | CardTextSpec; +type CardContainerDirection = 'vertical' | 'horizontal'; +type CardContainerAlign = 'left' | 'right'; +type CardContainerValign = 'top' | 'middle' | 'bottom'; +interface CardContainerSpec { + type: 'cardcontainer'; + items: CardItemSpec[]; + direction?: CardContainerDirection; + align?: CardContainerAlign; + valign?: CardContainerValign; } interface CommonMenuItemSpec { enabled?: boolean; @@ -645,11 +687,219 @@ interface CommonMenuItemInstanceApi { isEnabled: () => boolean; setEnabled: (state: boolean) => void; } +interface CardMenuItemInstanceApi extends CommonMenuItemInstanceApi { +} +interface CardMenuItemSpec extends Omit { + type: 'cardmenuitem'; + label?: string; + items: CardItemSpec[]; + onSetup?: (api: CardMenuItemInstanceApi) => (api: CardMenuItemInstanceApi) => void; + onAction?: (api: CardMenuItemInstanceApi) => void; +} +interface ChoiceMenuItemSpec extends CommonMenuItemSpec { + type?: 'choiceitem'; + icon?: string; +} +interface ChoiceMenuItemInstanceApi extends CommonMenuItemInstanceApi { + isActive: () => boolean; + setActive: (state: boolean) => void; +} +interface ContextMenuItem extends CommonMenuItemSpec { + text: string; + icon?: string; + type?: 'item'; + onAction: () => void; +} +interface ContextSubMenu extends CommonMenuItemSpec { + type: 'submenu'; + text: string; + icon?: string; + getSubmenuItems: () => string | Array; +} +type ContextMenuContents = string | ContextMenuItem | SeparatorMenuItemSpec | ContextSubMenu; +interface ContextMenuApi { + update: (element: Element) => string | Array; +} +interface FancyActionArgsMap { + 'inserttable': { + numRows: number; + numColumns: number; + }; + 'colorswatch': { + value: string; + }; +} +interface BaseFancyMenuItemSpec { + type: 'fancymenuitem'; + fancytype: T; + initData?: Record; + onAction?: (data: FancyActionArgsMap[T]) => void; +} +interface InsertTableMenuItemSpec extends BaseFancyMenuItemSpec<'inserttable'> { + fancytype: 'inserttable'; + initData?: {}; +} +interface ColorSwatchMenuItemSpec extends BaseFancyMenuItemSpec<'colorswatch'> { + fancytype: 'colorswatch'; + select?: (value: string) => boolean; + initData?: { + allowCustomColors?: boolean; + colors?: ChoiceMenuItemSpec[]; + storageKey?: string; + }; +} +type FancyMenuItemSpec = InsertTableMenuItemSpec | ColorSwatchMenuItemSpec; +interface MenuItemSpec extends CommonMenuItemSpec { + type?: 'menuitem'; + icon?: string; + onSetup?: (api: MenuItemInstanceApi) => (api: MenuItemInstanceApi) => void; + onAction?: (api: MenuItemInstanceApi) => void; +} +interface MenuItemInstanceApi extends CommonMenuItemInstanceApi { +} +interface SeparatorMenuItemSpec { + type?: 'separator'; + text?: string; +} +interface ToggleMenuItemSpec extends CommonMenuItemSpec { + type?: 'togglemenuitem'; + icon?: string; + active?: boolean; + onSetup?: (api: ToggleMenuItemInstanceApi) => void; + onAction: (api: ToggleMenuItemInstanceApi) => void; +} +interface ToggleMenuItemInstanceApi extends CommonMenuItemInstanceApi { + isActive: () => boolean; + setActive: (state: boolean) => void; +} +type NestedMenuItemContents = string | MenuItemSpec | NestedMenuItemSpec | ToggleMenuItemSpec | SeparatorMenuItemSpec | FancyMenuItemSpec; +interface NestedMenuItemSpec extends CommonMenuItemSpec { + type?: 'nestedmenuitem'; + icon?: string; + getSubmenuItems: () => string | Array; + onSetup?: (api: NestedMenuItemInstanceApi) => (api: NestedMenuItemInstanceApi) => void; +} +interface NestedMenuItemInstanceApi extends CommonMenuItemInstanceApi { + setTooltip: (tooltip: string) => void; + setIconFill: (id: string, value: string) => void; +} +type MenuButtonItemTypes = NestedMenuItemContents; +type SuccessCallback$1 = (menu: string | MenuButtonItemTypes[]) => void; +interface MenuButtonFetchContext { + pattern: string; +} +interface BaseMenuButtonSpec { + text?: string; + tooltip?: string; + icon?: string; + search?: boolean | { + placeholder?: string; + }; + fetch: (success: SuccessCallback$1, fetchContext: MenuButtonFetchContext, api: BaseMenuButtonInstanceApi) => void; + onSetup?: (api: BaseMenuButtonInstanceApi) => (api: BaseMenuButtonInstanceApi) => void; +} +interface BaseMenuButtonInstanceApi { + isEnabled: () => boolean; + setEnabled: (state: boolean) => void; + isActive: () => boolean; + setActive: (state: boolean) => void; + setText: (text: string) => void; + setIcon: (icon: string) => void; +} +interface ToolbarMenuButtonSpec extends BaseMenuButtonSpec { + type?: 'menubutton'; + onSetup?: (api: ToolbarMenuButtonInstanceApi) => (api: ToolbarMenuButtonInstanceApi) => void; +} +interface ToolbarMenuButtonInstanceApi extends BaseMenuButtonInstanceApi { +} +type ToolbarSplitButtonItemTypes = ChoiceMenuItemSpec | SeparatorMenuItemSpec; +type SuccessCallback = (menu: ToolbarSplitButtonItemTypes[]) => void; +type SelectPredicate = (value: string) => boolean; +type PresetTypes = 'color' | 'normal' | 'listpreview'; +type ColumnTypes$1 = number | 'auto'; +interface ToolbarSplitButtonSpec { + type?: 'splitbutton'; + tooltip?: string; + icon?: string; + text?: string; + select?: SelectPredicate; + presets?: PresetTypes; + columns?: ColumnTypes$1; + fetch: (success: SuccessCallback) => void; + onSetup?: (api: ToolbarSplitButtonInstanceApi) => (api: ToolbarSplitButtonInstanceApi) => void; + onAction: (api: ToolbarSplitButtonInstanceApi) => void; + onItemAction: (api: ToolbarSplitButtonInstanceApi, value: string) => void; +} +interface ToolbarSplitButtonInstanceApi { + isEnabled: () => boolean; + setEnabled: (state: boolean) => void; + setIconFill: (id: string, value: string) => void; + isActive: () => boolean; + setActive: (state: boolean) => void; + setTooltip: (tooltip: string) => void; + setText: (text: string) => void; + setIcon: (icon: string) => void; +} +interface BaseToolbarToggleButtonSpec extends BaseToolbarButtonSpec { + active?: boolean; +} +interface BaseToolbarToggleButtonInstanceApi extends BaseToolbarButtonInstanceApi { + isActive: () => boolean; + setActive: (state: boolean) => void; +} +interface ToolbarToggleButtonSpec extends BaseToolbarToggleButtonSpec { + type?: 'togglebutton'; + onAction: (api: ToolbarToggleButtonInstanceApi) => void; +} +interface ToolbarToggleButtonInstanceApi extends BaseToolbarToggleButtonInstanceApi { +} +type Id = string; +interface TreeSpec { + type: 'tree'; + items: TreeItemSpec[]; + onLeafAction?: (id: Id) => void; + defaultExpandedIds?: Id[]; + onToggleExpand?: (expandedIds: Id[], { expanded, node }: { + expanded: boolean; + node: Id; + }) => void; + defaultSelectedId?: Id; +} +interface BaseTreeItemSpec { + title: string; + id: Id; + menu?: ToolbarMenuButtonSpec; +} +interface DirectorySpec extends BaseTreeItemSpec { + type: 'directory'; + children: TreeItemSpec[]; +} +interface LeafSpec extends BaseTreeItemSpec { + type: 'leaf'; +} +type TreeItemSpec = DirectorySpec | LeafSpec; +interface UrlInputSpec extends FormComponentWithLabelSpec { + type: 'urlinput'; + filetype?: 'image' | 'media' | 'file'; + enabled?: boolean; + picker_text?: string; +} +interface UrlInputData { + value: string; + meta: { + text?: string; + }; +} +type BodyComponentSpec = BarSpec | ButtonSpec | CheckboxSpec | TextAreaSpec | InputSpec | ListBoxSpec | SelectBoxSpec | SizeInputSpec | SliderSpec | IframeSpec | HtmlPanelSpec | UrlInputSpec | DropZoneSpec | ColorInputSpec | GridSpec | ColorPickerSpec | ImagePreviewSpec | AlertBannerSpec | CollectionSpec | LabelSpec | TableSpec | TreeSpec | PanelSpec | CustomEditorSpec; +interface BarSpec { + type: 'bar'; + items: BodyComponentSpec[]; +} interface DialogToggleMenuItemSpec extends CommonMenuItemSpec { type?: 'togglemenuitem'; name: string; } -declare type DialogFooterMenuButtonItemSpec = DialogToggleMenuItemSpec; +type DialogFooterMenuButtonItemSpec = DialogToggleMenuItemSpec; interface BaseDialogFooterButtonSpec { name?: string; align?: 'start' | 'end'; @@ -669,7 +919,14 @@ interface DialogFooterMenuButtonSpec extends BaseDialogFooterButtonSpec { icon?: string; items: DialogFooterMenuButtonItemSpec[]; } -declare type DialogFooterButtonSpec = DialogFooterNormalButtonSpec | DialogFooterMenuButtonSpec; +interface DialogFooterToggleButtonSpec extends BaseDialogFooterButtonSpec { + type: 'togglebutton'; + tooltip?: string; + icon?: string; + text?: string; + active?: boolean; +} +type DialogFooterButtonSpec = DialogFooterNormalButtonSpec | DialogFooterMenuButtonSpec | DialogFooterToggleButtonSpec; interface TabSpec { name?: string; title: string; @@ -679,8 +936,8 @@ interface TabPanelSpec { type: 'tabpanel'; tabs: TabSpec[]; } -declare type DialogDataItem = any; -declare type DialogData = Record; +type DialogDataItem = any; +type DialogData = Record; interface DialogInstanceApi { getData: () => T; setData: (data: Partial) => void; @@ -690,6 +947,7 @@ interface DialogInstanceApi { redial: (nu: DialogSpec) => void; block: (msg: string) => void; unblock: () => void; + toggleFullscreen: () => void; close: () => void; } interface DialogActionDetails { @@ -703,18 +961,18 @@ interface DialogTabChangeDetails { newTabName: string; oldTabName: string; } -declare type DialogActionHandler = (api: DialogInstanceApi, details: DialogActionDetails) => void; -declare type DialogChangeHandler = (api: DialogInstanceApi, details: DialogChangeDetails) => void; -declare type DialogSubmitHandler = (api: DialogInstanceApi) => void; -declare type DialogCloseHandler = () => void; -declare type DialogCancelHandler = (api: DialogInstanceApi) => void; -declare type DialogTabChangeHandler = (api: DialogInstanceApi, details: DialogTabChangeDetails) => void; -declare type DialogSize = 'normal' | 'medium' | 'large'; +type DialogActionHandler = (api: DialogInstanceApi, details: DialogActionDetails) => void; +type DialogChangeHandler = (api: DialogInstanceApi, details: DialogChangeDetails) => void; +type DialogSubmitHandler = (api: DialogInstanceApi) => void; +type DialogCloseHandler = () => void; +type DialogCancelHandler = (api: DialogInstanceApi) => void; +type DialogTabChangeHandler = (api: DialogInstanceApi, details: DialogTabChangeDetails) => void; +type DialogSize = 'normal' | 'medium' | 'large'; interface DialogSpec { title: string; size?: DialogSize; body: TabPanelSpec | PanelSpec; - buttons: DialogFooterButtonSpec[]; + buttons?: DialogFooterButtonSpec[]; initialData?: Partial; onAction?: DialogActionHandler; onChange?: DialogChangeHandler; @@ -737,10 +995,10 @@ interface UrlDialogMessage { mceAction: string; [key: string]: any; } -declare type UrlDialogActionHandler = (api: UrlDialogInstanceApi, actions: UrlDialogActionDetails) => void; -declare type UrlDialogCloseHandler = () => void; -declare type UrlDialogCancelHandler = (api: UrlDialogInstanceApi) => void; -declare type UrlDialogMessageHandler = (api: UrlDialogInstanceApi, message: UrlDialogMessage) => void; +type UrlDialogActionHandler = (api: UrlDialogInstanceApi, actions: UrlDialogActionDetails) => void; +type UrlDialogCloseHandler = () => void; +type UrlDialogCancelHandler = (api: UrlDialogInstanceApi) => void; +type UrlDialogMessageHandler = (api: UrlDialogInstanceApi, message: UrlDialogMessage) => void; interface UrlDialogFooterButtonSpec extends DialogFooterNormalButtonSpec { type: 'cancel' | 'custom'; } @@ -755,44 +1013,8 @@ interface UrlDialogSpec { onCancel?: UrlDialogCancelHandler; onMessage?: UrlDialogMessageHandler; } -declare type CardContainerDirection = 'vertical' | 'horizontal'; -declare type CardContainerAlign = 'left' | 'right'; -declare type CardContainerValign = 'top' | 'middle' | 'bottom'; -interface CardContainerSpec { - type: 'cardcontainer'; - items: CardItemSpec[]; - direction?: CardContainerDirection; - align?: CardContainerAlign; - valign?: CardContainerValign; -} -interface CardImageSpec { - type: 'cardimage'; - src: string; - alt?: string; - classes?: string[]; -} -interface CardTextSpec { - type: 'cardtext'; - text: string; - name?: string; - classes?: string[]; -} -declare type CardItemSpec = CardContainerSpec | CardImageSpec | CardTextSpec; -interface CardMenuItemInstanceApi extends CommonMenuItemInstanceApi { -} -interface CardMenuItemSpec extends Omit { - type: 'cardmenuitem'; - label?: string; - items: CardItemSpec[]; - onSetup?: (api: CardMenuItemInstanceApi) => (api: CardMenuItemInstanceApi) => void; - onAction?: (api: CardMenuItemInstanceApi) => void; -} -interface SeparatorMenuItemSpec { - type?: 'separator'; - text?: string; -} -declare type ColumnTypes$1 = number | 'auto'; -declare type SeparatorItemSpec = SeparatorMenuItemSpec; +type ColumnTypes = number | 'auto'; +type SeparatorItemSpec = SeparatorMenuItemSpec; interface AutocompleterItemSpec { type?: 'autocompleteitem'; value: string; @@ -800,13 +1022,13 @@ interface AutocompleterItemSpec { icon?: string; meta?: Record; } -declare type AutocompleterContents = SeparatorItemSpec | AutocompleterItemSpec | CardMenuItemSpec; +type AutocompleterContents = SeparatorItemSpec | AutocompleterItemSpec | CardMenuItemSpec; interface AutocompleterSpec { type?: 'autocompleter'; ch?: string; trigger?: string; minChars?: number; - columns?: ColumnTypes$1; + columns?: ColumnTypes; matches?: (rng: Range, text: string, pattern: string) => boolean; fetch: (pattern: string, maxResults: number, fetchOptions: Record) => Promise; onAction: (autocompleterApi: AutocompleterInstanceApi, rng: Range, value: string, meta: Record) => void; @@ -817,43 +1039,13 @@ interface AutocompleterInstanceApi { hide: () => void; reload: (fetchOptions: Record) => void; } -declare type ContextPosition = 'node' | 'selection' | 'line'; -declare type ContextScope = 'node' | 'editor'; +type ContextPosition = 'node' | 'selection' | 'line'; +type ContextScope = 'node' | 'editor'; interface ContextBarSpec { predicate?: (elem: Element) => boolean; position?: ContextPosition; scope?: ContextScope; } -interface BaseToolbarButtonSpec { - enabled?: boolean; - tooltip?: string; - icon?: string; - text?: string; - onSetup?: (api: I) => (api: I) => void; -} -interface BaseToolbarButtonInstanceApi { - isEnabled: () => boolean; - setEnabled: (state: boolean) => void; -} -interface ToolbarButtonSpec extends BaseToolbarButtonSpec { - type?: 'button'; - onAction: (api: ToolbarButtonInstanceApi) => void; -} -interface ToolbarButtonInstanceApi extends BaseToolbarButtonInstanceApi { -} -interface BaseToolbarToggleButtonSpec extends BaseToolbarButtonSpec { - active?: boolean; -} -interface BaseToolbarToggleButtonInstanceApi extends BaseToolbarButtonInstanceApi { - isActive: () => boolean; - setActive: (state: boolean) => void; -} -interface ToolbarToggleButtonSpec extends BaseToolbarToggleButtonSpec { - type?: 'togglebutton'; - onAction: (api: ToolbarToggleButtonInstanceApi) => void; -} -interface ToolbarToggleButtonInstanceApi extends BaseToolbarToggleButtonInstanceApi { -} interface ContextFormLaunchButtonApi extends BaseToolbarButtonSpec { type: 'contextformbutton'; } @@ -889,86 +1081,6 @@ interface ContextToolbarSpec extends ContextBarSpec { type?: 'contexttoolbar'; items: string; } -interface ChoiceMenuItemSpec extends CommonMenuItemSpec { - type?: 'choiceitem'; - icon?: string; -} -interface ChoiceMenuItemInstanceApi extends CommonMenuItemInstanceApi { - isActive: () => boolean; - setActive: (state: boolean) => void; -} -interface ContextMenuItem extends CommonMenuItemSpec { - text: string; - icon?: string; - type?: 'item'; - onAction: () => void; -} -interface ContextSubMenu extends CommonMenuItemSpec { - type: 'submenu'; - text: string; - icon?: string; - getSubmenuItems: () => string | Array; -} -declare type ContextMenuContents = string | ContextMenuItem | SeparatorMenuItemSpec | ContextSubMenu; -interface ContextMenuApi { - update: (element: Element) => string | Array; -} -interface FancyActionArgsMap { - 'inserttable': { - numRows: number; - numColumns: number; - }; - 'colorswatch': { - value: string; - }; -} -interface BaseFancyMenuItemSpec { - type: 'fancymenuitem'; - fancytype: T; - initData?: Record; - onAction?: (data: FancyActionArgsMap[T]) => void; -} -interface InsertTableMenuItemSpec extends BaseFancyMenuItemSpec<'inserttable'> { - fancytype: 'inserttable'; - initData?: {}; -} -interface ColorSwatchMenuItemSpec extends BaseFancyMenuItemSpec<'colorswatch'> { - fancytype: 'colorswatch'; - initData?: { - allowCustomColors?: boolean; - colors?: ChoiceMenuItemSpec[]; - storageKey?: string; - }; -} -declare type FancyMenuItemSpec = InsertTableMenuItemSpec | ColorSwatchMenuItemSpec; -interface MenuItemSpec extends CommonMenuItemSpec { - type?: 'menuitem'; - icon?: string; - onSetup?: (api: MenuItemInstanceApi) => (api: MenuItemInstanceApi) => void; - onAction?: (api: MenuItemInstanceApi) => void; -} -interface MenuItemInstanceApi extends CommonMenuItemInstanceApi { -} -declare type NestedMenuItemContents = string | MenuItemSpec | NestedMenuItemSpec | ToggleMenuItemSpec | SeparatorMenuItemSpec | FancyMenuItemSpec; -interface NestedMenuItemSpec extends CommonMenuItemSpec { - type?: 'nestedmenuitem'; - icon?: string; - getSubmenuItems: () => string | Array; - onSetup?: (api: NestedMenuItemInstanceApi) => (api: NestedMenuItemInstanceApi) => void; -} -interface NestedMenuItemInstanceApi extends CommonMenuItemInstanceApi { -} -interface ToggleMenuItemSpec extends CommonMenuItemSpec { - type?: 'togglemenuitem'; - icon?: string; - active?: boolean; - onSetup?: (api: ToggleMenuItemInstanceApi) => void; - onAction: (api: ToggleMenuItemInstanceApi) => void; -} -interface ToggleMenuItemInstanceApi extends CommonMenuItemInstanceApi { - isActive: () => boolean; - setActive: (state: boolean) => void; -} type PublicDialog_d_AlertBannerSpec = AlertBannerSpec; type PublicDialog_d_BarSpec = BarSpec; type PublicDialog_d_BodyComponentSpec = BodyComponentSpec; @@ -1009,6 +1121,8 @@ type PublicDialog_d_TableSpec = TableSpec; type PublicDialog_d_TabSpec = TabSpec; type PublicDialog_d_TabPanelSpec = TabPanelSpec; type PublicDialog_d_TextAreaSpec = TextAreaSpec; +type PublicDialog_d_TreeSpec = TreeSpec; +type PublicDialog_d_TreeItemSpec = TreeItemSpec; type PublicDialog_d_UrlInputData = UrlInputData; type PublicDialog_d_UrlInputSpec = UrlInputSpec; type PublicDialog_d_UrlDialogSpec = UrlDialogSpec; @@ -1017,7 +1131,7 @@ type PublicDialog_d_UrlDialogInstanceApi = UrlDialogInstanceApi; type PublicDialog_d_UrlDialogActionDetails = UrlDialogActionDetails; type PublicDialog_d_UrlDialogMessage = UrlDialogMessage; declare namespace PublicDialog_d { - export { PublicDialog_d_AlertBannerSpec as AlertBannerSpec, PublicDialog_d_BarSpec as BarSpec, PublicDialog_d_BodyComponentSpec as BodyComponentSpec, PublicDialog_d_ButtonSpec as ButtonSpec, PublicDialog_d_CheckboxSpec as CheckboxSpec, PublicDialog_d_CollectionItem as CollectionItem, PublicDialog_d_CollectionSpec as CollectionSpec, PublicDialog_d_ColorInputSpec as ColorInputSpec, PublicDialog_d_ColorPickerSpec as ColorPickerSpec, PublicDialog_d_CustomEditorSpec as CustomEditorSpec, PublicDialog_d_CustomEditorInit as CustomEditorInit, PublicDialog_d_CustomEditorInitFn as CustomEditorInitFn, PublicDialog_d_DialogData as DialogData, PublicDialog_d_DialogSize as DialogSize, PublicDialog_d_DialogSpec as DialogSpec, PublicDialog_d_DialogInstanceApi as DialogInstanceApi, PublicDialog_d_DialogFooterButtonSpec as DialogFooterButtonSpec, PublicDialog_d_DialogActionDetails as DialogActionDetails, PublicDialog_d_DialogChangeDetails as DialogChangeDetails, PublicDialog_d_DialogTabChangeDetails as DialogTabChangeDetails, PublicDialog_d_DropZoneSpec as DropZoneSpec, PublicDialog_d_GridSpec as GridSpec, PublicDialog_d_HtmlPanelSpec as HtmlPanelSpec, PublicDialog_d_IframeSpec as IframeSpec, PublicDialog_d_ImagePreviewSpec as ImagePreviewSpec, PublicDialog_d_InputSpec as InputSpec, PublicDialog_d_LabelSpec as LabelSpec, PublicDialog_d_ListBoxSpec as ListBoxSpec, PublicDialog_d_ListBoxItemSpec as ListBoxItemSpec, PublicDialog_d_ListBoxNestedItemSpec as ListBoxNestedItemSpec, PublicDialog_d_ListBoxSingleItemSpec as ListBoxSingleItemSpec, PublicDialog_d_PanelSpec as PanelSpec, PublicDialog_d_SelectBoxSpec as SelectBoxSpec, PublicDialog_d_SelectBoxItemSpec as SelectBoxItemSpec, PublicDialog_d_SizeInputSpec as SizeInputSpec, PublicDialog_d_SliderSpec as SliderSpec, PublicDialog_d_TableSpec as TableSpec, PublicDialog_d_TabSpec as TabSpec, PublicDialog_d_TabPanelSpec as TabPanelSpec, PublicDialog_d_TextAreaSpec as TextAreaSpec, PublicDialog_d_UrlInputData as UrlInputData, PublicDialog_d_UrlInputSpec as UrlInputSpec, PublicDialog_d_UrlDialogSpec as UrlDialogSpec, PublicDialog_d_UrlDialogFooterButtonSpec as UrlDialogFooterButtonSpec, PublicDialog_d_UrlDialogInstanceApi as UrlDialogInstanceApi, PublicDialog_d_UrlDialogActionDetails as UrlDialogActionDetails, PublicDialog_d_UrlDialogMessage as UrlDialogMessage, }; + export { PublicDialog_d_AlertBannerSpec as AlertBannerSpec, PublicDialog_d_BarSpec as BarSpec, PublicDialog_d_BodyComponentSpec as BodyComponentSpec, PublicDialog_d_ButtonSpec as ButtonSpec, PublicDialog_d_CheckboxSpec as CheckboxSpec, PublicDialog_d_CollectionItem as CollectionItem, PublicDialog_d_CollectionSpec as CollectionSpec, PublicDialog_d_ColorInputSpec as ColorInputSpec, PublicDialog_d_ColorPickerSpec as ColorPickerSpec, PublicDialog_d_CustomEditorSpec as CustomEditorSpec, PublicDialog_d_CustomEditorInit as CustomEditorInit, PublicDialog_d_CustomEditorInitFn as CustomEditorInitFn, PublicDialog_d_DialogData as DialogData, PublicDialog_d_DialogSize as DialogSize, PublicDialog_d_DialogSpec as DialogSpec, PublicDialog_d_DialogInstanceApi as DialogInstanceApi, PublicDialog_d_DialogFooterButtonSpec as DialogFooterButtonSpec, PublicDialog_d_DialogActionDetails as DialogActionDetails, PublicDialog_d_DialogChangeDetails as DialogChangeDetails, PublicDialog_d_DialogTabChangeDetails as DialogTabChangeDetails, PublicDialog_d_DropZoneSpec as DropZoneSpec, PublicDialog_d_GridSpec as GridSpec, PublicDialog_d_HtmlPanelSpec as HtmlPanelSpec, PublicDialog_d_IframeSpec as IframeSpec, PublicDialog_d_ImagePreviewSpec as ImagePreviewSpec, PublicDialog_d_InputSpec as InputSpec, PublicDialog_d_LabelSpec as LabelSpec, PublicDialog_d_ListBoxSpec as ListBoxSpec, PublicDialog_d_ListBoxItemSpec as ListBoxItemSpec, PublicDialog_d_ListBoxNestedItemSpec as ListBoxNestedItemSpec, PublicDialog_d_ListBoxSingleItemSpec as ListBoxSingleItemSpec, PublicDialog_d_PanelSpec as PanelSpec, PublicDialog_d_SelectBoxSpec as SelectBoxSpec, PublicDialog_d_SelectBoxItemSpec as SelectBoxItemSpec, PublicDialog_d_SizeInputSpec as SizeInputSpec, PublicDialog_d_SliderSpec as SliderSpec, PublicDialog_d_TableSpec as TableSpec, PublicDialog_d_TabSpec as TabSpec, PublicDialog_d_TabPanelSpec as TabPanelSpec, PublicDialog_d_TextAreaSpec as TextAreaSpec, PublicDialog_d_TreeSpec as TreeSpec, PublicDialog_d_TreeItemSpec as TreeItemSpec, DirectorySpec as TreeDirectorySpec, LeafSpec as TreeLeafSpec, PublicDialog_d_UrlInputData as UrlInputData, PublicDialog_d_UrlInputSpec as UrlInputSpec, PublicDialog_d_UrlDialogSpec as UrlDialogSpec, PublicDialog_d_UrlDialogFooterButtonSpec as UrlDialogFooterButtonSpec, PublicDialog_d_UrlDialogInstanceApi as UrlDialogInstanceApi, PublicDialog_d_UrlDialogActionDetails as UrlDialogActionDetails, PublicDialog_d_UrlDialogMessage as UrlDialogMessage, }; } type PublicInlineContent_d_AutocompleterSpec = AutocompleterSpec; type PublicInlineContent_d_AutocompleterItemSpec = AutocompleterItemSpec; @@ -1077,69 +1191,6 @@ type PublicSidebar_d_SidebarInstanceApi = SidebarInstanceApi; declare namespace PublicSidebar_d { export { PublicSidebar_d_SidebarSpec as SidebarSpec, PublicSidebar_d_SidebarInstanceApi as SidebarInstanceApi, }; } -interface ToolbarGroupSetting { - name: string; - items: string[]; -} -declare type ToolbarConfig = string | ToolbarGroupSetting[]; -interface GroupToolbarButtonInstanceApi extends BaseToolbarButtonInstanceApi { -} -interface GroupToolbarButtonSpec extends BaseToolbarButtonSpec { - type?: 'grouptoolbarbutton'; - items?: ToolbarConfig; -} -declare type MenuButtonItemTypes = NestedMenuItemContents; -declare type SuccessCallback$1 = (menu: string | MenuButtonItemTypes[]) => void; -interface MenuButtonFetchContext { - pattern: string; -} -interface BaseMenuButtonSpec { - text?: string; - tooltip?: string; - icon?: string; - search?: boolean | { - placeholder?: string; - }; - fetch: (success: SuccessCallback$1, fetchContext: MenuButtonFetchContext) => void; - onSetup?: (api: BaseMenuButtonInstanceApi) => (api: BaseMenuButtonInstanceApi) => void; -} -interface BaseMenuButtonInstanceApi { - isEnabled: () => boolean; - setEnabled: (state: boolean) => void; - isActive: () => boolean; - setActive: (state: boolean) => void; -} -interface ToolbarMenuButtonSpec extends BaseMenuButtonSpec { - type?: 'menubutton'; - onSetup?: (api: ToolbarMenuButtonInstanceApi) => (api: ToolbarMenuButtonInstanceApi) => void; -} -interface ToolbarMenuButtonInstanceApi extends BaseMenuButtonInstanceApi { -} -declare type ToolbarSplitButtonItemTypes = ChoiceMenuItemSpec | SeparatorMenuItemSpec; -declare type SuccessCallback = (menu: ToolbarSplitButtonItemTypes[]) => void; -declare type SelectPredicate = (value: string) => boolean; -declare type PresetTypes = 'color' | 'normal' | 'listpreview'; -declare type ColumnTypes = number | 'auto'; -interface ToolbarSplitButtonSpec { - type?: 'splitbutton'; - tooltip?: string; - icon?: string; - text?: string; - select?: SelectPredicate; - presets?: PresetTypes; - columns?: ColumnTypes; - fetch: (success: SuccessCallback) => void; - onSetup?: (api: ToolbarSplitButtonInstanceApi) => (api: ToolbarSplitButtonInstanceApi) => void; - onAction: (api: ToolbarSplitButtonInstanceApi) => void; - onItemAction: (api: ToolbarSplitButtonInstanceApi, value: string) => void; -} -interface ToolbarSplitButtonInstanceApi { - isEnabled: () => boolean; - setEnabled: (state: boolean) => void; - setIconFill: (id: string, value: string) => void; - isActive: () => boolean; - setActive: (state: boolean) => void; -} type PublicToolbar_d_ToolbarButtonSpec = ToolbarButtonSpec; type PublicToolbar_d_ToolbarButtonInstanceApi = ToolbarButtonInstanceApi; type PublicToolbar_d_ToolbarSplitButtonSpec = ToolbarSplitButtonSpec; @@ -1153,13 +1204,35 @@ type PublicToolbar_d_GroupToolbarButtonInstanceApi = GroupToolbarButtonInstanceA declare namespace PublicToolbar_d { export { PublicToolbar_d_ToolbarButtonSpec as ToolbarButtonSpec, PublicToolbar_d_ToolbarButtonInstanceApi as ToolbarButtonInstanceApi, PublicToolbar_d_ToolbarSplitButtonSpec as ToolbarSplitButtonSpec, PublicToolbar_d_ToolbarSplitButtonInstanceApi as ToolbarSplitButtonInstanceApi, PublicToolbar_d_ToolbarMenuButtonSpec as ToolbarMenuButtonSpec, PublicToolbar_d_ToolbarMenuButtonInstanceApi as ToolbarMenuButtonInstanceApi, PublicToolbar_d_ToolbarToggleButtonSpec as ToolbarToggleButtonSpec, PublicToolbar_d_ToolbarToggleButtonInstanceApi as ToolbarToggleButtonInstanceApi, PublicToolbar_d_GroupToolbarButtonSpec as GroupToolbarButtonSpec, PublicToolbar_d_GroupToolbarButtonInstanceApi as GroupToolbarButtonInstanceApi, }; } -interface ViewNormalButtonSpec { - type: 'button'; - text: string; +interface ViewButtonApi { + setIcon: (newIcon: string) => void; +} +interface ViewToggleButtonApi extends ViewButtonApi { + isActive: () => boolean; + setActive: (state: boolean) => void; +} +interface BaseButtonSpec { + text?: string; + icon?: string; + tooltip?: string; buttonType?: 'primary' | 'secondary'; - onAction: () => void; + borderless?: boolean; + onAction: (api: Api) => void; +} +interface ViewNormalButtonSpec extends BaseButtonSpec { + text: string; + type: 'button'; +} +interface ViewToggleButtonSpec extends BaseButtonSpec { + type: 'togglebutton'; + active?: boolean; + onAction: (api: ViewToggleButtonApi) => void; +} +interface ViewButtonsGroupSpec { + type: 'group'; + buttons: Array; } -declare type ViewButtonSpec = ViewNormalButtonSpec; +type ViewButtonSpec = ViewNormalButtonSpec | ViewToggleButtonSpec | ViewButtonsGroupSpec; interface ViewInstanceApi { getContainer: () => HTMLElement; } @@ -1203,7 +1276,7 @@ interface Registry$1 { interface AutocompleteLookupData { readonly matchText: string; readonly items: AutocompleterContents[]; - readonly columns: ColumnTypes$1; + readonly columns: ColumnTypes; readonly onAction: (autoApi: AutocompleterInstanceApi, rng: Range, value: string, meta: Record) => void; readonly highlightOn: string[]; } @@ -1216,12 +1289,12 @@ interface RangeLikeObject { endContainer: Node; endOffset: number; } -declare type ApplyFormat = BlockFormat | InlineFormat | SelectorFormat; -declare type RemoveFormat = RemoveBlockFormat | RemoveInlineFormat | RemoveSelectorFormat; -declare type Format = ApplyFormat | RemoveFormat; -declare type Formats = Record; -declare type FormatAttrOrStyleValue = string | ((vars?: FormatVars) => string | null); -declare type FormatVars = Record; +type ApplyFormat = BlockFormat | InlineFormat | SelectorFormat; +type RemoveFormat = RemoveBlockFormat | RemoveInlineFormat | RemoveSelectorFormat; +type Format = ApplyFormat | RemoveFormat; +type Formats = Record; +type FormatAttrOrStyleValue = string | ((vars?: FormatVars) => string | null); +type FormatVars = Record; interface BaseFormat { ceFalseOverride?: boolean; classes?: string | string[]; @@ -1290,7 +1363,7 @@ interface ParserArgs { no_events?: boolean; [key: string]: any; } -declare type ParserFilterCallback = (nodes: AstNode[], name: string, args: ParserArgs) => void; +type ParserFilterCallback = (nodes: AstNode[], name: string, args: ParserArgs) => void; interface ParserFilter extends Filter { } interface DomParserSettings { @@ -1300,18 +1373,22 @@ interface DomParserSettings { allow_html_in_named_anchor?: boolean; allow_script_urls?: boolean; allow_unsafe_link_target?: boolean; + blob_cache?: BlobCache; convert_fonts_to_spans?: boolean; + convert_unsafe_embeds?: boolean; + document?: Document; fix_list_elements?: boolean; font_size_legacy_values?: string; forced_root_block?: boolean | string; forced_root_block_attrs?: Record; + inline_styles?: boolean; + pad_empty_with_br?: boolean; preserve_cdata?: boolean; remove_trailing_brs?: boolean; root_name?: string; + sandbox_iframes?: boolean; + sanitize?: boolean; validate?: boolean; - inline_styles?: boolean; - blob_cache?: BlobCache; - document?: Document; } interface DomParser { schema: Schema; @@ -1330,13 +1407,15 @@ interface StyleSheetLoaderSettings { } interface StyleSheetLoader { load: (url: string) => Promise; + loadRawCss: (key: string, css: string) => void; loadAll: (urls: string[]) => Promise; unload: (url: string) => void; + unloadRawCss: (key: string) => void; unloadAll: (urls: string[]) => void; _setReferrerPolicy: (referrerPolicy: ReferrerPolicy) => void; _setContentCssCors: (contentCssCors: boolean) => void; } -declare type Registry = Registry$1; +type Registry = Registry$1; interface EditorUiApi { show: () => void; hide: () => void; @@ -1354,10 +1433,11 @@ declare namespace Ui_d { export { Ui_d_Registry as Registry, PublicDialog_d as Dialog, PublicInlineContent_d as InlineContent, PublicMenu_d as Menu, PublicView_d as View, PublicSidebar_d as Sidebar, PublicToolbar_d as Toolbar, Ui_d_EditorUiApi as EditorUiApi, Ui_d_EditorUi as EditorUi, }; } interface WindowParams { - readonly inline?: 'cursor' | 'toolbar'; + readonly inline?: 'cursor' | 'toolbar' | 'bottom'; readonly ariaAttrs?: boolean; + readonly persistent?: boolean; } -declare type InstanceApi = UrlDialogInstanceApi | DialogInstanceApi; +type InstanceApi = UrlDialogInstanceApi | DialogInstanceApi; interface WindowManagerImpl { open: (config: DialogSpec, params: WindowParams | undefined, closeWindow: (dialog: DialogInstanceApi) => void) => DialogInstanceApi; openUrl: (config: UrlDialogSpec, closeWindow: (dialog: UrlDialogInstanceApi) => void) => UrlDialogInstanceApi; @@ -1476,6 +1556,9 @@ interface PastePostProcessEvent { node: HTMLElement; readonly internal: boolean; } +interface EditableRootStateChangeEvent { + state: boolean; +} interface NewTableRowEvent { node: HTMLTableRowElement; } @@ -1510,6 +1593,8 @@ interface EditorEventMap extends Omit { }; 'resize': UIEvent; 'scroll': UIEvent; + 'input': InputEvent; + 'beforeinput': InputEvent; 'detach': {}; 'remove': {}; 'init': {}; @@ -1629,6 +1714,7 @@ type EventTypes_d_PostProcessEvent = PostProcessEvent; type EventTypes_d_PastePlainTextToggleEvent = PastePlainTextToggleEvent; type EventTypes_d_PastePreProcessEvent = PastePreProcessEvent; type EventTypes_d_PastePostProcessEvent = PastePostProcessEvent; +type EventTypes_d_EditableRootStateChangeEvent = EditableRootStateChangeEvent; type EventTypes_d_NewTableRowEvent = NewTableRowEvent; type EventTypes_d_NewTableCellEvent = NewTableCellEvent; type EventTypes_d_TableEventData = TableEventData; @@ -1638,7 +1724,7 @@ type EventTypes_d_OpenNotificationEvent = OpenNotificationEvent; type EventTypes_d_EditorEventMap = EditorEventMap; type EventTypes_d_EditorManagerEventMap = EditorManagerEventMap; declare namespace EventTypes_d { - export { EventTypes_d_ExecCommandEvent as ExecCommandEvent, EventTypes_d_BeforeGetContentEvent as BeforeGetContentEvent, EventTypes_d_GetContentEvent as GetContentEvent, EventTypes_d_BeforeSetContentEvent as BeforeSetContentEvent, EventTypes_d_SetContentEvent as SetContentEvent, EventTypes_d_SaveContentEvent as SaveContentEvent, EventTypes_d_NewBlockEvent as NewBlockEvent, EventTypes_d_NodeChangeEvent as NodeChangeEvent, EventTypes_d_FormatEvent as FormatEvent, EventTypes_d_ObjectResizeEvent as ObjectResizeEvent, EventTypes_d_ObjectSelectedEvent as ObjectSelectedEvent, EventTypes_d_ScrollIntoViewEvent as ScrollIntoViewEvent, EventTypes_d_SetSelectionRangeEvent as SetSelectionRangeEvent, EventTypes_d_ShowCaretEvent as ShowCaretEvent, EventTypes_d_SwitchModeEvent as SwitchModeEvent, EventTypes_d_ChangeEvent as ChangeEvent, EventTypes_d_AddUndoEvent as AddUndoEvent, EventTypes_d_UndoRedoEvent as UndoRedoEvent, EventTypes_d_WindowEvent as WindowEvent, EventTypes_d_ProgressStateEvent as ProgressStateEvent, EventTypes_d_AfterProgressStateEvent as AfterProgressStateEvent, EventTypes_d_PlaceholderToggleEvent as PlaceholderToggleEvent, EventTypes_d_LoadErrorEvent as LoadErrorEvent, EventTypes_d_PreProcessEvent as PreProcessEvent, EventTypes_d_PostProcessEvent as PostProcessEvent, EventTypes_d_PastePlainTextToggleEvent as PastePlainTextToggleEvent, EventTypes_d_PastePreProcessEvent as PastePreProcessEvent, EventTypes_d_PastePostProcessEvent as PastePostProcessEvent, EventTypes_d_NewTableRowEvent as NewTableRowEvent, EventTypes_d_NewTableCellEvent as NewTableCellEvent, EventTypes_d_TableEventData as TableEventData, EventTypes_d_TableModifiedEvent as TableModifiedEvent, EventTypes_d_BeforeOpenNotificationEvent as BeforeOpenNotificationEvent, EventTypes_d_OpenNotificationEvent as OpenNotificationEvent, EventTypes_d_EditorEventMap as EditorEventMap, EventTypes_d_EditorManagerEventMap as EditorManagerEventMap, }; + export { EventTypes_d_ExecCommandEvent as ExecCommandEvent, EventTypes_d_BeforeGetContentEvent as BeforeGetContentEvent, EventTypes_d_GetContentEvent as GetContentEvent, EventTypes_d_BeforeSetContentEvent as BeforeSetContentEvent, EventTypes_d_SetContentEvent as SetContentEvent, EventTypes_d_SaveContentEvent as SaveContentEvent, EventTypes_d_NewBlockEvent as NewBlockEvent, EventTypes_d_NodeChangeEvent as NodeChangeEvent, EventTypes_d_FormatEvent as FormatEvent, EventTypes_d_ObjectResizeEvent as ObjectResizeEvent, EventTypes_d_ObjectSelectedEvent as ObjectSelectedEvent, EventTypes_d_ScrollIntoViewEvent as ScrollIntoViewEvent, EventTypes_d_SetSelectionRangeEvent as SetSelectionRangeEvent, EventTypes_d_ShowCaretEvent as ShowCaretEvent, EventTypes_d_SwitchModeEvent as SwitchModeEvent, EventTypes_d_ChangeEvent as ChangeEvent, EventTypes_d_AddUndoEvent as AddUndoEvent, EventTypes_d_UndoRedoEvent as UndoRedoEvent, EventTypes_d_WindowEvent as WindowEvent, EventTypes_d_ProgressStateEvent as ProgressStateEvent, EventTypes_d_AfterProgressStateEvent as AfterProgressStateEvent, EventTypes_d_PlaceholderToggleEvent as PlaceholderToggleEvent, EventTypes_d_LoadErrorEvent as LoadErrorEvent, EventTypes_d_PreProcessEvent as PreProcessEvent, EventTypes_d_PostProcessEvent as PostProcessEvent, EventTypes_d_PastePlainTextToggleEvent as PastePlainTextToggleEvent, EventTypes_d_PastePreProcessEvent as PastePreProcessEvent, EventTypes_d_PastePostProcessEvent as PastePostProcessEvent, EventTypes_d_EditableRootStateChangeEvent as EditableRootStateChangeEvent, EventTypes_d_NewTableRowEvent as NewTableRowEvent, EventTypes_d_NewTableCellEvent as NewTableCellEvent, EventTypes_d_TableEventData as TableEventData, EventTypes_d_TableModifiedEvent as TableModifiedEvent, EventTypes_d_BeforeOpenNotificationEvent as BeforeOpenNotificationEvent, EventTypes_d_OpenNotificationEvent as OpenNotificationEvent, EventTypes_d_EditorEventMap as EditorEventMap, EventTypes_d_EditorManagerEventMap as EditorManagerEventMap, }; } type Format_d_Formats = Formats; type Format_d_Format = Format; @@ -1653,8 +1739,8 @@ type Format_d_RemoveSelectorFormat = RemoveSelectorFormat; declare namespace Format_d { export { Format_d_Formats as Formats, Format_d_Format as Format, Format_d_ApplyFormat as ApplyFormat, Format_d_BlockFormat as BlockFormat, Format_d_InlineFormat as InlineFormat, Format_d_SelectorFormat as SelectorFormat, Format_d_RemoveFormat as RemoveFormat, Format_d_RemoveBlockFormat as RemoveBlockFormat, Format_d_RemoveInlineFormat as RemoveInlineFormat, Format_d_RemoveSelectorFormat as RemoveSelectorFormat, }; } -declare type StyleFormat = BlockStyleFormat | InlineStyleFormat | SelectorStyleFormat; -declare type AllowedFormat = Separator | FormatReference | StyleFormat | NestedFormatting; +type StyleFormat = BlockStyleFormat | InlineStyleFormat | SelectorStyleFormat; +type AllowedFormat = Separator | FormatReference | StyleFormat | NestedFormatting; interface Separator { title: string; } @@ -1678,39 +1764,40 @@ interface InlineStyleFormat extends InlineFormat, CommonStyleFormat { } interface SelectorStyleFormat extends SelectorFormat, CommonStyleFormat { } -declare type EntityEncoding = 'named' | 'numeric' | 'raw' | 'named,numeric' | 'named+numeric' | 'numeric,named' | 'numeric+named'; +type EntityEncoding = 'named' | 'numeric' | 'raw' | 'named,numeric' | 'named+numeric' | 'numeric,named' | 'numeric+named'; interface ContentLanguage { readonly title: string; readonly code: string; readonly customCode?: string; } -declare type ThemeInitFunc = (editor: Editor, elm: HTMLElement) => { +type ThemeInitFunc = (editor: Editor, elm: HTMLElement) => { editorContainer: HTMLElement; iframeContainer: HTMLElement; height?: number; iframeHeight?: number; api?: EditorUiApi; }; -declare type SetupCallback = (editor: Editor) => void; -declare type FilePickerCallback = (callback: (value: string, meta?: Record) => void, value: string, meta: Record) => void; -declare type FilePickerValidationStatus = 'valid' | 'unknown' | 'invalid' | 'none'; -declare type FilePickerValidationCallback = (info: { +type SetupCallback = (editor: Editor) => void; +type FilePickerCallback = (callback: (value: string, meta?: Record) => void, value: string, meta: Record) => void; +type FilePickerValidationStatus = 'valid' | 'unknown' | 'invalid' | 'none'; +type FilePickerValidationCallback = (info: { type: string; url: string; }, callback: (validation: { status: FilePickerValidationStatus; message: string; }) => void) => void; -declare type PastePreProcessFn = (editor: Editor, args: PastePreProcessEvent) => void; -declare type PastePostProcessFn = (editor: Editor, args: PastePostProcessEvent) => void; -declare type URLConverter = (url: string, name: string, elm?: string | Element) => string; -declare type URLConverterCallback = (url: string, node: Node | string | undefined, on_save: boolean, name: string) => string; +type PastePreProcessFn = (editor: Editor, args: PastePreProcessEvent) => void; +type PastePostProcessFn = (editor: Editor, args: PastePostProcessEvent) => void; +type URLConverter = (url: string, name: string, elm?: string | Element) => string; +type URLConverterCallback = (url: string, node: Node | string | undefined, on_save: boolean, name: string) => string; interface ToolbarGroup { name?: string; items: string[]; } -declare type ToolbarMode = 'floating' | 'sliding' | 'scrolling' | 'wrap'; -declare type ToolbarLocation = 'top' | 'bottom' | 'auto'; +type ToolbarMode = 'floating' | 'sliding' | 'scrolling' | 'wrap'; +type ToolbarLocation = 'top' | 'bottom' | 'auto'; +type ForceHexColor = 'always' | 'rgb_only' | 'off'; interface BaseEditorOptions { a11y_advanced_options?: boolean; add_form_submit_trigger?: boolean; @@ -1751,17 +1838,20 @@ interface BaseEditorOptions { contextmenu?: string | string[] | false; contextmenu_never_use_native?: boolean; convert_fonts_to_spans?: boolean; + convert_unsafe_embeds?: boolean; convert_urls?: boolean; custom_colors?: boolean; custom_elements?: string; custom_ui_selector?: string; custom_undo_redo_levels?: number; + default_font_stack?: string[]; deprecation_warnings?: boolean; directionality?: 'ltr' | 'rtl'; doctype?: string; document_base_url?: string; draggable_modal?: boolean; editable_class?: string; + editable_root?: boolean; element_format?: 'xhtml' | 'html'; elementpath?: boolean; encoding?: string; @@ -1782,12 +1872,16 @@ interface BaseEditorOptions { font_size_legacy_values?: string; font_size_style_values?: string; font_size_formats?: string; + font_size_input_default_unit?: string; + force_hex_color?: ForceHexColor; forced_root_block?: string; forced_root_block_attrs?: Record; formats?: Formats; format_noneditable_selector?: string; height?: number | string; + help_accessibility?: boolean; hidden_input?: boolean; + highlight_on_focus?: boolean; icons?: string; icons_url?: string; id?: string; @@ -1828,12 +1922,14 @@ interface BaseEditorOptions { min_width?: number; model?: string; model_url?: string; + newdocument_content?: string; newline_behavior?: 'block' | 'linebreak' | 'invert' | 'default'; no_newline_selector?: string; noneditable_class?: string; noneditable_regexp?: RegExp | RegExp[]; nowrap?: boolean; object_resizing?: boolean | string; + pad_empty_with_br?: boolean; paste_as_text?: boolean; paste_block_drop?: boolean; paste_data_images?: boolean; @@ -1857,6 +1953,7 @@ interface BaseEditorOptions { resize?: boolean | 'both'; resize_img_proportional?: boolean; root_name?: string; + sandbox_iframes?: boolean; schema?: SchemaType; selector?: string; setup?: SetupCallback; @@ -1892,6 +1989,7 @@ interface BaseEditorOptions { toolbar_sticky?: boolean; toolbar_sticky_offset?: number; typeahead_urls?: boolean; + ui_mode?: 'combined' | 'split'; url_converter?: URLConverter; url_converter_scope?: any; urlconverter_callback?: URLConverterCallback; @@ -1904,6 +2002,7 @@ interface BaseEditorOptions { visual_anchor_class?: string; visual_table_class?: string; width?: number | string; + xss_sanitization?: boolean; disable_nodechange?: boolean; forced_plugins?: string | string[]; plugin_base_urls?: Record; @@ -1938,20 +2037,27 @@ interface EditorOptions extends NormalizedEditorOptions { color_default_foreground: string; content_css: string[]; contextmenu: string[]; + convert_unsafe_embeds: boolean; custom_colors: boolean; + default_font_stack: string[]; document_base_url: string; + init_content_sync: boolean; draggable_modal: boolean; editable_class: string; + editable_root: boolean; font_css: string[]; font_family_formats: string; font_size_classes: string; font_size_formats: string; + font_size_input_default_unit: string; font_size_legacy_values: string; font_size_style_values: string; forced_root_block: string; forced_root_block_attrs: Record; + force_hex_color: ForceHexColor; format_noneditable_selector: string; height: number | string; + highlight_on_focus: boolean; iframe_attrs: Record; images_file_types: string; images_upload_base_path: string; @@ -1971,15 +2077,18 @@ interface EditorOptions extends NormalizedEditorOptions { }>; menubar: boolean | string; model: string; + newdocument_content: string; no_newline_selector: string; noneditable_class: string; noneditable_regexp: RegExp[]; object_resizing: string; + pad_empty_with_br: boolean; paste_as_text: boolean; preview_styles: string; promotion: boolean; readonly: boolean; removed_menuitems: string; + sandbox_iframes: boolean; toolbar: boolean | string | string[] | Array; toolbar_groups: Record; toolbar_location: ToolbarLocation; @@ -1993,20 +2102,22 @@ interface EditorOptions extends NormalizedEditorOptions { visual_anchor_class: string; visual_table_class: string; width: number | string; + xss_sanitization: boolean; } -declare type StyleMap = Record; +type StyleMap = Record; interface StylesSettings { allow_script_urls?: boolean; allow_svg_data_urls?: boolean; url_converter?: URLConverter; url_converter_scope?: any; + force_hex_color?: ForceHexColor; } interface Styles { parse: (css: string | undefined) => Record; serialize: (styles: StyleMap, elementName?: string) => string; } -declare type EventUtilsCallback = (event: EventUtilsEvent) => void | boolean; -declare type EventUtilsEvent = NormalizedEvent & { +type EventUtilsCallback = (event: EventUtilsEvent) => void | boolean; +type EventUtilsEvent = NormalizedEvent & { metaKey: boolean; }; interface Callback$1 { @@ -2060,17 +2171,18 @@ interface DOMUtilsSettings { onSetAttrib: (event: SetAttribEvent) => void; contentCssCors: boolean; referrerPolicy: ReferrerPolicy; + force_hex_color: ForceHexColor; } -declare type Target = Node | Window; -declare type RunArguments = string | T | Array | null; -declare type BoundEvent = [ +type Target = Node | Window; +type RunArguments = string | T | Array | null; +type BoundEvent = [ Target, string, EventUtilsCallback, any ]; -declare type Callback = EventUtilsCallback>; -declare type RunResult = T extends Array ? R[] : false | R; +type Callback = EventUtilsCallback>; +type RunResult = T extends Array ? R[] : false | R; interface DOMUtils { doc: Document; settings: Partial; @@ -2178,7 +2290,9 @@ interface DOMUtils { findCommonAncestor: (a: Node, b: Node) => Node | null; run(this: DOMUtils, elm: T | T[], func: (node: T) => R, scope?: any): typeof elm extends Array ? R[] : R; run(this: DOMUtils, elm: RunArguments, func: (node: T) => R, scope?: any): RunResult; - isEmpty: (node: Node, elements?: Record) => boolean; + isEmpty: (node: Node, elements?: Record, options?: ({ + includeZwsp?: boolean; + })) => boolean; createRng: () => Range; nodeIndex: (node: Node, normalized?: boolean) => number; split: { @@ -2197,6 +2311,7 @@ interface DOMUtils { dispatch: (target: Node | Window, name: string, evt?: {}) => EventUtils; getContentEditable: (node: Node) => string | null; getContentEditableParent: (node: Node) => string | null; + isEditable: (node: Node | null | undefined) => boolean; destroy: () => void; isChildOf: (node: Node, parent: Node) => boolean; dumpRng: (r: Range) => string; @@ -2228,7 +2343,7 @@ interface WriterSettings { indent_after?: string; indent_before?: string; } -declare type Attributes = Array<{ +type Attributes = Array<{ name: string; value: string; }>; @@ -2251,6 +2366,7 @@ interface HtmlSerializer { serialize: (node: AstNode) => string; } interface DomSerializerSettings extends DomParserSettings, WriterSettings, SchemaSettings, HtmlSerializerSettings { + remove_trailing_brs?: boolean; url_converter?: URLConverter; url_converter_scope?: {}; } @@ -2298,6 +2414,7 @@ interface EditorSelection { moveToBookmark: (bookmark: Bookmark) => void; select: (node: Node, content?: boolean) => Node; isCollapsed: () => boolean; + isEditable: () => boolean; isForward: () => boolean; setNode: (elm: Element) => Element; getNode: () => HTMLElement; @@ -2329,8 +2446,8 @@ interface EditorSelection { type: 'word'; }) => void; } -declare type EditorCommandCallback = (this: S, ui: boolean, value: any) => void; -declare type EditorCommandsCallback = (command: string, ui: boolean, value?: any) => void; +type EditorCommandCallback = (this: S, ui: boolean, value: any) => void; +type EditorCommandsCallback = (command: string, ui: boolean, value?: any) => void; interface Commands { state: Record boolean>; exec: Record; @@ -2363,13 +2480,13 @@ declare class EditorCommands { interface RawString { raw: string; } -declare type Primitive = string | number | boolean | Record | Function; -declare type TokenisedString = [ +type Primitive = string | number | boolean | Record | Function; +type TokenisedString = [ string, ...Primitive[] ]; -declare type Untranslated = Primitive | TokenisedString | RawString | null | undefined; -declare type TranslatedString = string; +type Untranslated = Primitive | TokenisedString | RawString | null | undefined; +type TranslatedString = string; interface I18n { getData: () => Record>; setCode: (newCode: string) => void; @@ -2487,8 +2604,8 @@ interface ProcessorError { valid: false; message: string; } -declare type SimpleProcessor = (value: unknown) => boolean; -declare type Processor = (value: unknown) => ProcessorSuccess | ProcessorError; +type SimpleProcessor = (value: unknown) => boolean; +type Processor = (value: unknown) => ProcessorSuccess | ProcessorError; interface BuiltInOptionTypeMap { 'string': string; 'number': number; @@ -2500,7 +2617,7 @@ interface BuiltInOptionTypeMap { 'object[]': any[]; 'regexp': RegExp; } -declare type BuiltInOptionType = keyof BuiltInOptionTypeMap; +type BuiltInOptionType = keyof BuiltInOptionTypeMap; interface BaseOptionSpec { immutable?: boolean; deprecated?: boolean; @@ -2549,7 +2666,7 @@ interface EditorUpload { scanForImages: () => Promise; destroy: () => void; } -declare type FormatChangeCallback = (state: boolean, data: { +type FormatChangeCallback = (state: boolean, data: { node: Node; format: string; parents: Element[]; @@ -2594,7 +2711,7 @@ interface Model { readonly clearSelectedCells: (container: Node) => void; }; } -declare type ModelManager = AddOnManager; +type ModelManager = AddOnManager; interface Plugin { getMetadata?: () => { name: string; @@ -2603,12 +2720,12 @@ interface Plugin { init?: (editor: Editor, url: string) => void; [key: string]: any; } -declare type PluginManager = AddOnManager; +type PluginManager = AddOnManager; interface ShortcutsConstructor { readonly prototype: Shortcuts; new (editor: Editor): Shortcuts; } -declare type CommandFunc = string | [ +type CommandFunc = string | [ string, boolean, any @@ -2638,11 +2755,11 @@ interface Theme { execCommand?: (command: string, ui?: boolean, value?: any) => boolean; destroy?: () => void; init?: (editor: Editor, url: string) => void; - renderUI?: () => RenderResult; + renderUI?: () => Promise | RenderResult; getNotificationManagerImpl?: () => NotificationManagerImpl; getWindowManagerImpl?: () => WindowManagerImpl; } -declare type ThemeManager = AddOnManager; +type ThemeManager = AddOnManager; interface EditorConstructor { readonly prototype: Editor; new (id: string, options: RawEditorOptions, editorManager: EditorManager): Editor; @@ -2659,6 +2776,7 @@ declare class Editor implements EditorObservable { ui: EditorUi; mode: EditorMode; options: Options; + editorUpload: EditorUpload; shortcuts: Shortcuts; loadedCSS: Record; editorCommands: EditorCommands; @@ -2680,7 +2798,6 @@ declare class Editor implements EditorObservable { destroyed: boolean; dom: DOMUtils; editorContainer: HTMLElement; - editorUpload: EditorUpload; eventRoot: Element | undefined; formatter: Formatter; formElement: HTMLElement | undefined; @@ -2711,6 +2828,7 @@ declare class Editor implements EditorObservable { _pendingNativeEvents: string[]; _selectionOverrides: SelectionOverrides; _skinLoaded: boolean; + _editableRoot: boolean; bindPendingEventDelegates: EditorObservable['bindPendingEventDelegates']; toggleNativeEvent: EditorObservable['toggleNativeEvent']; unbindAllNativeEvents: EditorObservable['unbindAllNativeEvents']; @@ -2770,6 +2888,8 @@ declare class Editor implements EditorObservable { getBody(): HTMLElement; convertURL(url: string, name: string, elm?: string | Element): string; addVisual(elm?: HTMLElement): void; + setEditableRoot(state: boolean): void; + hasEditableRoot(): boolean; remove(): void; destroy(automatic?: boolean): void; uploadImages(): Promise; @@ -2780,8 +2900,8 @@ interface UrlObject { resource: string; suffix: string; } -declare type WaitState = 'added' | 'loaded'; -declare type AddOnConstructor = (editor: Editor, url: string) => T; +type WaitState = 'added' | 'loaded'; +type AddOnConstructor = (editor: Editor, url: string) => T; interface AddOnManager { items: AddOnConstructor[]; urls: Record; @@ -2831,7 +2951,7 @@ declare class ScriptLoader { loadQueue(): Promise; loadScripts(scripts: string[]): Promise; } -declare type TextProcessCallback = (node: Text, offset: number, text: string) => number; +type TextProcessCallback = (node: Text, offset: number, text: string) => number; interface Spot { container: Text; offset: number; @@ -2934,6 +3054,8 @@ interface IconManager { interface Resource { load: (id: string, url: string) => Promise; add: (id: string, data: any) => void; + has: (id: string) => boolean; + get: (id: string) => any; unload: (id: string) => void; } type TextPatterns_d_Pattern = Pattern; @@ -2954,15 +3076,15 @@ interface Delay { setEditorInterval: (editor: Editor, callback: () => void, time?: number) => number; setEditorTimeout: (editor: Editor, callback: () => void, time?: number) => number; } -declare type UploadResult = UploadResult$2; +type UploadResult = UploadResult$2; interface ImageUploader { upload: (blobInfos: BlobInfo[], showNotification?: boolean) => Promise; } -declare type ArrayCallback$1 = (this: any, x: T, i: number, xs: ArrayLike) => R; -declare type ObjCallback$1 = (this: any, value: T, key: string, obj: Record) => R; -declare type ArrayCallback = ArrayCallback$1; -declare type ObjCallback = ObjCallback$1; -declare type WalkCallback = (this: any, o: T, i: string, n: keyof T | undefined) => boolean | void; +type ArrayCallback$1 = (this: any, x: T, i: number, xs: ArrayLike) => R; +type ObjCallback$1 = (this: any, value: T, key: string, obj: Record) => R; +type ArrayCallback = ArrayCallback$1; +type ObjCallback = ObjCallback$1; +type WalkCallback = (this: any, o: T, i: string, n: keyof T | undefined) => boolean | void; interface Tools { is: (obj: any, type?: string) => boolean; isArray: (arr: any) => arr is Array;