-
-
Notifications
You must be signed in to change notification settings - Fork 735
[ baobao ] Fix drag handle vertical alignment for table blocks #2604 #2774
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -242,6 +242,11 @@ export class SideMenuView< | |
| if (this.editor.isEditable) { | ||
| const blockContentBoundingBox = block.node.getBoundingClientRect(); | ||
| const column = block.node.closest("[data-node-type=column]"); | ||
| const blockNodeElement = block.node; | ||
| const tableElement = blockNodeElement.querySelector("[data-node-type=tableContent]"); | ||
| const yPos = tableElement | ||
| ? blockContentBoundingBox.y + (tableElement.getBoundingClientRect().top - blockContentBoundingBox.top) / 2 | ||
| : blockContentBoundingBox.y; | ||
|
Comment on lines
+245
to
+249
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent use of Line 248 mixes ♻️ Suggested refactor for consistency and clarity- const blockNodeElement = block.node;
- const tableElement = blockNodeElement.querySelector("[data-node-type=tableContent]");
- const yPos = tableElement
- ? blockContentBoundingBox.y + (tableElement.getBoundingClientRect().top - blockContentBoundingBox.top) / 2
- : blockContentBoundingBox.y;
+ const blockNodeElement = block.node;
+ const tableElement = blockNodeElement.querySelector("[data-node-type=tableContent]");
+ const yPos = tableElement
+ ? (blockContentBoundingBox.y + tableElement.getBoundingClientRect().y) / 2
+ : blockContentBoundingBox.y;This algebraically equivalent form uses 🤖 Prompt for AI Agents |
||
| this.state = { | ||
| show: true, | ||
| referencePos: new DOMRect( | ||
|
|
@@ -254,7 +259,7 @@ export class SideMenuView< | |
| : ( | ||
| this.pmView.dom.firstChild as HTMLElement | ||
| ).getBoundingClientRect().x, | ||
| blockContentBoundingBox.y, | ||
| yPos, | ||
| blockContentBoundingBox.width, | ||
| blockContentBoundingBox.height, | ||
| ), | ||
|
|
||
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.
🧩 Analysis chain
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 46
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 4449
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 7768
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 45786
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 6537
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 17166
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 7782
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 9726
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 284
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 10763
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 16129
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 2352
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 273
🏁 Script executed:
Repository: TypeCellOS/BlockNote
Length of output: 5709
Fix table side menu alignment:
[data-node-type=tableContent]doesn’t match TableHandles’<tbody>SideMenu.ts(line 246) looks forblockNodeElement.querySelector("[data-node-type=tableContent]"), but the only occurrence ofdata-node-type="tableContent"in the repo is this line—table rendering doesn’t set that attribute.TableHandles.tsmeasures alignment from the real table body viathis.tableElement!.querySelector("tbody")andreferencePosTable = tableBody.getBoundingClientRect(), so the side menu’s y positioning won’t be based on the same element.Update
SideMenuto use the same DOM element asTableHandles(e.g., derive y from the table’s<tbody>/table wrapper) instead of[data-node-type=tableContent].🤖 Prompt for AI Agents