文字カウンター
code:script.js
scrapbox.PopupMenu.addButton({
title: (text) => {
const words = text.split(/\s+/).filter(Boolean).length;
const chars = text.length;
return ${words}w ${chars}c;
},
onClick: () => null
});
変更点
単語のカウント方法を最適化した
文字数に改行を含むようにした
単語数→文字数の順番で表示されるようにした