Closed mira-kovar closed 1 year ago
Hi, I guess you could use the beforeUpdate
event and wrap the snippet update operation. I'm writing this off the top of my head, so it's not guaranteed to work as is, but the idea is there:
naja.snippetHandler.addEventListener('beforeUpdate', (event) => {
const originalOperation = event.detail.operation;
event.detail.changeOperation((snippet, content) => document.startViewTransition(() => originalOperation(snippet, content)));
});
Hi, thanks. Nice trick.
Feature Request
It would be nice to have support of View Transitions API when snippert replace its content.
Somewhere in
SnippetHandler::updateSnippet
insted ofsnippet.innerHTML = content;
by documentation change to something likedocument.startViewTransition(() => snippet.innerHTML = content);
. And ofcourse prepend and append...Or please is there some way to hook/bypass snippet content change?