Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add preview link sharing with QR code #1994

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

stipsan
Copy link
Member

@stipsan stipsan commented Oct 21, 2024

Introducing Preview Sharing ✨

preview.sharing.mov

Preview Sharing creates share links with codes that are valid for as long as you want them to be. Toggling sharing off/on will create a new code that makes previous URLs no longer valid.
It also shows a QR code to enable quickly opening a PR on your phone to test your content in context before publishing it.

Prerequisites

For the menu to show up you'll need to have preview mode configured:

presentationTool({
  previewUrl: {
    previewMode: { // or `previewMode`
      enable: '/api/draft-mode/enable' // <- required
    }
  }
})

And to use @sanity/preview-kit v2 in your app for calling validatePreviewUrl in your API route, v1 doesn't support the new custom-duration preview URL secrets used to authenticate the request to see draft content.

Permissions

By default only Editor's or above can toggle sharing, although Enterprise plans with custom roles can change this.

Opting out

The menu is enabled by default when previewMode.enable is setup. You can turn it off by setting shareAccess to false.

presentationTool({
  previewUrl: {
    previewMode: {
      enable: '/api/draft-mode/enable',
      shareAccess: false // <- disable the QR code preview sharing menu
    }
  }
})

Copy link

vercel bot commented Oct 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
live-visual-editing-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 1:20pm
visual-editing-astro ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 1:20pm
visual-editing-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 1:20pm
visual-editing-next-with-i18n ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 1:20pm
visual-editing-nuxt ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 1:20pm
visual-editing-page-builder-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 1:20pm
visual-editing-remix ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 1:20pm
visual-editing-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 1:20pm
visual-editing-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 1:20pm
visual-editing-svelte ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 1:20pm

Copy link
Member

@rdunk rdunk left a comment

Choose a reason for hiding this comment

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

Awesome, this is very cool.

@stipsan stipsan merged commit 3f62247 into main Oct 21, 2024
20 checks passed
@stipsan stipsan deleted the add-qr-code-preview-sharing branch October 21, 2024 14:24
@ecospark ecospark bot mentioned this pull request Oct 21, 2024
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.

2 participants