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:
L-Sun
2025-07-02 17:42:16 +08:00
committed by GitHub
parent 8ce85f708d
commit d768ad4af0
47 changed files with 432 additions and 38 deletions

View File

@@ -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',