AIO 編輯器
Extensions 總覽
AIO 編輯器全部 extension 一覽,逐一提供完整選項說明。
宣告驅動:config.features 是唯一宣告來源——宣告哪些按鈕,就載入哪些 extension(未宣告即不載入);Require(Document / Text / Paragraph)與 Basic(8 個純基建)恆載。各 extension 的選項經 config.extensionsConfig 覆寫(深層 merge:plain object 遞迴合併;陣列、function、instance 整值取代;null 清除預設、undefined 忽略),bubbles 與 dragHandle 亦同;各 default*Config 皆由 @admin/aio-editor 匯出。
import { AioEditorCoreExtension, AioEditorFeature } from '@/components/admin/aio-editor'const config: AioEditorConfig = { features: [AioEditorFeature.FontBold, AioEditorFeature.BulletList], // 宣告 = 按鈕 + 載入 include: [AioEditorCoreExtension.UndoRedo], // 無按鈕保 Ctrl+Z exclude: [AioEditorCoreExtension.CopyData], // 精準排除(一律生效,分級警告) extensionsConfig: { Heading: { levels: [1, 2, 3] }, CharacterCount: { limit: 500 } }}三種載入路徑(依生命週期選對入口)
| 你要載入的東西 | 正確路徑 | 生命週期 |
|---|---|---|
| 有 UI 的自訂能力(按鈕+它的 extension) | CustomFeature.extensions | 跟隨 feature 宣告 |
| 無 UI 的內建能力(保快捷鍵 / 輸入規則、Mention) | include | 無條件載入,自動補齊硬依賴 |
| 無 UI 的自訂能力、同名替換 | extraExtensions | 無條件載入;同名時優先權最高 |
exclude 對三者一律生效(含 Require),不連鎖卸載——依賴者靜默失效、對應按鈕自動隱藏。排除後提供同名 extension 視為替換、不警告;未替換且有依賴者受影響時 console 警告。Require(Document / Text / Paragraph)於三路徑合併後檢查,最終集合缺席才給最強警告。
標「自製」者為本系列移植之客製 extension,帶有與官方套件不同的行為,詳見各頁說明。
每頁的「載入途徑 / 排除影響」段落取自 app/registry/admin/aio/aio-feature-map.json,該檔為手動維護;調整 FEATURE_DEFS、extensionDependencies 或恆載層後須一併更新。
文字 mark
| Extension | 用途 |
|---|---|
| Bold | 粗體 |
| Italic | 斜體 |
| Strike | 刪除線 |
| Underline | 底線 |
| Code | 行內程式碼 |
| TextStyle | 行內樣式載體(Color / FontFamily / FontSize 之基底) |
| Color | 文字顏色 |
| Highlight | 螢光標記 |
| Subscript | 下標 |
| Superscript | 上標 |
區塊
| Extension | 用途 |
|---|---|
| Document / Text / Gapcursor | schema 基底與游標行為(無選項) |
| Paragraph | 段落 |
| Heading | 標題 h1–h6 |
| Blockquote | 引用區塊 |
| HorizontalRule | 水平線 |
| HardBreak | 強制斷行 |
| CodeBlock(自製) | 程式碼區塊(lowlight 高亮) |
清單
| Extension | 用途 |
|---|---|
| BulletList | 項目清單 |
| OrderedList | 編號清單 |
| ListItem | 清單項 |
| TaskList | 待辦清單 |
| TaskItem | 待辦清單項 |
| ListKeyMap(自製) | 清單鍵盤行為 |
排版
| Extension | 用途 |
|---|---|
| TextAlign | 文字對齊 |
| Indent(自製) | 區塊縮排 |
| LineHeight(自製) | 行高 |
| FontFamily | 字體 |
| FontSize(自製) | 字級 |
行為
| Extension | 用途 |
|---|---|
| UndoRedo | 編輯歷史 |
| Dropcursor | 拖放位置指示線 |
| Placeholder | 空內容提示 |
| CharacterCount(自製) | 字數統計與上限(IME 保護) |
| KeydownHandler(自製) | 鍵盤事件 hook |
| AutoJoiner | 相鄰清單自動合併 |
| CopyData(自製) | data-copy 屬性保留 |
內容節點
Opt-in(須經 include 啟用)
UI 附加(不走 extensionsConfig)
| 項目 | 設定入口 |
|---|---|
| Bubble Menu(自製) | config.bubbles |
| Drag Handle(自製) | config.dragHandle |
Feature → Extension 對映總表
| Feature | 載入 extensions | 跟隨 bubbles |
|---|---|---|
Undo | UndoRedo | — |
Redo | UndoRedo | — |
FontHeading | Heading | — |
FontSizeSelect | TextStyle、FontSize | — |
FontSizeIncrease | TextStyle、FontSize | — |
FontSizeDecrease | TextStyle、FontSize | — |
FontFamily | TextStyle、FontFamily | — |
FontBold | Bold | — |
FontItalic | Italic | — |
FontStrike | Strike | — |
FontUnderline | Underline | — |
FontCode | Code | — |
Subscript | Subscript | — |
Superscript | Superscript | — |
TextColor | TextStyle、Color | — |
Highlight | Highlight | — |
AlignLeft | TextAlign | — |
AlignCenter | TextAlign | — |
AlignRight | TextAlign | — |
AlignJustify | TextAlign | — |
Indent | Indent | — |
Outdent | Indent | — |
BulletList | BulletList、ListItem、ListKeyMap | List |
OrderedList | OrderedList、ListItem、ListKeyMap | List |
TaskList | TaskList、TaskItem、ListKeyMap | List |
Link | Link | LinkTips |
UnLink | Link | LinkTips |
Image | Image | Image |
Video | Video | — |
Table | TableKit | Table、TableRow、TableColumn |
Blockquote | Blockquote | — |
CodeBlock | CodeBlock | CodeBlock |
HorizontalRule | HorizontalRule | — |
HardBreak | HardBreak | — |
FormatParagraph | — | — |
FormatUnsetAllMarks | — | — |
FormatClearNode | — | — |
樣式補充
- CodeBlock 高亮配色:輸出帶 hljs class,配色主題由 consumer 自行引入(同 Svelte 版作法),例如
import 'highlight.js/styles/github-dark.css' - Mention / HashTag 建議樣式:節點 class 為
editor-mention/editor-hashtag、選單容器 class 為editor-suggestion——參考主元件頁 Mention demo 的樣式片段