feat: Link feature add search function

This commit is contained in:
xiaodong zuo
2022-09-05 11:39:31 +08:00
parent a89d5847df
commit 560a5dce42
2 changed files with 10 additions and 13 deletions

View File

@@ -181,12 +181,12 @@ const common_handler_for_inline_menu: ClickItemHandler = ({
}); });
break; break;
case inlineMenuNamesKeys.link: case inlineMenuNamesKeys.link:
// add_link({ add_link({
// editor, editor,
// blockId: anchorNodeId, blockId: anchorNodeId,
// }); });
editor.plugins.emit('showAddLink'); // editor.plugins.emit('showAddLink');
setShow(false); // setShow(false);
break; break;
case inlineMenuNamesKeys.code: case inlineMenuNamesKeys.code:
toggle_text_format({ toggle_text_format({

View File

@@ -128,18 +128,15 @@ export const LinkMenu = ({ editor, hooks }: LinkMenuProps) => {
); );
useEffect(() => { useEffect(() => {
const showDoubleLink = () => { const showLinkMenu = () => {
const { anchorNode } = editor.selection.currentSelectInfo; const { anchorNode } = editor.selection.currentSelectInfo;
resetState('', anchorNode.id); resetState('', anchorNode.id);
}; };
editor.plugins.observe('showAddLink', showDoubleLink); editor.plugins.observe('showAddLink', showLinkMenu);
return () => editor.plugins.unobserve('showAddLink', showDoubleLink); return () => editor.plugins.unobserve('showAddLink', showLinkMenu);
}, [editor, resetState]); }, [editor, resetState]);
const handleSelected = async (id: string) => { const handleSelected = async (id: string) => {};
if (curBlockId) {
}
};
const handleFilterChange = useCallback( const handleFilterChange = useCallback(
async (e: ChangeEvent<HTMLInputElement>) => { async (e: ChangeEvent<HTMLInputElement>) => {