mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 21:06:22 +08:00
4c84e6bac7
Closes: BS-3368 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new link tool extension, enabling enhanced link-related functionality within the edgeless workspace. - Added a new view extension for link tools, improving integration and usability in edgeless mode. - **Chores** - Added a new package for link tool functionality with appropriate dependencies and exports. - Registered new custom elements for edgeless toolbars and link tools to support modular UI components. - Updated project configurations and workspace dependencies to include the new link tool module. - **Refactor** - Removed unused quick tool exports and toolbar component registrations to streamline the edgeless extension codebase. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { insertLinkByQuickSearchCommand } from '@blocksuite/affine-block-bookmark';
|
|
import { menu } from '@blocksuite/affine-components/context-menu';
|
|
import { LinkIcon } from '@blocksuite/affine-components/icons';
|
|
import { TelemetryProvider } from '@blocksuite/affine-shared/services';
|
|
import type { DenseMenuBuilder } from '@blocksuite/affine-widget-edgeless-toolbar';
|
|
|
|
export const buildLinkDenseMenu: DenseMenuBuilder = edgeless =>
|
|
menu.action({
|
|
name: 'Link',
|
|
prefix: LinkIcon,
|
|
select: () => {
|
|
const [_, { insertedLinkType }] = edgeless.std.command.exec(
|
|
insertLinkByQuickSearchCommand
|
|
);
|
|
|
|
insertedLinkType
|
|
?.then(type => {
|
|
const flavour = type?.flavour;
|
|
if (!flavour) return;
|
|
|
|
edgeless.std
|
|
.getOptional(TelemetryProvider)
|
|
?.track('CanvasElementAdded', {
|
|
control: 'toolbar:general',
|
|
page: 'whiteboard editor',
|
|
module: 'toolbar',
|
|
type: flavour.split(':')[1],
|
|
});
|
|
})
|
|
.catch(console.error);
|
|
},
|
|
});
|