匯入
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 讀入為文件,只保留編輯器能顯示的內容。 |