AIO 編輯器
Placeholder
空內容提示文字。
編輯器(或節點)為空時顯示的提示文字。
- config key:
AioEditorCoreExtension.Placeholder - 來源:
@tiptap/extensions(Placeholder)
載入途徑:Basic 恆載(可經 exclude 關閉)。按鈕未宣告但要保留能力 → include: [AioEditorCoreExtension.Placeholder]。
排除影響(exclude: [Placeholder]): 無按鈕與依賴者受影響; 以 extraExtensions 補上同名 extension(placeholder)即為替換。
選項
| 欄位 | 型別 | 預設值 | 說明 |
|---|---|---|---|
placeholder | string 或 (props) => string | 'Write something …' | 提示文字;函式形式可依節點回傳不同提示 |
emptyEditorClass | string | 'is-editor-empty' | 整份文件為空時加在首節點之 class |
emptyNodeClass | string | 'is-empty' | 空節點之 class |
showOnlyWhenEditable | boolean | true | 僅於可編輯狀態顯示 |
showOnlyCurrent | boolean | true | 僅於游標所在節點顯示 |
includeChildren | boolean | false | 子節點也套用提示 |
覆寫範例
const config: AioEditorConfig = { extensionsConfig: { Placeholder: { placeholder: '輸入內容…' } }}提示文字經 CSS ::before 之 content: attr(data-placeholder) 呈現。