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

整理NotionPage组件,新增配置 支持禁用database链接 #2403

Merged
merged 1 commit into from
May 11, 2024

Conversation

tangly1024
Copy link
Owner

// 是否关闭数据库和画册的点击跳转
const POST_DISABLE_GALLERY_CLICK = siteConfig('POST_DISABLE_GALLERY_CLICK')
const POST_DISABLE_DATABASE_CLICK = siteConfig('POST_DISABLE_DATABASE_CLICK')


// 相册视图点击禁止跳转,只能放大查看图片
if (POST_DISABLE_GALLERY_CLICK) {
  // 针对页面中的gallery视图,点击后是放大图片还是跳转到gallery的内部页面
  processGalleryImg(zoomRef?.current)
}

// 页内数据库点击禁止跳转,只能查看
if (POST_DISABLE_DATABASE_CLICK) {
  processDisableDatabaseUrl()
}



/**
 * 页面的数据库链接禁止跳转,只能查看
 */
const processDisableDatabaseUrl = () => {
  if (isBrowser) {
    const links = document.querySelectorAll('.notion-table a')
    for (const e of links) {
      e.removeAttribute('href')
    }
  }
}

Copy link

vercel bot commented May 11, 2024

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

Name Status Preview Comments Updated (UTC)
notion-next-home ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 11, 2024 3:33am
notion-next-seo-lesson ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 11, 2024 3:33am

@tangly1024 tangly1024 merged commit c294689 into main May 11, 2024
6 of 7 checks passed
Copy link

netlify bot commented May 11, 2024

Deploy Preview for beamish-semolina-0ecf31 ready!

Name Link
🔨 Latest commit 949a824
🔍 Latest deploy log https://app.netlify.com/sites/beamish-semolina-0ecf31/deploys/663ee6f48d345e0008e51d48
😎 Deploy Preview https://deploy-preview-2403--beamish-semolina-0ecf31.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 site configuration.

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.

None yet

1 participant