UNPKG

@progress/kendo-vue-editor

Version:
202 lines (201 loc) 6.1 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { EditorState, Plugin, Transaction, EditorView, Schema, Node } from '@progress/kendo-editor-common'; import { EditorUtils } from './utils/main'; interface EditorEvent { /** * An event target. */ target: any; } /** * Represents the object of the `onChange` Editor event. */ export interface EditorChangeEvent extends EditorEvent { /** * Represents the [Editor document](https://prosemirror.net/docs/guide/#doc). */ value: Node; /** * A getter of the Editor HTML content. * Once called, it will convert the Editor document into HTML string. * Note that, since onChange event is triggered on every key while typing, * this conversion may not be suitable if the Editor is dealing with large amount of content. */ html: string; /** * The Editor Schema object. */ schema: Schema; /** * The Transaction which causes the change. */ transaction: Transaction; } /** * Represents the object of the `onMount` Editor event. */ export interface EditorMountEvent extends EditorEvent { /** * The content-editable DOM element of the Editor. */ dom: HTMLDivElement; /** * The default plugins collection of the Editor. */ plugins: Array<Plugin>; /** * The default key bindings of the Editor. */ shortcuts: EditorUtils.Shortcuts; /** * The default [viewProps](https://prosemirror.net/docs/ref/#view.DirectEditorProps) object of the Editor. */ viewProps: { state: EditorState; [key: string]: any; }; } /** * Represents the object of the `onPaste` Editor event. */ export interface EditorPasteEvent extends EditorEvent { /** * The HTML that will be pasted in the Editor. */ pastedHtml: string; /** * The native paste event. */ event: ClipboardEvent; } /** * Represents the object of the `onExecute` Editor event. */ export interface EditorExecuteEvent extends EditorEvent { /** * The transaction that will be executed. */ transaction: Transaction; /** * The state of the Editor. */ state: EditorState; } /** * Represents the object of the `onFocus` Editor event. */ export interface EditorFocusEvent extends EditorEvent { /** * The native focus event. */ event: FocusEvent; } /** * Represents the object of the `onBlur` Editor event. */ export interface EditorBlurEvent extends EditorEvent { /** * The native blur event. */ event: FocusEvent; } /** * Represents the props of the [Kendo UI for Vue Editor component]({% slug overview_editor %}). */ export interface EditorProps { /** * Sets the default HTML content of the Editor. */ defaultContent?: string; /** * Sets the initial edit mode of the Editor. Defaults to `iframe`. */ defaultEditMode?: 'iframe' | 'div' | string; /** * Sets styles to the content element wrapper of the Editor. */ contentStyle?: object; /** * Represents the `dir` HTML attribute. */ dir?: string; /** * Specifies if the Editor will be resizable. */ resizable?: boolean; /** * Sets the tools of the Editor. By default, the Editor renders no tools. */ tools?: Array<any>; /** * A funciton that fires each time the Editor is about to insert pasted content. * Useful for modifying pasted content. */ pasteHtml?: (event: EditorPasteEvent) => string | void; /** * Fires each time the Editor is about to mount. * Useful for configuring the `EditorView` object. * To initialize `EditorView`, use the properties of the `event` object. */ extendView?: (event: EditorMountEvent) => EditorView | void; /** * Fires each time the Editor is about to mount. * Useful for configuring the `EditorView` object. * To initialize `EditorView`, use the properties of the `event` object. */ onLoaded?: (event: EditorMountEvent) => EditorView | void; /** * Fires each time the Editor is about to apply a transaction. * To prevent the transaction, return `false`. */ onExecute?: (event: EditorExecuteEvent) => boolean | void; /** * Fires when the Editor's content element has received focus. */ onFocus?: (event: EditorFocusEvent) => void; /** * Fires when the Editor's content element has lost focus. */ onBlur?: (event: EditorBlurEvent) => void; /** * Fires each time the value of the Editor is about to change. */ onChange?: (event: EditorChangeEvent) => void; /** * The value of the Editor. */ value?: Node | string; /** * If set to `false`, it will turn off the built-in keyboard navigation of the Editor's Toolbar. */ keyboardNavigation?: boolean; /** * Defines the options that will be used for parsing the HTML. * If `false` is set, the whitespace is collapsed as per HTML's rules. * Pass `true` to preserve whitespace, but normalize newlines to spaces. * `full` will preserve whitespace entirely. * * Defaults to `full`. */ preserveWhitespace?: boolean | 'full' | string; /** * Identifies the element(s) which will describe the component, similar * to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute). */ ariaDescribedBy?: string; /** * Identifies the element(s) which will label the component. */ ariaLabelledBy?: string; /** * The accessible label of the component. */ ariaLabel?: string; } export {};