mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 12:36:24 +08:00
8ce85f708d
#### PR Dependency Tree * **PR #12948** 👈 * **PR #12980** This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced inline comment functionality, allowing users to add, resolve, and highlight comments directly within text. * Added a new toolbar action for inserting comments when supported. * Inline comments are visually highlighted and can be interacted with in the editor. * **Enhancements** * Integrated a feature flag to enable or disable the comment feature. * Improved inline manager rendering to support wrapper specs for advanced formatting. * **Developer Tools** * Added mock comment provider for testing and development environments. * **Chores** * Updated dependencies and project references to support the new inline comment module. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
import { CommentInlineSpecExtension } from '@blocksuite/affine-inline-comment';
|
|
import { LatexInlineSpecExtension } from '@blocksuite/affine-inline-latex';
|
|
import { LinkInlineSpecExtension } from '@blocksuite/affine-inline-link';
|
|
import {
|
|
BackgroundInlineSpecExtension,
|
|
BoldInlineSpecExtension,
|
|
CodeInlineSpecExtension,
|
|
ColorInlineSpecExtension,
|
|
ItalicInlineSpecExtension,
|
|
StrikeInlineSpecExtension,
|
|
UnderlineInlineSpecExtension,
|
|
} from '@blocksuite/affine-inline-preset';
|
|
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
|
|
import {
|
|
InlineManagerExtension,
|
|
InlineSpecExtension,
|
|
} from '@blocksuite/std/inline';
|
|
import { html } from 'lit';
|
|
import { z } from 'zod';
|
|
|
|
export const CodeBlockUnitSpecExtension =
|
|
InlineSpecExtension<AffineTextAttributes>({
|
|
name: 'code-block-unit',
|
|
schema: z.object({
|
|
'code-block-uint': z.undefined(),
|
|
}),
|
|
match: () => true,
|
|
renderer: ({ delta }) => {
|
|
return html`<affine-code-unit .delta=${delta}></affine-code-unit>`;
|
|
},
|
|
});
|
|
|
|
export const CodeBlockInlineManagerExtension =
|
|
InlineManagerExtension<AffineTextAttributes>({
|
|
id: 'CodeBlockInlineManager',
|
|
enableMarkdown: false,
|
|
specs: [
|
|
BoldInlineSpecExtension.identifier,
|
|
ItalicInlineSpecExtension.identifier,
|
|
UnderlineInlineSpecExtension.identifier,
|
|
StrikeInlineSpecExtension.identifier,
|
|
CodeInlineSpecExtension.identifier,
|
|
BackgroundInlineSpecExtension.identifier,
|
|
ColorInlineSpecExtension.identifier,
|
|
LatexInlineSpecExtension.identifier,
|
|
LinkInlineSpecExtension.identifier,
|
|
CodeBlockUnitSpecExtension.identifier,
|
|
CommentInlineSpecExtension.identifier,
|
|
],
|
|
});
|