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, 0,
MentionBlockKeys.mentionChar, MentionBlockKeys.mentionChar,
attributes: MentionBlockKeys.buildMentionPageAttributes( attributes: MentionBlockKeys.buildMentionPageAttributes(
mentionType: MentionType.page.name, mentionType: MentionType.page,
pageId: view.id, pageId: view.id,
blockId: null, blockId: null,
), ),

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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