editor-core
Work with the contenteditable editor implementation. Use when modifying text input behavior, cursor handling, or undo/redo functionality.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Work with the contenteditable editor implementation. Use when modifying text input behavior, cursor handling, or undo/redo functionality.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Work with the URL compression system in kheMessage. Use when modifying how content is stored in URLs, debugging encoding issues, or optimizing compression.
Add or improve Markdown parsing and rendering in kheMessage. Use when adding new Markdown syntax support, fixing formatting issues, or enhancing the text editor.
Work with QR code generation and display. Use when modifying QR functionality, fixing QR rendering, or adding QR features.
Customize or extend the theming system in kheMessage. Use when adding new themes, modifying colors, or enhancing theme switching.
| name | editor-core |
| description | Work with the contenteditable editor implementation. Use when modifying text input behavior, cursor handling, or undo/redo functionality. |
Work with the contenteditable editor in kheMessage.
The Editor class manages the contenteditable element:
function Editor(element, highlight) {
const listeners = []
const history = []
let at = -1, prev
// Debounced highlighting
const debounceHighlight = debounce(30, () => {
const pos = save()
highlight(element)
restore(pos)
})
// Event handlers
on('keydown', event => { /* ... */ })
on('keyup', event => { /* ... */ })
on('paste', () => setTimeout(recordHistory, 10))
on('cut', () => setTimeout(recordHistory, 10))
return {
set(content) { /* ... */ },
undo() { /* ... */ },
redo() { /* ... */ },
destroy() { /* ... */ }
}
}
Saves and restores cursor position across DOM changes:
Records editor state for undo/redo:
Applies Markdown formatting:
parseMarkdown function| Shortcut | Action |
|---|---|
| Ctrl+Z | Undo |
| Ctrl+Y / Ctrl+Shift+Z | Redo |
| Ctrl+S | Save |
| Ctrl+N | New note |
| Ctrl+O | Import file |
plaintext-only mode to avoid HTML injectionbeforeinput eventsWhen extending the editor:
on()