mirror of
https://github.com/vadimmelnicuk/meo.git
synced 2026-09-26 09:55:39 +00:00
fix: stop selection toolbox flicker when highlighting text (#76)
Closes #63.
This commit is contained in:
@@ -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
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user