scrapbox-icon-button
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);
}
});