-
Notifications
You must be signed in to change notification settings - Fork 40
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(table): allow parsing for TH elements in table module #531
The head ref may contain hidden characters: "529-buggethtml-\u4FDD\u5B58\u8FDB\u6570\u636E\u5E93\u4E2D-\u53D6\u51FA\u6765sethtml\u8D4B\u503C\u8FDB\u53BB-table-\u4E2D\u7684\u6837\u5F0F\u6BD4\u5982\u5355\u5143\u683C\u7684\u989C\u8272\u6837\u5F0F\u4F1A\u4E22\u5931"
fix(table): allow parsing for TH elements in table module #531
Conversation
WalkthroughThe pull request updates the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant Parser as parseStyleHtml
Caller ->> Parser: call with an element
alt element.tagName is one of ["TABLE", "TD", "TH"]
Parser -->> Caller: Process element further
else element.tagName is not one of ["TABLE", "TD", "TH"]
Parser -->> Caller: Return original node
end
Possibly related PRs
Poem
Tip 🌐 Web search-backed reviews and chat
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (2)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/table-module/src/module/parse-style-html.ts (2)
31-35
: Consider default border handling for TH elements.The default border is only applied to TD elements. Consider whether TH elements should have similar default styling for consistency.
- if (!border && elem.tagName === 'TD') { + if (!border && ['TD', 'TH'].includes(elem.tagName)) { // https://github.com/wangeditor-next/wangEditor-next/blob/master/packages/table-module/src/assets/index.less#L20 - // TD存在默认的css样式,尝试用getComputedStyle获取不到,只能写死 + // TD/TH存在默认的css样式,尝试用getComputedStyle获取不到,只能写死 border = `1px solid ${DEFAULT_BORDER_COLOR}` }
1-4
: Enhance function documentation.The JSDoc should document which HTML elements are supported by this function.
/** * @description parse style html + * @param {DOMElement} elem - The HTML element (TABLE, TD, or TH) + * @param {Descendant} node - The Slate node to update + * @param {IDomEditor} _editor - The editor instance + * @returns {Descendant} The updated node * @author hsuna */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/table-module/src/module/parse-style-html.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: test-e2e
- GitHub Check: test
🔇 Additional comments (1)
packages/table-module/src/module/parse-style-html.ts (1)
17-17
: LGTM! Clean implementation of TH support.The change to use array includes is more maintainable and correctly implements TH element support.
Changes Overview
Implementation Approach
Testing Done
Verification Steps
Additional Notes
Checklist
Related Issues
Summary by CodeRabbit