scrapbox-icon-button
from /scrapboxlab/UserScript版アイコンボタン
takker.icon用にコピペした
2021-04-11 23:31:31 refactoring
code:script.js
const buttonFileName = 'button.';
document.getElementById('editor').addEventListener('click', async e => {
const t = e.target;
if (!(t.tagName === 'IMG' && t.classList.contains('icon') && t.title.endsWith('-button')))return;
e.preventDefault();
e.stopImmediatePropagation();
try {
const path = ../${encodeURIComponent(t.title)}/${buttonFileName}
const {execute} = await import(path);
execute();
} catch(e) {
console.log(e);
}
});
#アイコンボタン
#2024-06-13 12:06:20 dynamic importを含むコードをesbuildでbundleするとエラーが出る対策
#2021-04-11 23:33:34
#2021-01-04 18:54:52