mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-23 04:04:27 +08:00
feat(editor): add line number display option for code block (#12305)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a toggle in the code block toolbar to show or hide line numbers for individual code blocks. - The display of line numbers now respects both global and per-block settings, allowing more flexible control. - **Style** - Updated styles to hide line numbers when disabled via the new toggle option. - **Tests** - Added end-to-end tests to verify toggling line numbers visibility and undo/redo behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -13,6 +13,7 @@ type CodeBlockProps = {
|
||||
wrap: boolean;
|
||||
caption: string;
|
||||
preview?: boolean;
|
||||
lineNumber?: boolean;
|
||||
} & BlockMeta;
|
||||
|
||||
export const CodeBlockSchema = defineBlockSchema({
|
||||
@@ -24,6 +25,7 @@ export const CodeBlockSchema = defineBlockSchema({
|
||||
wrap: false,
|
||||
caption: '',
|
||||
preview: undefined,
|
||||
lineNumber: undefined,
|
||||
'meta:createdAt': undefined,
|
||||
'meta:createdBy': undefined,
|
||||
'meta:updatedAt': undefined,
|
||||
|
||||
Reference in New Issue
Block a user