更新文档: 测试一个代码

2025-10-20 06:09:38 +00:00
parent dae0c44991
commit 1acc794e63

@@ -1,33 +1,10 @@
# 这是一段typescript代码333
```ts
import
importddddd
```
```ts
```ts hljs language-typescript
const handleKeyDown = (e: KeyboardEvent) => {
// 在代码块内编辑时启用保护
const selection = window.getSelection();
if (selection && selection.rangeCount > 0) {
const range = selection.getRangeAt(0);
const preElement = range.commonAncestorContainer.closest('pre');
if (preElement) {
isInternalChangeRef.current = true;
}
}
};
const handleKeyUp = () => {
setTimeout(() => {
if (!vditorElement.matches(':focus')) {
isInternalChangeRef.current = false;
}
}, 100);
};
vditorElement.addEventListener('focusin', handleFocusIn);
vditorElement.addEventListener('focusout', handleFocusOut);
vditorElement.addEventListener('keydown', handleKeyDown);
vditorElement.addEventListener('keyup', handleKeyUp);
```