Skip to content

Commit 5e13351

Browse files
authored
ENG-1788 Fix canvas embed autocomplete mouse selection (#1068)
1 parent c2ef4b9 commit 5e13351

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

apps/roam/src/components/canvas/CanvasEmbedDialog.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useCallback, useEffect, useState } from "react";
2-
import { Dialog } from "@blueprintjs/core";
2+
import { Dialog, MenuItem } from "@blueprintjs/core";
33
import AutocompleteInput from "roamjs-components/components/AutocompleteInput";
44
import renderOverlay, {
55
RoamOverlayProps,
@@ -47,6 +47,15 @@ const CanvasEmbedDialog = ({
4747
placeholder="Search canvas pages..."
4848
autoFocus
4949
autoSelectFirstOption={false}
50+
renderItem={({ item }) => (
51+
<MenuItem
52+
onMouseDown={(event) => {
53+
event.preventDefault();
54+
handleSetValue(item);
55+
}}
56+
text={item}
57+
/>
58+
)}
5059
/>
5160
);
5261
};

apps/roam/src/utils/registerSlashCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const SLASH_COMMANDS: {
3232
void updateBlock({
3333
uid,
3434
text: `{{dg-canvas: [[${title}]]}}`,
35-
});
35+
}).then(() => document.body.click());
3636
},
3737
});
3838
},

0 commit comments

Comments
 (0)