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
@@ -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({
@@ -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>) => {