MCPcopy
hub / github.com/marktext/marktext / overHandler

Function overHandler

packages/muya/src/editor/linkMouseEvents.ts:75–95  ·  view source on GitHub ↗
(event: Event)

Source from the content-addressed store, hash-verified

73 const { eventCenter, domNode } = muya;
74
75 const overHandler = (event: Event) => {
76 const wrapper = findLinkWrapper(event.target);
77 if (!wrapper || !isPopoverTarget(wrapper))
78 return;
79
80 const linkInfo = getLinkInfo(wrapper);
81 if (!linkInfo)
82 return;
83
84 // The unlink path needs the containing block so it can rewrite the
85 // block's source text. Resolve it via the DOM-attached block ref
86 // (the same property `selection/index.ts` uses for image clicks).
87 const contentDom = findContentDOM(wrapper);
88 const block = (contentDom?.[BLOCK_DOM_PROPERTY] ?? null) as Format | null;
89
90 eventCenter.emit('muya-link-tools', {
91 reference: wrapper,
92 linkInfo,
93 block,
94 });
95 };
96
97 const outHandler = (event: Event) => {
98 const wrapper = findLinkWrapper(event.target);

Callers

nothing calls this directly

Calls 5

getLinkInfoFunction · 0.90
findContentDOMFunction · 0.90
findLinkWrapperFunction · 0.85
isPopoverTargetFunction · 0.85
emitMethod · 0.80

Tested by

no test coverage detected