mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 03:51:38 +03:00
feat: Link feature add search function
This commit is contained in:
parent
e18a35989f
commit
a89d5847df
@ -690,10 +690,7 @@ class SlateUtils {
|
||||
}
|
||||
|
||||
public getStart() {
|
||||
return Editor.start(this.editor, {
|
||||
path: [0, 0],
|
||||
offset: 0,
|
||||
});
|
||||
return Editor.start(this.editor, [0]);
|
||||
}
|
||||
|
||||
public getEnd() {
|
||||
|
@ -185,10 +185,12 @@ export const DoubleLinkMenu = ({
|
||||
}
|
||||
}
|
||||
const { type, anchorNode } = editor.selection.currentSelectInfo;
|
||||
if (!anchorNode) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!isOpen ||
|
||||
(type === 'Range' &&
|
||||
anchorNode &&
|
||||
anchorNode.id !== curBlockId &&
|
||||
editor.blockHelper.isSelectionCollapsed(anchorNode.id))
|
||||
) {
|
||||
|
@ -3,7 +3,7 @@ import { BasePlugin } from '../../base-plugin';
|
||||
import { PluginRenderRoot } from '../../utils';
|
||||
import { DoubleLinkMenu } from './DoubleLinkMenu';
|
||||
|
||||
const PLUGIN_NAME = 'reference-menu';
|
||||
const PLUGIN_NAME = 'doublelink-menu';
|
||||
|
||||
export class DoubleLinkMenuPlugin extends BasePlugin {
|
||||
private _root?: PluginRenderRoot;
|
||||
|
@ -181,10 +181,10 @@ const common_handler_for_inline_menu: ClickItemHandler = ({
|
||||
});
|
||||
break;
|
||||
case inlineMenuNamesKeys.link:
|
||||
add_link({
|
||||
editor,
|
||||
blockId: anchorNodeId,
|
||||
});
|
||||
// add_link({
|
||||
// editor,
|
||||
// blockId: anchorNodeId,
|
||||
// });
|
||||
editor.plugins.emit('showAddLink');
|
||||
setShow(false);
|
||||
break;
|
||||
|
@ -204,7 +204,7 @@ export const LinkMenu = ({ editor, hooks }: LinkMenuProps) => {
|
||||
</LinkModalContainerIcon>
|
||||
<LinkModalContainerInput
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder="Paste link url, like https://affine.pro"
|
||||
placeholder="Paste link url"
|
||||
autoComplete="off"
|
||||
value={searchText}
|
||||
onChange={handleFilterChange}
|
||||
@ -240,7 +240,6 @@ const LinkModalContainer = styled('div')(({ theme }) => ({
|
||||
backgroundColor: '#fff',
|
||||
alignItems: 'center',
|
||||
zIndex: '1',
|
||||
width: '354px',
|
||||
}));
|
||||
|
||||
const LinkModalContainerIcon = styled('div')(({ theme }) => ({
|
||||
|
Loading…
Reference in New Issue
Block a user