feat(editor): keep edit-only forms across a width change
Edit-only parts (creation forms, submission note, crop group, annotation edit body) mount at the first editable render and stay mounted, hidden and detached from canvases, while read-only. Guards: the viewport hook commits the focused field before the tier crosses 1 024 px, the route releases focus left in a hidden part and treats a store out of step as read-only, delete and discard confirmations close when the editor turns read-only, a drag is dropped while the edit body is hidden. Read-only twins take an id prefix. R-24: no existing assertion rewritten; editor-no-loss.test.tsx and two editor-shell Chromium cases added.
This commit is contained in:
1 parent
9d89daed19
commit
c57af6441f
23 files changed
+883
-108
No files matched your search
@@ -21,6 +21,8 @@ export interface OverviewPanelProps {
|
||||
viewId: string
|
||||
/** Read-only modes only consult: the entries read « Voir … ». */
|
||||
readOnly: boolean
|
||||
/** Put before every id (the read-only twin beside the kept edit panel). */
|
||||
idPrefix?: string
|
||||
onSelectView: (viewId: string) => void
|
||||
onOpenSection: (section: AnnotationSection, opener: HTMLElement) => void
|
||||
}
|
||||
@@ -91,10 +93,11 @@ function ViewRow({
|
||||
function ViewsCard(props: OverviewPanelProps) {
|
||||
const t = useT()
|
||||
const { doc, viewId, readOnly, onSelectView, onOpenSection } = props
|
||||
const id = `${props.idPrefix ?? ''}overview-views`
|
||||
const counts = useOverviewCounts(doc)
|
||||
return (
|
||||
<section aria-labelledby="overview-views" className={CARD}>
|
||||
<h3 id="overview-views" className={TITLE}>
|
||||
<section aria-labelledby={id} className={CARD}>
|
||||
<h3 id={id} className={TITLE}>
|
||||
{t('editor.overview.views')}
|
||||
</h3>
|
||||
<ul>
|
||||
@@ -126,13 +129,11 @@ function CategoriesCard(props: OverviewPanelProps) {
|
||||
const plural = usePlural()
|
||||
const locale = useLocaleStore((s) => s.locale)
|
||||
const { doc, readOnly, onOpenSection } = props
|
||||
const id = `${props.idPrefix ?? ''}overview-categories`
|
||||
const counts = useOverviewCounts(doc)
|
||||
return (
|
||||
<section aria-labelledby="overview-categories" className={CARD}>
|
||||
<h3
|
||||
id="overview-categories"
|
||||
className={`${TITLE} flex items-center justify-between`}
|
||||
>
|
||||
<section aria-labelledby={id} className={CARD}>
|
||||
<h3 id={id} className={`${TITLE} flex items-center justify-between`}>
|
||||
{t('editor.overview.categories')}
|
||||
<span
|
||||
data-testid="overview-categories-count"
|
||||
|
||||
Reference in new issue
Block a user