chore: use MentionType instead

This commit is contained in:
Richard Shiue 2025-04-08 12:46:38 +08:00
parent de917c90f4
commit 258aa130f4
7 changed files with 10 additions and 10 deletions

View file

@ -72,7 +72,7 @@ extension InsertDatabase on EditorState {
0,
MentionBlockKeys.mentionChar,
attributes: MentionBlockKeys.buildMentionPageAttributes(
mentionType: MentionType.page.name,
mentionType: MentionType.page,
pageId: view.id,
blockId: null,
),

View file

@ -44,7 +44,7 @@ extension PasteFromBlockLink on EditorState {
selection.startIndex,
MentionBlockKeys.mentionChar,
attributes: MentionBlockKeys.buildMentionPageAttributes(
mentionType: MentionType.page.name,
mentionType: MentionType.page,
pageId: pageId,
blockId: blockId,
),

View file

@ -196,7 +196,7 @@ class ChildPageTransactionHandler extends MentionTransactionHandler {
mentionIndex,
MentionBlockKeys.mentionChar.length,
MentionBlockKeys.buildMentionPageAttributes(
mentionType: MentionType.childPage.name,
mentionType: MentionType.childPage,
pageId: newView.id,
blockId: null,
),

View file

@ -57,13 +57,13 @@ class MentionBlockKeys {
static const mentionChar = '\$';
static Map<String, dynamic> buildMentionPageAttributes({
required String mentionType,
required MentionType mentionType,
required String pageId,
required String? blockId,
}) {
return {
MentionBlockKeys.mention: {
MentionBlockKeys.type: mentionType,
MentionBlockKeys.type: mentionType.name,
MentionBlockKeys.pageId: pageId,
if (blockId != null) MentionBlockKeys.blockId: blockId,
},

View file

@ -51,7 +51,7 @@ Node pageMentionNode(String viewId) {
TextInsert(
MentionBlockKeys.mentionChar,
attributes: MentionBlockKeys.buildMentionPageAttributes(
mentionType: MentionType.page.name,
mentionType: MentionType.page,
pageId: viewId,
blockId: null,
),
@ -284,7 +284,7 @@ class _MentionSubPageBlockState extends State<MentionSubPageBlock> {
widget.index,
MentionBlockKeys.mentionChar.length,
MentionBlockKeys.buildMentionPageAttributes(
mentionType: MentionType.page.name,
mentionType: MentionType.page,
pageId: widget.pageId,
blockId: null,
),
@ -395,7 +395,7 @@ Future<void> _handleDoubleTap(
index,
1,
MentionBlockKeys.buildMentionPageAttributes(
mentionType: MentionType.page.name,
mentionType: MentionType.page,
pageId: newView.id,
blockId: null,
),

View file

@ -72,7 +72,7 @@ class InlineChildPageService extends InlineActionsDelegate {
replacement.$2,
MentionBlockKeys.mentionChar,
attributes: MentionBlockKeys.buildMentionPageAttributes(
mentionType: MentionType.childPage.name,
mentionType: MentionType.childPage,
pageId: view.id,
blockId: null,
),

View file

@ -222,7 +222,7 @@ class InlinePageReferenceService extends InlineActionsDelegate {
replace.$2,
MentionBlockKeys.mentionChar,
attributes: MentionBlockKeys.buildMentionPageAttributes(
mentionType: MentionType.page.name,
mentionType: MentionType.page,
pageId: view.id,
blockId: null,
),