Skip to content

fix: 修复 .logo-text 样式冲突问题#2839

Merged
lzxue merged 1 commit into
masterfrom
fix/logo-text-css-conflict
Mar 27, 2026
Merged

fix: 修复 .logo-text 样式冲突问题#2839
lzxue merged 1 commit into
masterfrom
fix/logo-text-css-conflict

Conversation

@lzxue
Copy link
Copy Markdown
Contributor

@lzxue lzxue commented Mar 20, 2026

描述

修复 Issue #2838: L7 的 .logo-text 样式使用 !important 覆盖了用户自定义的同名样式

问题原因

原有的 CSS 使用了通用的 .logo-text 选择器,当用户在自己的代码中也定义 .logo-text 时,会被 L7 的 display: none !important 规则覆盖。

修复内容

.logo-text 选择器限定在特定的容器 class 内(.tmap-contianer--hide-logo),确保只在 L7 的地图容器内隐藏 logo 文本,不影响用户的自定义样式。

代码变更

  • packages/maps/src/gmap/logo.css: 使用 .tmap-contianer--hide-logo .logo-text
  • packages/maps/src/tdtmap/logo.css: 使用 .tencent-map--hide-logo .logo-text
  • packages/maps/src/tmap/logo.css: 使用 .tencent-map--hide-logo .logo-text

✅ 解决了 Issue #2838

将 .logo-text 选择器限定在特定的容器 class 内
避免影响用户自定义的 .logo-text 元素

fix #2838
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 20, 2026

⚠️ No Changeset found

Latest commit: 06e8b4f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此 PR 旨在修复地图 logo 样式冲突问题。原有的全局 .logo-text 样式会覆盖用户自定义的同名样式。通过将选择器限定在特定的容器 class 内,解决了这一问题,确保 L7 地图容器内的 logo 文本隐藏不影响用户的自定义样式。

Highlights

  • 样式冲突修复: 此 PR 修复了由于全局 .logo-text 样式定义与用户自定义样式冲突的问题。
  • 选择器限定: 通过将 .logo-text 选择器限定在特定的容器 class 内,避免了对用户自定义样式的意外覆盖。
  • 问题解决: 此 PR 解决了 Issue .logo-text样式覆盖了我的.logo-text样式 #2838,确保 L7 地图容器内的 logo 文本隐藏不影响用户的自定义样式。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

本次 PR 旨在通过限定 CSS 选择器作用域来解决 .logo-text 样式冲突问题。这个方向是正确的,但实现上存在一些问题。我在 gmaptdtmap 的 CSS 文件中发现了一些似乎是复制粘贴产生的无关样式,并建议移除它们以提高代码质量。此外,tmap 的实现中存在一个 bug,CSS 中使用的类名与 TypeScript 代码中添加的类名不匹配,这将导致功能失效。我还发现了一些类名中的拼写错误和命名不一致问题。具体的修改建议请见各文件的审查评论。

Comment on lines +1 to +2
.tencent-map--hide-logo img[src*='//mapapi.qq.com/web/jsapi/logo/logo_def.png'],
.tencent-map--hide-logo .logo-text {
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.

high

这里的类名 .tencent-map--hide-logopackages/maps/src/tmap/map.tshideLogo 方法实际添加的类名 tmap-contianer--hide-logo 不一致。这会导致隐藏 logo 的功能失效。

tmap-contianer--hide-logo 中还存在拼写错误 (contianer 应为 container)。

为了修复这个 bug 并提高代码一致性,建议将 TypeScript 文件中使用的类名统一为 tencent-map--hide-logo,因为它能更清晰地表达其用于腾讯地图的意图。

请在 packages/maps/src/tmap/map.ts 中做出如下修改:

// packages/maps/src/tmap/map.ts:507
DOM.addClass(container, 'tencent-map--hide-logo');

Comment on lines +1 to +2
.tmap-contianer--hide-logo img[src*='//mapapi.qq.com/web/jsapi/logo/logo_def.png'],
.tmap-contianer--hide-logo .logo-text {
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.

medium

这个类名 tmap-contianer--hide-logo 中存在一个拼写错误,contianer 应该为 container

另外,这个 CSS 文件是用于 Google Map (gmap) 的,但类名以 tmap 开头,并且 img 选择器 img[src*='//mapapi.qq.com/web/jsapi/logo/logo_def.png'] 针对的是腾讯地图的 logo。这看起来是错误的。

建议进行以下修改:

  1. 使用更合适的类名 gmap-container--hide-logo
  2. 移除针对腾讯地图 logo 的 img 选择器,因为它不适用于 Google Map。

这样可以使代码更清晰且正确。请记得在 packages/maps/src/gmap/map.ts 中也同步更新类名。

.gmap-container--hide-logo .logo-text {

Comment on lines +1 to +2
.tencent-map--hide-logo img[src*='//mapapi.qq.com/web/jsapi/logo/logo_def.png'],
.tencent-map--hide-logo .logo-text {
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.

medium

这个 CSS 文件是用于天地图 (tdtmap) 的,但 img 选择器 img[src*='//mapapi.qq.com/web/jsapi/logo/logo_def.png'] 针对的是腾讯地图的 logo,这似乎不正确。

建议移除这个不相关的 img 选择器。另外,为了与 tmap 区分,建议使用更具体的类名,例如 tdtmap-container--hide-logo

由于 tdtmap/map.ts 中尚未实现 hideLogo 功能,这个 CSS 当前不会生效,但进行以上修改可以让未来的实现更清晰。

.tdtmap-container--hide-logo .logo-text {

@lzxue lzxue merged commit f477578 into master Mar 27, 2026
8 checks passed
@lzxue lzxue deleted the fix/logo-text-css-conflict branch March 27, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant