Fixed #1836 - For Editor

pull/1846/head
mertsincan 2021-12-01 16:37:55 +03:00
parent 6bdec40817
commit 5edb45a234
1 changed files with 79 additions and 12 deletions

View File

@ -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<EditorProps, EditorSlots, EditorEmits> { }
declare module '@vue/runtime-core' {
interface GlobalComponents {
Editor: GlobalComponentConstructor<Editor>
}
}
/**
*
* Editor is rich text editor component based on Quill.
*
* Demos:
*
* - [Editor](https://www.primefaces.org/primevue/showcase/#/editor)
*
*/
export default Editor;