Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ const LinkedItemBubble = ({
setShowUnlinkButton(true)
}

const onBlur = () => {
setShowUnlinkButton(false)
const onBlur: React.FocusEventHandler<HTMLButtonElement | HTMLAnchorElement> = (event) => {
if (!event.currentTarget.contains(event.relatedTarget)) {
setShowUnlinkButton(false)
}
setWasClicked(false)
}

Expand Down Expand Up @@ -131,8 +133,10 @@ const LinkedItemBubble = ({
<button
ref={(el) => (unlinkButtonRef.current = el as HTMLElement)}
role="button"
className="-mr-1 ml-2 inline-flex cursor-pointer border-0 bg-transparent p-0 h-[1.15em] align-middle"
onClick={onUnlinkClick}
className="-mr-1 ml-2 inline-flex h-[1.15em] cursor-pointer border-0 bg-transparent p-0 align-middle"
onClick={(event) => {
onUnlinkClick(event)
}}
>
<Icon type="close" className="text-neutral hover:text-info" size="small" />
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,11 @@ export function BubbleComponent({ itemUuid, node }: BubbleComponentProps) {
[toggleAppPane, linkingController],
)

const unlinkPressed = useCallback(
async (itemToUnlink: LinkableItem) => {
linkingController.unlinkItemFromSelectedItem(itemToUnlink).catch(console.error)
editor.update(() => {
node.remove()
})
},
[linkingController, node, editor],
)
const unlinkPressed = useCallback(async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual unlinking here is unnecessary because it happens through the NodeObserverPlugin

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, was just about to ask that.

editor.update(() => {
node.remove()
})
}, [linkingController, node, editor])

if (!item) {
return <div>Unable to find item {itemUuid}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ export function ItemSelectionItemComponent({ index, isSelected, onClick, onMouse
onClick={onClick}
>
{option.item && <LinkedItemMeta item={option.item} searchQuery={searchQuery} />}
{!option.item && (
<LinkedItemSearchResultsAddTagOption
searchQuery={searchQuery}
onClickCallback={onClick}
isFocused={isSelected}
/>
)}
{!option.item && <LinkedItemSearchResultsAddTagOption searchQuery={searchQuery} isFocused={isSelected} />}
</li>
)
}
Loading