fix: stop selection toolbox flicker when highlighting text (#76)

Closes #63.
This commit is contained in:
Apostol Apostolov
2026-09-05 23:02:58 +01:00
committed by GitHub
parent eaf072b0ef
commit 5cd4356528
2 changed files with 18 additions and 3 deletions
+1
View File
@@ -1,6 +1,7 @@
# Markdown Editor Optimized (MEO)
---
## Unreleased
- Fixed the selection formatting toolbox flickering while highlighting text
- Added link-reference definitions as visible linked lists in HTML and PDF exports, and restored copying selections across rendered blocks
- Added configurable CodeMirror keymap via `markdownEditorOptimized.keymap`
- Hardened external document sync (git/LLM/outside editors): prefer host content on conflict, fix stuck applyingExternal, Reload recovery
+17 -3
View File
@@ -987,11 +987,12 @@ export function createEditor({
return;
}
if (selectionPointerId !== null) {
return;
}
const selection = view.state.selection.main;
if (selection.empty) {
if (selectionPointerId !== null) {
return;
}
onSelectionChange({ visible: false });
return;
}
@@ -1786,6 +1787,17 @@ export function createEditor({
parent,
scrollTo: initialScrollTo
});
const finishSelectionOutsideEditor = (event: PointerEvent): void => {
if (selectionPointerId !== event.pointerId) {
return;
}
selectionPointerId = null;
scheduleSelectionChangeEmit();
};
window.addEventListener('pointerup', finishSelectionOutsideEditor);
window.addEventListener('pointercancel', finishSelectionOutsideEditor);
if (typeof initialTopLine === 'number' && Number.isFinite(initialTopLine)) {
restoreTopVisibleLine(initialTopLine, initialTopLineOffset, { syncCursor: true });
}
@@ -1940,6 +1952,8 @@ export function createEditor({
view.focus();
},
destroy() {
window.removeEventListener('pointerup', finishSelectionOutsideEditor);
window.removeEventListener('pointercancel', finishSelectionOutsideEditor);
gitBlameHover?.destroy();
gitBlameHover = null;
gitDiffOverviewRuler?.destroy();