diff options
| author | Adam <[email protected]> | 2025-11-05 11:59:10 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-11-05 11:59:10 -0600 |
| commit | 674febcf6057ecea206406ffb4b90edd19872529 (patch) | |
| tree | de26ee6f4c4155db9a7bdcded9e15b4eb464aaf4 /packages/desktop/src/components/code.tsx | |
| parent | 582d9a962236789ebc6e8ec37714506d783cf35d (diff) | |
| download | opencode-674febcf6057ecea206406ffb4b90edd19872529.tar.gz opencode-674febcf6057ecea206406ffb4b90edd19872529.zip | |
fix(desktop): type issue
Diffstat (limited to 'packages/desktop/src/components/code.tsx')
| -rw-r--r-- | packages/desktop/src/components/code.tsx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/desktop/src/components/code.tsx b/packages/desktop/src/components/code.tsx index 325f7b635..bbf7e28aa 100644 --- a/packages/desktop/src/components/code.tsx +++ b/packages/desktop/src/components/code.tsx @@ -99,13 +99,13 @@ export function Code(props: Props) { }) } - const onSelectionChange = () => { + const onSelectionChange = async () => { if (!container) return if (isProgrammaticSelection) return // if (ctx.file.active()?.path !== local.path) return const d = getSelectionInContainer(container) if (!d) return - const p = ctx.file.node(local.path)?.selection + const p = (await ctx.file.node(local.path))?.selection if (p && p.startLine === d.sl && p.endLine === d.el && p.startChar === d.sch && p.endChar === d.ech) return ctx.file.select(local.path, { startLine: d.sl, startChar: d.sch, endLine: d.el, endChar: d.ech }) } @@ -144,21 +144,21 @@ export function Code(props: Props) { }) // Restore scroll position from store when content is ready - createEffect(() => { + createEffect(async () => { const content = html() if (!container || !content) return - const top = ctx.file.node(local.path)?.scrollTop + const top = (await ctx.file.node(local.path))?.scrollTop if (top !== undefined && container.scrollTop !== top) container.scrollTop = top }) // Sync selection from store -> DOM - createEffect(() => { + createEffect(async () => { const content = html() if (!container || !content) return // if (ctx.file.active()?.path !== local.path) return const codeEl = container.querySelector("code") as HTMLElement | undefined if (!codeEl) return - const target = ctx.file.node(local.path)?.selection + const target = (await ctx.file.node(local.path))?.selection const current = getSelectionInContainer(container) const sel = window.getSelection() if (!sel) return |
