mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 08:21:46 +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() {
|
public getStart() {
|
||||||
return Editor.start(this.editor, {
|
return Editor.start(this.editor, [0]);
|
||||||
path: [0, 0],
|
|
||||||
offset: 0,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getEnd() {
|
public getEnd() {
|
||||||
|
@ -185,10 +185,12 @@ export const DoubleLinkMenu = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const { type, anchorNode } = editor.selection.currentSelectInfo;
|
const { type, anchorNode } = editor.selection.currentSelectInfo;
|
||||||
|
if (!anchorNode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
!isOpen ||
|
!isOpen ||
|
||||||
(type === 'Range' &&
|
(type === 'Range' &&
|
||||||
anchorNode &&
|
|
||||||
anchorNode.id !== curBlockId &&
|
anchorNode.id !== curBlockId &&
|
||||||
editor.blockHelper.isSelectionCollapsed(anchorNode.id))
|
editor.blockHelper.isSelectionCollapsed(anchorNode.id))
|
||||||
) {
|
) {
|
||||||
|
@ -3,7 +3,7 @@ import { BasePlugin } from '../../base-plugin';
|
|||||||
import { PluginRenderRoot } from '../../utils';
|
import { PluginRenderRoot } from '../../utils';
|
||||||
import { DoubleLinkMenu } from './DoubleLinkMenu';
|
import { DoubleLinkMenu } from './DoubleLinkMenu';
|
||||||
|
|
||||||
const PLUGIN_NAME = 'reference-menu';
|
const PLUGIN_NAME = 'doublelink-menu';
|
||||||
|
|
||||||
export class DoubleLinkMenuPlugin extends BasePlugin {
|
export class DoubleLinkMenuPlugin extends BasePlugin {
|
||||||
private _root?: PluginRenderRoot;
|
private _root?: PluginRenderRoot;
|
||||||
|
@ -181,10 +181,10 @@ 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;
|
||||||
|
@ -204,7 +204,7 @@ export const LinkMenu = ({ editor, hooks }: LinkMenuProps) => {
|
|||||||
</LinkModalContainerIcon>
|
</LinkModalContainerIcon>
|
||||||
<LinkModalContainerInput
|
<LinkModalContainerInput
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
placeholder="Paste link url, like https://affine.pro"
|
placeholder="Paste link url"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
value={searchText}
|
value={searchText}
|
||||||
onChange={handleFilterChange}
|
onChange={handleFilterChange}
|
||||||
@ -240,7 +240,6 @@ const LinkModalContainer = styled('div')(({ theme }) => ({
|
|||||||
backgroundColor: '#fff',
|
backgroundColor: '#fff',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
zIndex: '1',
|
zIndex: '1',
|
||||||
width: '354px',
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const LinkModalContainerIcon = styled('div')(({ theme }) => ({
|
const LinkModalContainerIcon = styled('div')(({ theme }) => ({
|
||||||
|
Loading…
Reference in New Issue
Block a user