@vuux/editor
Version:
Vue Nuxt 富文本编辑器
103 lines (102 loc) • 3.3 kB
TypeScript
import { Ref } from 'vue';
import { Align, List, Panel } from '../types';
/**
* Markdown编辑器逻辑Hook
*
* @param textareaRef 文本区域引用
*/
export declare const useMarkdown: (textareaRef: Ref<HTMLTextAreaElement | null>) => {
textareaRef: Ref<HTMLTextAreaElement | null, HTMLTextAreaElement | null>;
markdown: Ref<string, string>;
html: Ref<string | {
then: <TResult1 = string, TResult2 = never>(onfulfilled?: ((value: string) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<string | TResult>;
finally: (onfinally?: (() => void) | null | undefined) => Promise<string>;
readonly [Symbol.toStringTag]: string;
}, string | Promise<string> | {
then: <TResult1 = string, TResult2 = never>(onfulfilled?: ((value: string) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>;
catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<string | TResult>;
finally: (onfinally?: (() => void) | null | undefined) => Promise<string>;
readonly [Symbol.toStringTag]: string;
}>;
undo: () => void;
redo: () => void;
markdownActions: {
/**
* 加粗
*/
insertBold: () => void;
/**
* 下划线
*/
insertUnderline: () => void;
/**
* 斜体
*/
insertItalic: () => void;
/**
* 删除线
*/
insertStrike: () => void;
/**
* 行内代码
*/
insertInlineCode: () => void;
/**
* 标题
*/
insertHeading: (level: 1 | 2 | 3 | 4) => void;
/**
* 链接
*/
insertLink: () => void;
/**
* 图片
*/
insertImage: (url?: string, defaultAlt?: string) => void;
/**
* 列表切换(有序|无序|任务列表)支持多行互斥
*/
insertList: (type: List) => void;
/**
* 引用块
*/
insertBlockquote: () => void;
/**
* 代码块
*/
insertCodeBlock: (lang?: string) => void;
/**
* 分割线
*/
insertHr: () => void;
/**
* 表格
*/
insertTable: (rows?: number, cols?: number) => void;
/**
* 内嵌HTML
*/
insertHtmlBlock: (count?: number) => void;
/**
* 颜色选择
*/
insertColor: (color: string) => void;
/**
* 字体大小
*/
insertFontSize: (size: number) => void;
/**
* 对齐
*/
insertAlignBlock: (direction: Align) => void;
/**
* 面板
*/
insertPanel: (type: Panel, title?: string) => void;
/**
* 拼音
*/
insertPinyin: () => void;
};
};