Skip to content

Conversation

@IsDyh01
Copy link
Contributor

@IsDyh01 IsDyh01 commented Nov 3, 2025

中文版模板 / 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
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

#1293

  • 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
🇨🇳 Chinese

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

Preview is ready

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @IsDyh01, 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!

This pull request enhances the Sender component by adding a clear button to its tag slots. This new feature allows users to intuitively remove individual tags directly from the input area, improving the overall user experience and flexibility when managing slotted content. The changes include both the UI element and the underlying logic to manage state updates upon tag removal.

Highlights

  • New Feature: Tag Slot Clear Button: Introduced a 'clear' button for tag slots within the Sender component's SlotTextArea, allowing users to remove individual tags directly from the input.
  • Tag Removal Logic: Implemented the removeTagSlot function to handle the complete removal of a tag slot, including updating the DOM, synchronizing component state (slot configurations, values, and placeholders), and triggering the onChange event.
  • Conditional Rendering and Styling: The clear button is conditionally rendered only when the component is not in readOnly mode. New styling rules have been added to ensure the clear button is visually integrated.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@dosubot dosubot bot added the enhancement New feature or request label Nov 3, 2025
Copy link

@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

This pull request introduces a new feature to add a clear button on 'tag' type slots in the Sender component. The implementation is well-structured, adding a removeTagSlot function to handle the removal logic and updating the rendering of tag slots to include the new button. The changes also include appropriate styling for the new element. My main feedback concerns a type safety issue where a MouseEvent is incorrectly cast to EventType. I've provided suggestions to fix this to ensure the component's API contract is respected.

Comment on lines +140 to +161
const removeTagSlot = (key: string, e?: EventType) => {
const span = getSlotDom(key);
if (span && editableRef.current && editableRef.current.contains(span)) {
editableRef.current.removeChild(span);
}
slotDomMap.current.delete(key);
// 移除配置与值
slotConfigRef.current = (slotConfigRef.current || []).filter((item) => item.key !== key);
setSlotValues((prev) => {
const next = { ...prev };
delete next[key];
return next;
});
setSlotPlaceholders((prev) => {
const next = new Map(prev);
next.delete(key);
return next;
});
// 触发 onChange
const newValue = getEditorValue();
onChange?.(newValue.value, e, newValue.config);
};

Choose a reason for hiding this comment

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

high

The function currently accepts an e?: EventType argument, which is then passed to onChange. However, the click event that triggers this is a MouseEvent, which is not compatible with EventType (React.FormEvent<HTMLTextAreaElement> | React.ChangeEvent<HTMLTextAreaElement>). This creates a type inconsistency in the component's API. To resolve this, removeTagSlot should not accept an event argument, and onChange should be called with undefined for the event parameter.

  const removeTagSlot = (key: string) => {
    const span = getSlotDom(key);
    if (span && editableRef.current && editableRef.current.contains(span)) {
      editableRef.current.removeChild(span);
    }
    slotDomMap.current.delete(key);
    // 移除配置与值
    slotConfigRef.current = (slotConfigRef.current || []).filter((item) => item.key !== key);
    setSlotValues((prev) => {
      const next = { ...prev };
      delete next[key];
      return next;
    });
    setSlotPlaceholders((prev) => {
      const next = new Map(prev);
      next.delete(key);
      return next;
    });
    // 触发 onChange
    const newValue = getEditorValue();
    onChange?.(newValue.value, undefined, newValue.config);
  };

Comment on lines +230 to +232
onClick={(e) => {
removeTagSlot(node.key as string, e as unknown as EventType);
}}

Choose a reason for hiding this comment

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

high

The onClick handler is casting a MouseEvent to EventType, which is incorrect. Following the change suggested for removeTagSlot, this call should be updated to not pass the event argument.

Suggested change
onClick={(e) => {
removeTagSlot(node.key as string, e as unknown as EventType);
}}
onClick={() => {
removeTagSlot(node.key as string);
}}

@codecov
Copy link

codecov bot commented Nov 3, 2025

Bundle Report

Changes will increase total bundle size by 10.04kB (0.26%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
x-markdown-array-push 3.94MB 10.04kB (0.26%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: x-markdown-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
mermaid.min.js 10.04kB 3.94MB 0.26%

@IsDyh01 IsDyh01 closed this Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant