fix: Fixed issues with embedded linked items in Super editor (#2918)
* Fixed items being embedded twice when linking them in a Super note * Fixed Remove button not working for embedded linked items in Super editor
This commit is contained in:
committed by
GitHub
parent
092dc7957f
commit
43d31d8bb4
@@ -56,8 +56,10 @@ const LinkedItemBubble = ({
|
|||||||
setShowUnlinkButton(true)
|
setShowUnlinkButton(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onBlur = () => {
|
const onBlur: React.FocusEventHandler<HTMLButtonElement | HTMLAnchorElement> = (event) => {
|
||||||
setShowUnlinkButton(false)
|
if (!event.currentTarget.contains(event.relatedTarget)) {
|
||||||
|
setShowUnlinkButton(false)
|
||||||
|
}
|
||||||
setWasClicked(false)
|
setWasClicked(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +133,7 @@ const LinkedItemBubble = ({
|
|||||||
<button
|
<button
|
||||||
ref={(el) => (unlinkButtonRef.current = el as HTMLElement)}
|
ref={(el) => (unlinkButtonRef.current = el as HTMLElement)}
|
||||||
role="button"
|
role="button"
|
||||||
className="-mr-1 ml-2 inline-flex cursor-pointer border-0 bg-transparent p-0 h-[1.15em] align-middle"
|
className="-mr-1 ml-2 inline-flex h-[1.15em] cursor-pointer border-0 bg-transparent p-0 align-middle"
|
||||||
onClick={onUnlinkClick}
|
onClick={onUnlinkClick}
|
||||||
>
|
>
|
||||||
<Icon type="close" className="text-neutral hover:text-info" size="small" />
|
<Icon type="close" className="text-neutral hover:text-info" size="small" />
|
||||||
|
|||||||
@@ -30,15 +30,11 @@ export function BubbleComponent({ itemUuid, node }: BubbleComponentProps) {
|
|||||||
[toggleAppPane, linkingController],
|
[toggleAppPane, linkingController],
|
||||||
)
|
)
|
||||||
|
|
||||||
const unlinkPressed = useCallback(
|
const unlinkPressed = useCallback(async () => {
|
||||||
async (itemToUnlink: LinkableItem) => {
|
editor.update(() => {
|
||||||
linkingController.unlinkItemFromSelectedItem(itemToUnlink).catch(console.error)
|
node.remove()
|
||||||
editor.update(() => {
|
})
|
||||||
node.remove()
|
}, [linkingController, node, editor])
|
||||||
})
|
|
||||||
},
|
|
||||||
[linkingController, node, editor],
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return <div>Unable to find item {itemUuid}</div>
|
return <div>Unable to find item {itemUuid}</div>
|
||||||
|
|||||||
@@ -32,13 +32,7 @@ export function ItemSelectionItemComponent({ index, isSelected, onClick, onMouse
|
|||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
{option.item && <LinkedItemMeta item={option.item} searchQuery={searchQuery} />}
|
{option.item && <LinkedItemMeta item={option.item} searchQuery={searchQuery} />}
|
||||||
{!option.item && (
|
{!option.item && <LinkedItemSearchResultsAddTagOption searchQuery={searchQuery} isFocused={isSelected} />}
|
||||||
<LinkedItemSearchResultsAddTagOption
|
|
||||||
searchQuery={searchQuery}
|
|
||||||
onClickCallback={onClick}
|
|
||||||
isFocused={isSelected}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user