导入
import { NuiEditor } from '@needless-ui/angular/editor';NuiEditor
一个富文本编辑器。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
value双向绑定 | string | '' | 内容,形式为 HTML 或 Markdown;没有文字时为空。 |
format输入 | 'html' | 'markdown' | 'html' | 值的写法。 |
tools输入 | NuiEditorTool[] | NUI_EDITOR_TOOLS | 工具栏上按顺序排列的按钮,组与组之间用 | 分隔。 |
label, labelledBy, describedBy输入 | string | 为内容命名并添加描述。 | |
placeholder输入 | string | 内容为空时显示。 | |
readonly, disabled, invalid输入 | boolean | false | 分别表示:只显示内容而不可编辑;禁用;标记为无效。 |
labels输入 | Partial<NuiEditorLabels> | 它显示或播报的所有文本,供翻译使用。 | |
run方法 | (tool: NuiEditorTool) => void | 执行一个工具栏命令。 | |
undo, redo, focus方法 | () => void | 分别用于撤销、重做,以及把焦点移入文本。 |
Helpers
用于转换文档的函数。
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
nuiEditorToHtml, nuiEditorToMarkdown方法 | (doc) => string | 把文档写成 HTML 或 Markdown。 | |
nuiEditorFromHtml, nuiEditorFromMarkdown方法 | (text, document?) => NuiEditorDoc | 把 HTML 或 Markdown 读入为文档,只保留编辑器能显示的内容。 |