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

fix(Watermark): remove 'hidden' when append watermark, prevent hide … #52891

Merged
merged 2 commits into from
Feb 20, 2025

Conversation

arronlai
Copy link
Contributor

@arronlai arronlai commented Feb 19, 2025

…watermark by editing DOM attributes

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ❓ Other (about what?)

🔗 Related Issues

  • Describe the source of related requirements, such as links to relevant issue discussions.
  • For example: close #xxxx, fix #xxxx

💡 Background and Solution

  • The specific problem to be addressed.
  • List the final API implementation and usage if needed.
  • If there are UI/interaction changes, consider providing screenshots or GIFs.

📝 Change Log

Language Changelog
🇺🇸 English Remove 'hidden' when append watermark to prevent watermark from hiding by editing DOM attributes.
🇨🇳 Chinese 添加水印DOM节点时删除hidden属性,避免通过F12修改水印可以直接隐藏水印的行为。

Copy link

stackblitz bot commented Feb 19, 2025

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Contributor

github-actions bot commented Feb 19, 2025

Preview is ready

Copy link
Contributor

github-actions bot commented Feb 19, 2025

👁 Visual Regression Report for PR #52891 Passed ✅

🎯 Target branch: master (d5d9a36)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎

🎊 Congrats! No visual-regression diff found.

Copy link

Walkthrough

This pull request modifies the watermark component to remove the 'hidden' attribute when appending the watermark element. This change is intended to prevent the watermark from being hidden by editing DOM attributes, enhancing the robustness of the watermark feature.

Changes

File Summary
components/watermark/useWatermark.ts Removed the 'hidden' attribute from the watermark element to prevent it from being hidden via DOM manipulation.

@@ -49,6 +49,7 @@ export default function useWatermark(
);
// Prevents using the browser `Hide Element` to hide watermarks
watermarkEle.removeAttribute('class');
watermarkEle.removeAttribute('hidden')

Choose a reason for hiding this comment

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

Ensure that removing the 'hidden' attribute does not inadvertently expose any sensitive information or affect other functionalities that rely on this attribute.

Copy link

codecov bot commented Feb 19, 2025

Bundle Report

Changes will increase total bundle size by 8 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.38MB 8 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: antd.min-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antd-with-locales.min.js 4 bytes 1.84MB 0.0%
antd.min.js 4 bytes 1.54MB 0.0%

Copy link

pkg-pr-new bot commented Feb 19, 2025

Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (3bc18c3) to head (bc8d41a).
Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #52891   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          768       768           
  Lines        13844     13848    +4     
  Branches      3629      3629           
=========================================
+ Hits         13844     13848    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: afc163 <afc163@gmail.com>
@afc163 afc163 changed the title feat(Watermark): remove 'hidden' when append watermark, prevent hide … fix(Watermark): remove 'hidden' when append watermark, prevent hide … Feb 19, 2025
@afc163 afc163 merged commit 6588b22 into ant-design:master Feb 20, 2025
44 checks passed
Copy link
Contributor

🎉 Thank you for your contribution! If you have not yet joined our DingTalk community group, please feel free to join us (when joining, please provide the link to this PR).

🎉 感谢您的贡献!如果您还没有加入钉钉社区群,请扫描下方二维码加入我们(加群时请提供此 PR 链接)。

@PeachScript PeachScript mentioned this pull request Feb 24, 2025
16 tasks
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