diff --git a/static/index.html b/static/index.html index 8ace799..3bd875b 100644 --- a/static/index.html +++ b/static/index.html @@ -188,7 +188,6 @@ #histBar { color: var(--ink-dim); font-size: 12px; margin: 8px 2px 0; min-height: 0; } #histBar .hist { cursor: pointer; } #histBar .hist:hover { color: var(--accent); } - .more { color: var(--accent); cursor: pointer; font-size: 11px; letter-spacing: 0; text-transform: lowercase; } .res-label.sub { color: #6a5f52; margin: 8px 0 2px; } .lookup-row input { flex: 1; font-family: inherit; font-size: 14px; @@ -773,7 +772,7 @@ async function doLookup(){ el.textContent = 'not in the pronunciation dictionary'; } } - entry = {word, rhyme, syn, desc, expanded: {}}; + entry = {word, rhyme, syn, desc}; paintSections(); } @@ -808,37 +807,26 @@ function chipHtml(items, cls){ }).join('') + ''; } -function secLabel(id, label, truncated){ - return `
nothing found for “${esc(e.word)}”.
`; resultsBox.querySelectorAll('.chip').forEach(c=> c.addEventListener('click', ()=> lookupFor(c.dataset.w))); - resultsBox.querySelectorAll('.more').forEach(m=> - m.addEventListener('click', ()=>{ entry.expanded[m.dataset.sec] = true; paintSections(); })); } /* ============================================================ @@ -1014,15 +1000,22 @@ editor.addEventListener('paste', e=>{ const cleaned = cleanPaste(text); if(cleaned === text) return; e.preventDefault(); - editor.setRangeText(cleaned, editor.selectionStart, editor.selectionEnd, 'end'); + // execCommand keeps the native undo stack intact (setRangeText doesn't) + editor.focus(); + if(!document.execCommand('insertText', false, cleaned)){ + editor.setRangeText(cleaned, editor.selectionStart, editor.selectionEnd, 'end'); + } render(); analyzeSoon(); }); lookupInput.addEventListener('paste', e=>{ const text = e.clipboardData && e.clipboardData.getData('text/plain'); if(text && /[\u2018\u2019]/.test(text)){ e.preventDefault(); - lookupInput.setRangeText(text.replace(/[\u2018\u2019]/g, "'"), - lookupInput.selectionStart, lookupInput.selectionEnd, 'end'); + lookupInput.focus(); + const fixed = text.replace(/[\u2018\u2019]/g, "'"); + if(!document.execCommand('insertText', false, fixed)){ + lookupInput.setRangeText(fixed, lookupInput.selectionStart, lookupInput.selectionEnd, 'end'); + } } });