mirror of
https://github.com/docmost/docmost.git
synced 2026-05-18 23:44:24 +08:00
Support anchor links in page mentions
This commit is contained in:
@@ -33,6 +33,11 @@ export interface MentionNodeAttrs {
|
||||
* the id of the user who initiated the mention
|
||||
*/
|
||||
creatorId?: string;
|
||||
|
||||
/**
|
||||
* the anchor hash for page mentions (e.g., "heading-1")
|
||||
*/
|
||||
anchor?: string;
|
||||
}
|
||||
|
||||
export type MentionOptions<
|
||||
@@ -246,6 +251,20 @@ export const Mention = Node.create<MentionOptions>({
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
anchor: {
|
||||
default: null,
|
||||
parseHTML: (element) => element.getAttribute("data-anchor"),
|
||||
renderHTML: (attributes) => {
|
||||
if (!attributes.anchor) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {
|
||||
"data-anchor": attributes.anchor,
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user