⬜任意の場所からbubble出来るようにする (takker99/ScrapBubble)
<App />に含まれるevent処理を外部に委託する
bubbleしたい場所はuserに設定させる
イメージ
code:js
const ops = await setup();
document.getElementById("editor").addEventListener(
"pointerenter",
async (e) => {
const a = e.target;
if (!(a instanceof HTMLAnchorElement)) return;
if (!a.matches(".page-link")) return;
// 一定時間内にpointerが<a>を離れなければ、hoverを実行する
if(!await ops.stayHovering(a)) return;
ops.bubble({
project: /* ... */,
title: /* ... */,
hash: /* ... */,
type: "link",
});
},
{ capture: true },
);