Skip to content

Open full-page collections as a block in the Canvas#255

Merged
priethor merged 17 commits into
mainfrom
add/collection-canvas
May 25, 2026
Merged

Open full-page collections as a block in the Canvas#255
priethor merged 17 commits into
mainfrom
add/collection-canvas

Conversation

@priethor

@priethor priethor commented May 25, 2026

Copy link
Copy Markdown
Collaborator

What

Related to #219.

Full-page collections now open in Canvas, using the same document surface as pages. That means collections get the normal title, icon, cover, settings, publish controls, and a locked data-view block for their table.

Why

A full-page collection is closer to a document than a separate table screen. This makes collection editing feel like the rest of the workspace without changing the collection URL shape.

How

  • Seed a locked data-view block for full-page collections.
  • Route full-page collection URLs into Canvas.
  • Show the owner data-view settings in the collection inspector.
  • Keep inline collections out of workspace routes.

Testing Instructions

  1. Create a full-page collection and open it from the sidebar.
  2. Check that it opens in Canvas with title, icon, cover, publish, and field controls.
  3. Select the collection table and confirm the inspector does not offer "Change collection".
  4. Publish the collection and open its public URL.
  5. Paste an inline collection URL directly and confirm it lands on the collection not-found state.

Screen recording

Grabacion.de.pantalla.2026-05-25.a.las.13.24.51.mov

@priethor priethor marked this pull request as ready for review May 25, 2026 11:25
priethor added 2 commits May 25, 2026 13:51
The earlier rule only hid the ::before halo when the block was selected or
hovered. Gutenberg also paints an ::after pseudo and direct outline/box-shadow
on focus, so the bounding box kept showing up around the canvas body. Match the
block by [data-type] so the reset hits the actual wrapper, and cover every
selection state the block-editor uses.
Full-page collections render inside the BlockCanvas iframe now, so locators
that targeted .cortext-data-view directly in the page DOM never resolve.
Update the e2e tests that visit /collection/<slug>-<id> to reach the table
through page.frameLocator('[name="editor-canvas"]'), and teach the
navigation-lifecycle paint helper to look inside the iframe before falling
back to the pane DOM.
@priethor priethor changed the title Open full-page collections in Canvas Open full-page collections as a block in the Canvas May 25, 2026
priethor added 6 commits May 25, 2026 14:12
The backfill loop only marks itself complete when every collection was updated
successfully so failures get retried, but the rewrite-rules flush was sharing
that option. A single stubborn wp_update_post would keep the option unset and
re-flush rewrites on every request, which is a slow .htaccess rewrite on
Apache. Give the flush its own option so it runs once after upgrade and is
done, independent of the backfill loop's retry behavior.
WordPress reuses post IDs across post types (wp_posts.ID is shared), so a
page with id 42 and a collection with id 42 can coexist. The reducer's id
check alone would let a stale DOCUMENT_RESOLVED from a previous page target
apply to a same-id collection target. Carry the kind ('document' or
'collection') through the action and reject anything whose kind does not
match state.target.kind. Same gate on DOCUMENT_NOT_FOUND.
When a collection's post_content already contained a cortext/data-view block
pointing at another collection, the backfill appended the self-referencing
owner block after it. The previous dedup pass keyed singletons on block.name
and treated the second data-view as a duplicate, removing the owner. The
insertion pass then re-added the owner on the next render, and so on. Key
owner dedup on the collectionId attribute so foreign data-views are left
alone and only true owner duplicates are removed.
Full-page collections share Canvas with pages now, so navigating between
them keeps the same workspace pane active and just swaps the inner document.
The "page pane flips to inactive" assertion was a holdover from the
separate-pane model and never held under the new routing.
The old assertion compared .cortext-canvas DOM nodes captured before and
after a page → collection → page round trip, expecting the document pane's
canvas to stay mounted through the collection switch. That held when pages
and collections owned separate workspace panes. Now that both share Canvas,
React can drop the node when the inner postType changes without breaking
the no-blank-flash guarantee, which the waitForActiveDataViewWithoutBlanking
helper and the view-transition probe already cover.
@priethor priethor merged commit 0ed63cd into main May 25, 2026
10 checks passed
@priethor priethor deleted the add/collection-canvas branch May 25, 2026 12:51
@priethor priethor added this to the 0.1.0 milestone May 28, 2026
@priethor priethor added type: enhancement Improvement to existing behavior. area: canvas Block editor canvas, blocks, inspector, covers, icons, and document chrome. labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: canvas Block editor canvas, blocks, inspector, covers, icons, and document chrome. type: enhancement Improvement to existing behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant