Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat: Link feature add search function

xiaodong zuo560a5dce42f4
diff --git a/libs/components/editor-plugins/src/menu/inline-menu/utils.ts b/libs/components/editor-plugins/src/menu/inline-menu/utils.ts
index 3afbb57de3..bb35d31f5a 100644
--- a/libs/components/editor-plugins/src/menu/inline-menu/utils.ts
+++ b/libs/components/editor-plugins/src/menu/inline-menu/utils.ts
@@ -181,12 +181,12 @@ const common_handler_for_inline_menu: ClickItemHandler = ({
});
break;
case inlineMenuNamesKeys.link:
- // add_link({
- // editor,
- // blockId: anchorNodeId,
- // });
- editor.plugins.emit('showAddLink');
- setShow(false);
+ add_link({
+ editor,
+ blockId: anchorNodeId,
+ });
+ // editor.plugins.emit('showAddLink');
+ // setShow(false);
break;
case inlineMenuNamesKeys.code:
toggle_text_format({
diff --git a/libs/components/editor-plugins/src/menu/link-menu/LinkMenu.tsx b/libs/components/editor-plugins/src/menu/link-menu/LinkMenu.tsx
index 6e0eb6322e..ddd178e449 100644
--- a/libs/components/editor-plugins/src/menu/link-menu/LinkMenu.tsx
+++ b/libs/components/editor-plugins/src/menu/link-menu/LinkMenu.tsx
@@ -128,18 +128,15 @@ export const LinkMenu = ({ editor, hooks }: LinkMenuProps) => {
);
useEffect(() => {
- const showDoubleLink = () => {
+ const showLinkMenu = () => {
const { anchorNode } = editor.selection.currentSelectInfo;
resetState('', anchorNode.id);
};
- editor.plugins.observe('showAddLink', showDoubleLink);
- return () => editor.plugins.unobserve('showAddLink', showDoubleLink);
+ editor.plugins.observe('showAddLink', showLinkMenu);
+ return () => editor.plugins.unobserve('showAddLink', showLinkMenu);
}, [editor, resetState]);
- const handleSelected = async (id: string) => {
- if (curBlockId) {
- }
- };
+ const handleSelected = async (id: string) => {};
const handleFilterChange = useCallback(
async (e: ChangeEvent<HTMLInputElement>) => {