diff --git a/src/content/content.js b/src/content/content.js index ec9b49f..0f25436 100644 --- a/src/content/content.js +++ b/src/content/content.js @@ -1134,9 +1134,17 @@ }); await setStorageData('ss_mappings', currentMappings); - // Update local mappings + // Update local mappings so the fetch interceptor uses them immediately mappings = currentMappings; + // Replace the PPI value in the current input right now + if (inputEl) { + replaceInInput(inputEl, real, fake); + // Re-scan — will dismiss warning if no more PPI remains + if (inputScanTimer) clearTimeout(inputScanTimer); + inputScanTimer = setTimeout(() => scanInputForPPI(inputEl), 150); + } + // Visual feedback btn.textContent = '\u2714'; btn.style.color = '#4ade80'; @@ -1145,6 +1153,27 @@ }); } + // Replace all occurrences of `real` with `fake` in an input or contenteditable element + function replaceInInput(el, real, fake) { + if (!el) return; + const re = new RegExp(real.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gi'); + if (el.value !== undefined) { + //