Fixed #1836 - For Editor
parent
6bdec40817
commit
5edb45a234
|
@ -1,20 +1,87 @@
|
||||||
import { VNode } from 'vue';
|
import { VNode } from 'vue';
|
||||||
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
||||||
|
|
||||||
interface EditorProps {
|
export interface EditorTextChangeEvent {
|
||||||
modelValue?: string;
|
/**
|
||||||
placeholder?: string;
|
* Current value as html.
|
||||||
readonly?: boolean;
|
*/
|
||||||
formats?: any[];
|
htmlValue: string;
|
||||||
editorStyle?: 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 {
|
export interface EditorProps {
|
||||||
$props: EditorProps;
|
/**
|
||||||
$emit(eventName: 'update:modelValue', value: string): this;
|
* Value of the content.
|
||||||
$emit(eventName: 'text-change', e: { htmlValue: string, textValue: any, delta: any, source: string, instance: any}): this;
|
*/
|
||||||
$slot: {
|
modelValue?: string | undefined;
|
||||||
toolbar: VNode[];
|
/**
|
||||||
|
* 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;
|
export default Editor;
|
||||||
|
|
Loading…
Reference in New Issue