mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 10:22:55 +08:00
feat(editor): block comment extension (#12980)
#### PR Dependency Tree * **PR #12980** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal)
This commit is contained in:
@@ -40,11 +40,10 @@ import type {
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
import {
|
||||
ActionPlacement,
|
||||
CommentProviderIdentifier,
|
||||
blockCommentToolbarButton,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
import { tableViewMeta } from '@blocksuite/data-view/view-presets';
|
||||
import {
|
||||
CommentIcon,
|
||||
CopyIcon,
|
||||
DatabaseTableViewIcon,
|
||||
DeleteIcon,
|
||||
@@ -270,28 +269,17 @@ const turnIntoLinkedDoc = {
|
||||
},
|
||||
} as const satisfies ToolbarAction;
|
||||
|
||||
const commentAction = {
|
||||
id: 'd.comment',
|
||||
when: ({ std, chain }) =>
|
||||
isFormatSupported(chain).run()[0] &&
|
||||
!!std.getOptional(CommentProviderIdentifier),
|
||||
icon: CommentIcon(),
|
||||
run: ({ std }) => {
|
||||
const commentProvider = std.getOptional(CommentProviderIdentifier);
|
||||
if (!commentProvider) return;
|
||||
|
||||
commentProvider.addComment(std.selection.value);
|
||||
},
|
||||
} as const satisfies ToolbarAction;
|
||||
|
||||
export const builtinToolbarConfig = {
|
||||
actions: [
|
||||
conversionsActionGroup,
|
||||
inlineTextActionGroup,
|
||||
highlightActionGroup,
|
||||
commentAction,
|
||||
turnIntoDatabase,
|
||||
turnIntoLinkedDoc,
|
||||
{
|
||||
id: 'g.comment',
|
||||
...blockCommentToolbarButton,
|
||||
},
|
||||
{
|
||||
placement: ActionPlacement.More,
|
||||
id: 'a.clipboard',
|
||||
|
||||
Reference in New Issue
Block a user