fix(palabras): bubble reabre en la fila por defecto, no en la sub-vista

El bubble tiene sub-vistas (typoOpen/linkOpen) que viven en el componente. Al
cerrarse solo se desmonta el contenido (el {#if bubble.open}), no el estado, asi
que la SIGUIENTE invocacion reabria directa en Tipografia/Enlace. Reseteo ambos
cuando la seleccion se colapsa (el bubble solo se muestra sobre un rango): una
edicion de rango preserva el rango -> no resetea; colapsar cierra el bubble ->
resetea. Repro Playwright: seleccionar->Aa->elegir fuente->colapsar->reseleccionar
= reabre en la fila de marcas (typoLeftover 0).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
alpha-0.1-sec-dom
dev 3 months ago
parent d4cef53e3a
commit cd30524d99

@ -109,6 +109,24 @@
let linkValue = $state('');
let linkInput = $state<HTMLInputElement | null>(null);
// The bubble only shows over a NON-collapsed range; its sub-views (`typoOpen` /
// `linkOpen`) live on the component, so they'd survive a close and the NEXT
// invocation would re-open straight into the typography / link view. Reset them
// when the selection collapses (the bubble closes) so it always re-opens on the
// default marks row. A range edit (applying a mark) keeps the range → no reset.
$effect(() => {
const sel = api.selection;
const collapsed =
!sel ||
(sel.anchor.offset === sel.focus.offset &&
sel.anchor.path.length === sel.focus.path.length &&
sel.anchor.path.every((p, i) => p === sel.focus.path[i]));
if (collapsed) {
typoOpen = false;
linkOpen = false;
}
});
function openLink() {
linkValue = api.selectedLink?.href ?? '';
linkOpen = true;

Loading…
Cancel
Save

Powered by TurnKey Linux.