Clean up transparent fade spans after animation
This commit is contained in:
parent
86e55c7856
commit
662f492b2f
2 changed files with 12 additions and 0 deletions
11
static/ui.js
11
static/ui.js
|
|
@ -11182,10 +11182,21 @@ function _refreshTransparentThinkingLiveRow(existing, node){
|
|||
return true;
|
||||
}
|
||||
|
||||
function _bindTransparentFadeCleanup(body){
|
||||
if(!body || body._transparentFadeCleanupBound || typeof body.addEventListener !== 'function') return;
|
||||
body._transparentFadeCleanupBound = true;
|
||||
body.addEventListener('animationend', e=>{
|
||||
const span = e.target;
|
||||
if(!span || !span.classList || !span.classList.contains('stream-fade-word')) return;
|
||||
span.replaceWith(document.createTextNode(span.textContent || ''));
|
||||
});
|
||||
}
|
||||
|
||||
function _appendTransparentFadeText(body, text){
|
||||
if(!body) return;
|
||||
const value = String(text || '');
|
||||
if(!value) return;
|
||||
_bindTransparentFadeCleanup(body);
|
||||
const reduceMotion = !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);
|
||||
const frag = document.createDocumentFragment();
|
||||
const wordRe = /(\S+)(\s*)/g;
|
||||
|
|
|
|||
|
|
@ -306,6 +306,7 @@ eval(extractFunc('_transparentLiveRowAttributePairs'));
|
|||
eval(extractFunc('_transparentLiveRowInteractiveState'));
|
||||
eval(extractFunc('_rehydrateTransparentLiveRow'));
|
||||
eval(extractFunc('_refreshTransparentThinkingLiveRow'));
|
||||
eval(extractFunc('_bindTransparentFadeCleanup'));
|
||||
eval(extractFunc('_appendTransparentFadeText'));
|
||||
eval(extractFunc('_refreshTransparentFadeProseRow'));
|
||||
eval(extractFunc('_refreshTransparentLiveRow'));
|
||||
|
|
|
|||
Loading…
Reference in a new issue