Skip to content

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

Merged
afc163 merged 2 commits intoant-design:masterfrom
arronlai:feature/watermark-observer
Feb 20, 2025
Merged

fix(Watermark): remove 'hidden' when append watermark, prevent hide …#52891
afc163 merged 2 commits intoant-design:masterfrom
arronlai:feature/watermark-observer

Conversation

@arronlai
Copy link
Copy Markdown
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修改水印可以直接隐藏水印的行为。

@bolt-new-by-stackblitz
Copy link
Copy Markdown

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 19, 2025

Preview is ready

@github-actions
Copy link
Copy Markdown
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.

@petercat-assistant
Copy link
Copy Markdown

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.

Comment thread components/watermark/useWatermark.ts Outdated
);
// Prevents using the browser `Hide Element` to hide watermarks
watermarkEle.removeAttribute('class');
watermarkEle.removeAttribute('hidden')
Copy link
Copy Markdown

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.

@codecov
Copy link
Copy Markdown

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%

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 19, 2025

@codecov
Copy link
Copy Markdown

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.

Comment thread components/watermark/useWatermark.ts Outdated
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
@github-actions
Copy link
Copy Markdown
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
renny-ren pushed a commit to renny-ren/ant-design that referenced this pull request Apr 14, 2025
…ant-design#52891)

* feat(Watermark): remove 'hidden' when append watermark, prevent hide watermark by editing DOM attributes

* Update components/watermark/useWatermark.ts

Signed-off-by: afc163 <afc163@gmail.com>

---------

Signed-off-by: afc163 <afc163@gmail.com>
Co-authored-by: afc163 <afc163@gmail.com>
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