UNPKG

@ckeditor/ckeditor5-vue

Version:

Official Vue.js 3+ component for CKEditor 5 – the best browser-based rich text editor.

55 lines (54 loc) 2.75 kB
/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ import type { EditorRelaxedConstructor } from '@ckeditor/ckeditor5-integrations-common'; import type { EditorWithWatchdogRelaxedConstructor } from '../types.js'; import type { Editor, EditorWatchdog, WatchdogConfig } from 'ckeditor5'; declare const EDITOR_WATCHDOG_SYMBOL: unique symbol; export type EditorWithAttachedWatchdog<TEditor extends Editor = Editor> = TEditor & { [EDITOR_WATCHDOG_SYMBOL]?: EditorWatchdog; }; export type WatchdogErrorEventData<TEditor extends Editor> = { error: Error; causesRestart: boolean; watchdog: EditorWatchdog; editor: TEditor; }; /** * Returns an editor constructor optionally wrapped with EditorWatchdog. */ export declare function resolveEditorConstructor<TEditor extends Editor, TConstructor extends EditorWithWatchdogRelaxedConstructor<TEditor>>(Editor: TConstructor, disableWatchdog: boolean, watchdogConfig?: WatchdogConfig): TConstructor; /** * `EditorWatchdog#create` method does not return editor instance (returns `undefined` instead). * This function wraps editor constructor with EditorWatchdog and returns fake constructor that * returns editor instance assigned to initialized watchdog. * * It stores watchdog instance in hidden symbol assigned to editor. It simplifies storing both * instances in component's state (it's no longer required to store them separately). * * @param Editor The Editor creator to wrap. * @param watchdogConfig Watchdog configuration. * @returns The Editor creator wrapped with a watchdog. */ export declare function wrapWithWatchdogIfPresent<TEditor extends Editor>(Editor: EditorWithWatchdogRelaxedConstructor<TEditor>, watchdogConfig?: WatchdogConfig): EditorRelaxedConstructor<EditorWithAttachedWatchdog<TEditor>>; /** * Unwraps the EditorWatchdog from the editor instance. * * @param editor Editor with attached watchdog. */ export declare function unwrapEditorWatchdog(editor: EditorWithAttachedWatchdog): EditorWatchdog | null; /** * Attaches common EditorWatchdog runtime error handling. */ export declare function attachEditorWatchdogErrorHandler<TEditor extends Editor>(editor: EditorWithAttachedWatchdog<TEditor>, { isUnmounted, onError }: { isUnmounted: () => boolean; onError: (data: WatchdogErrorEventData<TEditor>) => void; }): EditorWatchdog | null; /** * It destroys the editor watchdog if it is assigned to the editor. If it is not, the editor is destroyed. * * @param editor Editor with attached watchdog. */ export declare function destroyEditorWithWatchdog(editor: EditorWithAttachedWatchdog): Promise<void>; export {};