AIO 編輯器
CharacterCount
字數統計與上限。
字數統計與輸入上限,自製變體:IME composition(注音 / 拼音組字)期間不套用上限裁切,於 compositionend 才截斷超出內容——避免組字過程被攔腰截斷。初始內容超限時自動裁切並於 console 警告。
- config key:
AioEditorCoreExtension.CharacterCount - 來源:自製(基於
@tiptap/extensions之CharacterCount)
載入途徑:Basic 恆載(可經 exclude 關閉)。按鈕未宣告但要保留能力 → include: [AioEditorCoreExtension.CharacterCount]。
排除影響(exclude: [CharacterCount]): 無按鈕與依賴者受影響; 以 extraExtensions 補上同名 extension(characterCount)即為替換。
選項
| 欄位 | 型別 | 預設值 | 說明 |
|---|---|---|---|
limit | number 或 null | null | 字數上限;null 或 0 不限制 |
mode | 'textSize' 或 'nodeSize' | 'textSize' | 計數模式:純文字字數或文件節點大小 |
textCounter | (text: string) => number | text.length | 自訂字數計算 |
wordCounter | (text: string) => number | 以空白切詞 | 自訂詞數計算 |
覆寫範例
const config: AioEditorConfig = { extensionsConfig: { CharacterCount: { limit: 500 } }}讀值走 storage:editor.storage.characterCount.characters() 與 editor.storage.characterCount.words()。