Skip to content

Page Builder Tina Visual Editing#751

Open
ajolipa wants to merge 13 commits into
developfrom
rb/page-builder-visual-editing
Open

Page Builder Tina Visual Editing#751
ajolipa wants to merge 13 commits into
developfrom
rb/page-builder-visual-editing

Conversation

@ajolipa

@ajolipa ajolipa commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

In this PR

Add visual editor functionality to the Tina page builder! The major steps involved in this are as follows:

  • Add the @tinacms/astro integration;
  • Create an island registry (currently only has the entry for page) to tell Tina how to re-render the body of a page while editing it. This involves updating the API calls to include the fetchWithMetadata wrapper so that the Tina code has what it needs to map between the form and the page components;
  • Annoyingly, the whole thing breaks if there are any TSX components inside the island that Tina is managing the rerendering of, so I did a bit of refactoring and passing around an isTinaPreview flag to handle rendering a trimmed-down version of the header in the visual editor; this enabled the preview to update accurately when the "transparent navbar" field is toggled in the editor, which was otherwise causing the refresh to fail.
  • The isTinaPreview flag is also used in the PageBody.astro component in a few cases to determine whether to render a React component or a static preview image;
  • The TextImage component is reworked as an Astro component with some vanilla JS controlling the image resizing; this allows us to avoid maintaining a bunch of duplicate components in both Astro and TSX form;
  • There are a couple of components that I couldn't avoid having multiple versions of, namely Tabs and Card -- Card because it is used both in the page builder and on the post/path index pages, and Tabs because a generic preview image did not seem sufficient for the visual editor in this case, so instead I made an Astro version that just stacks the tab content previews on top of each other. In both of these cases, I grouped the components into a subfolder and added a styles.ts file that contains all of the actual Tailwind classes applied within the component. Definitely open to better ideas about how to handle this part, but at least this avoids just having duplicate CSS that has to be edited twice in any future updates.

Demo video:

Recording.2026-07-16.145819.mp4

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for juel-life ready!

Name Link
🔨 Latest commit 1f8180b
🔍 Latest deploy log https://app.netlify.com/projects/juel-life/deploys/6a5929721612c1000895550f
😎 Deploy Preview https://deploy-preview-751--juel-life.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for juel-ancestry ready!

Name Link
🔨 Latest commit 1f8180b
🔍 Latest deploy log https://app.netlify.com/projects/juel-ancestry/deploys/6a5929729f27cc0008f8e0bb
😎 Deploy Preview https://deploy-preview-751--juel-ancestry.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for marronage-staging ready!

Name Link
🔨 Latest commit 1f8180b
🔍 Latest deploy log https://app.netlify.com/projects/marronage-staging/deploys/6a59297204ec7f00094f1a12
😎 Deploy Preview https://deploy-preview-751--marronage-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for padp-staging ready!

Name Link
🔨 Latest commit 1f8180b
🔍 Latest deploy log https://app.netlify.com/projects/padp-staging/deploys/6a592972a1782500087fa12a
😎 Deploy Preview https://deploy-preview-751--padp-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for pss-scavenger-hunt ready!

Name Link
🔨 Latest commit 1f8180b
🔍 Latest deploy log https://app.netlify.com/projects/pss-scavenger-hunt/deploys/6a592972ba75b900085ebd04
😎 Deploy Preview https://deploy-preview-751--pss-scavenger-hunt.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@socket-security

socket-security Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​tinacms/​astro@​0.6.07810010097100

View full report

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for juel-staging ready!

Name Link
🔨 Latest commit 1f8180b
🔍 Latest deploy log https://app.netlify.com/projects/juel-staging/deploys/6a592972a23a8c00080725a9
😎 Deploy Preview https://deploy-preview-751--juel-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for relnet-staging ready!

Name Link
🔨 Latest commit 1f8180b
🔍 Latest deploy log https://app.netlify.com/projects/relnet-staging/deploys/6a592972b1a6f200089bd729
😎 Deploy Preview https://deploy-preview-751--relnet-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ajolipa
ajolipa marked this pull request as ready for review July 16, 2026 19:00
@ajolipa
ajolipa requested review from blms and camdendotlol July 16, 2026 19:00

@camdendotlol camdendotlol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good to me but I did not run it so I suggest waiting for Ben's approval too.

@blms blms left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks great! I like just showing the images for the components that can't be rendered in preview—just a minor question about asset size for those. I also think styles.ts is a great solution to the shared CSS issue 👍

Also tested it out locally with a few different pages and block types and this is looking great, like a full-featured WYSIWYG page builder at this point. Really nice work @ajolipa.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use something like tinypng to compress these and/or could they be lower quality? 1.29MB seems like a big file to load on each preview with an image carousel

const IMAGE_SCALE = 1.75;
const BACKGROUND_SCALE = 1.65;
const SCREEN_WIDTH_LG = 1024;
const instanceState = new WeakMap();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I had never heard of WeakMap before!

>
{ _.map(items, (item) => (
<ColumnContent item={item} />
<ColumnContent item={item} isTinaPrevew={isTinaPreview} t={t} />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isTinaPrevew typo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants