script.jslet counter = 1;
// 新規穴埋め
scrapbox.PopupMenu.addButton({
title: (text) => text.includes("\n") ? "" : `{{c${counter}}}`,
onClick: (text) => `{{c${counter++}::${text}}}`,
});
// 番号を継続して穴埋め
scrapbox.PopupMenu.addButton({
// 最初は表示しない
title: (text) => text.includes("\n") || counter <= 1 ? "" : `{{c${counter - 1}}}`,
onClick: (text) => `{{c${counter - 1}::${text}}}`,
});
// 穴埋め番号のリセット
scrapbox.PopupMenu.addButton({
title: () => counter > 1 ? "reset cloze" : "",
onClick: () => { counter = 1; },
});