cursor-position-tracker
Tracks and manages cursor position across text inputs, rich text editors, and custom selection interfaces. Handles IME composition and RTL text.
来源信息
- 仓库
- Fadil369/Solutions
- 最近来源活动
- 2026年4月9日 00:36
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 1
- Forks
- 0
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- Cursor Position Tracker
- version
- 1.0.0
- description
- Tracks and manages cursor position across text inputs, rich text editors, and custom selection interfaces. Handles IME composition and RTL text.
- author
- workspace
- activated
- false
# Cursor Position Tracker
Tracks and manages cursor position across text inputs, rich text editors, and custom selection interfaces. Handles IME composition and RTL text.
## Decision Framework
### When to Apply
Use when: Rich text editors, custom input components, IME support needed, collaborative editing
### When NOT to Apply
Don't use when: Simple form inputs with standard behavior
## Anti-Patterns
### 1. Breaking IME Composition
```javascript
// BAD: Prevents character composition
input.addEventListener('input', (e) => { formatText(); });
// GOOD: Wait for composition end
let composing = false;
input.addEventListener('compositionstart', () => composing = true);
input.addEventListener('compositionend', () => { composing = false; formatText(); });
input.addEventListener('input', (e) => { if (!composing) formatText(); });
```
## Trigger Phrases
- "Cursor position"
- "Text selection"
- "Rich text editor"
- "IME support"
- "Text input handling"
## Patterns
### Selection Manager
```javascript
class SelectionManager {
saveSelection() {
const sel = window.getSelection();
if (sel.rangeCount > 0) return sel.getRangeAt(0).cloneRange();
return null;
}
restoreSelection(range) {
if (!range) return;
const sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}
}
```
## Integration
- Works with: real-time-collaboration-engine, form-pattern-engine
在 GitHub 查看