From 5edb45a2346b28664b54ce0019b28f30b692a90e Mon Sep 17 00:00:00 2001 From: mertsincan Date: Wed, 1 Dec 2021 16:37:55 +0300 Subject: [PATCH] Fixed #1836 - For Editor --- src/components/editor/Editor.d.ts | 91 +++++++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 12 deletions(-) diff --git a/src/components/editor/Editor.d.ts b/src/components/editor/Editor.d.ts index 7626a72ae..2ea600213 100755 --- a/src/components/editor/Editor.d.ts +++ b/src/components/editor/Editor.d.ts @@ -1,20 +1,87 @@ import { VNode } from 'vue'; +import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; -interface EditorProps { - modelValue?: string; - placeholder?: string; - readonly?: boolean; - formats?: any[]; - editorStyle?: string; +export interface EditorTextChangeEvent { + /** + * Current value as html. + */ + htmlValue: string; + /** + * Current value as text. + */ + textValue: any; + /** + * Representation of the change. + */ + delta: any; + /** + * Source of change. Will be either "user" or "api". + */ + source: string; + /** + * Text editor instance. + */ + instance: any; } -declare class Editor { - $props: EditorProps; - $emit(eventName: 'update:modelValue', value: string): this; - $emit(eventName: 'text-change', e: { htmlValue: string, textValue: any, delta: any, source: string, instance: any}): this; - $slot: { - toolbar: VNode[]; +export interface EditorProps { + /** + * Value of the content. + */ + modelValue?: string | undefined; + /** + * Placeholder text to show when editor is empty. + */ + placeholder?: string | undefined; + /** + * Whether to instantiate the editor to readonly mode. + */ + readonly?: boolean | undefined; + /** + * Whitelist of formats to display, see [here](https://quilljs.com/docs/formats/) for available options. + */ + formats?: any[]; + /** + * Inline style of the container. + */ + editorStyle?: any; +} + +export interface EditorSlots { + /** + * Custom toolbar template. + */ + toolbar: () => VNode[]; +} + +export declare type EditorEmits = { + /** + * Emitted when the value changes. + * @param {string} value - New value. + */ + 'update:modelValue': (value: string) => void; + /** + * Callback to invoke when text of editor changes. + * @param {EditorTextChangeEvent} event - Custom text change event. + */ + 'text-change': (event: EditorTextChangeEvent) => void; +} + +declare class Editor extends ClassComponent { } + +declare module '@vue/runtime-core' { + interface GlobalComponents { + Editor: GlobalComponentConstructor } } +/** + * + * Editor is rich text editor component based on Quill. + * + * Demos: + * + * - [Editor](https://www.primefaces.org/primevue/showcase/#/editor) + * + */ export default Editor;