fix(app): on cancel comment unhighlight lines (#14103)
This commit is contained in:
@@ -371,6 +371,12 @@ export function FileTabContent(props: { tab: string }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cancelCommenting = () => {
|
||||||
|
const p = path()
|
||||||
|
if (p) file.setSelectedLines(p, null)
|
||||||
|
setNote("commenting", null)
|
||||||
|
}
|
||||||
|
|
||||||
createEffect(
|
createEffect(
|
||||||
on(
|
on(
|
||||||
() => state()?.loaded,
|
() => state()?.loaded,
|
||||||
@@ -484,7 +490,7 @@ export function FileTabContent(props: { tab: string }) {
|
|||||||
value={note.draft}
|
value={note.draft}
|
||||||
selection={formatCommentLabel(range())}
|
selection={formatCommentLabel(range())}
|
||||||
onInput={(value) => setNote("draft", value)}
|
onInput={(value) => setNote("draft", value)}
|
||||||
onCancel={() => setCommenting(null)}
|
onCancel={cancelCommenting}
|
||||||
onSubmit={(value) => {
|
onSubmit={(value) => {
|
||||||
const p = path()
|
const p = path()
|
||||||
if (!p) return
|
if (!p) return
|
||||||
@@ -498,7 +504,7 @@ export function FileTabContent(props: { tab: string }) {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!document.activeElement || !current.contains(document.activeElement)) {
|
if (!document.activeElement || !current.contains(document.activeElement)) {
|
||||||
setCommenting(null)
|
cancelCommenting()
|
||||||
}
|
}
|
||||||
}, 0)
|
}, 0)
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user