mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
fix double-click word
This commit is contained in:
@@ -23,7 +23,6 @@ const topicWords = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (topicWithWords.loading && selectedTextIsTimeSlice(selectedText)) {
|
if (topicWithWords.loading && selectedTextIsTimeSlice(selectedText)) {
|
||||||
setSelectedText(undefined);
|
setSelectedText(undefined);
|
||||||
console.log("unsetting topic changed");
|
|
||||||
}
|
}
|
||||||
}, [topicWithWords.loading]);
|
}, [topicWithWords.loading]);
|
||||||
|
|
||||||
@@ -94,13 +93,15 @@ const topicWords = ({
|
|||||||
);
|
);
|
||||||
// if selection end on a word, we get the end time from the span that contains it
|
// if selection end on a word, we get the end time from the span that contains it
|
||||||
const focusEnd =
|
const focusEnd =
|
||||||
selection.focusNode.parentElement?.dataset["end"] ||
|
selection.focusOffset !== 0
|
||||||
// otherwise it was a name and we get the end of the last word of the previous paragraph
|
? selection.focusNode.parentElement?.dataset["end"] ||
|
||||||
(
|
// otherwise it was a name and we get the end of the last word of the previous paragraph
|
||||||
selection.focusNode.parentElement?.parentElement
|
(
|
||||||
?.previousElementSibling?.lastElementChild as any
|
selection.focusNode.parentElement?.parentElement
|
||||||
)?.dataset["end"] ||
|
?.previousElementSibling?.lastElementChild as any
|
||||||
0;
|
)?.dataset["end"]
|
||||||
|
: (selection.focusNode.parentElement?.previousElementSibling as any)
|
||||||
|
?.dataset["end"] || 0;
|
||||||
|
|
||||||
const reverse = parseFloat(anchorStart) >= parseFloat(focusEnd);
|
const reverse = parseFloat(anchorStart) >= parseFloat(focusEnd);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user