匯入

import-editor.ts
import { NuiEditor } from '@needless-ui/angular/editor';

NuiEditor

一個富文字編輯器。

選擇器
nui-editor
NuiEditor: 屬性
名稱型別預設值說明
value雙向繫結string''內容,以 HTML 或 Markdown 表示;沒有文字時為空。
format輸入'html' | 'markdown''html'值的寫法。
tools輸入NuiEditorTool[]NUI_EDITOR_TOOLS工具列上依序排列的按鈕,群組之間以 | 分隔。
label, labelledBy, describedBy輸入string為內容命名並加上描述。
placeholder輸入string內容為空時顯示。
readonly, disabled, invalid輸入booleanfalse依序為:只顯示內容而不可編輯;停用;標示為無效。
labels輸入Partial<NuiEditorLabels>它顯示或朗讀的所有文字,供翻譯使用。
run方法(tool: NuiEditorTool) => void執行一個工具列命令。
undo, redo, focus方法() => void依序為:復原、重做,以及把焦點移到文字中。

Helpers

用來轉換文件的函式。

Helpers: 屬性
名稱型別預設值說明
nuiEditorToHtml, nuiEditorToMarkdown方法(doc) => string把文件寫成 HTML 或 Markdown。
nuiEditorFromHtml, nuiEditorFromMarkdown方法(text, document?) => NuiEditorDoc把 HTML 或 Markdown 讀入為文件,只保留編輯器能顯示的內容。