(btn, input)
| 2261 | } |
| 2262 | |
| 2263 | function syncInsertCreateButton(btn, input) { |
| 2264 | btn = btn || uiGetById(PREFIX + '-insert-create'); |
| 2265 | input = input || uiGetById(PREFIX + '-insert-input'); |
| 2266 | if (!btn || !input) return; |
| 2267 | const gate = insertCreateGateState(input); |
| 2268 | const ok = canCreateInsert(gate); |
| 2269 | const reason = ok ? 'Create variants' : insertCreateDisabledReason(gate); |
| 2270 | btn.setAttribute('aria-disabled', ok ? 'false' : 'true'); |
| 2271 | btn.setAttribute('aria-label', reason); |
| 2272 | if (ok) { |
| 2273 | hideInsertCreateTooltip(); |
| 2274 | btn.style.background = BP.accent; |
| 2275 | btn.style.color = C.ink; |
| 2276 | btn.style.border = 'none'; |
| 2277 | btn.style.opacity = '1'; |
| 2278 | btn.style.cursor = 'pointer'; |
| 2279 | } else { |
| 2280 | btn.style.background = 'transparent'; |
| 2281 | btn.style.color = BP.textDim; |
| 2282 | btn.style.border = '1px solid ' + BP.hairline; |
| 2283 | btn.style.opacity = '0.72'; |
| 2284 | btn.style.cursor = 'not-allowed'; |
| 2285 | } |
| 2286 | } |
| 2287 | |
| 2288 | /** Stylesheet shared by the replace and insert configure rows. */ |
| 2289 | function ensureConfigureInputStyle() { |
no test coverage detected