feat: add hover controls to add/remove table rows and columns - #31
Merged
Conversation
du82
requested changes
Sep 3, 2026
Owner
|
Ignore my second critique, turns out I was doing it wrong! Fix padding and should be good to go |
Contributor
Author
|
okie one sec |
netqo
force-pushed
the
feat/table-controls
branch
from
September 3, 2026 01:33
70b88ea to
634c1f0
Compare
du82
requested changes
Sep 3, 2026
Editing tables in the live editor was hard: rows could only be added via Enter/Tab inside a cell, and the column insert/delete primitive (_tableColumnResult) existed but had no caller, so columns could not be changed at all from the UI. Add hover-revealed controls anchored to the live table: - a "+" bar on the right edge appends a column, and one on the bottom edge appends a row; - a small "x" above each column and to the left of each body row deletes that specific column/row. Controls are rendered as part of the table markup, so they are recreated on every re-render and never touch the markdown source: they are contenteditable="false", carry no data-editable/data-from, and are ignored by the DOM-to-source mapping. Handles are positioned by anchoring to real th/td boxes, so they track column/row geometry with no JS measurement. Clicks are dispatched through the existing delegated live click handler to the existing row/column mutation primitives, so undo, redo, and screen-reader announcements work unchanged. Controls are hidden when the editor is read-only or disabled, the delete-column handle is hidden at one column, and delete-row handles are absent when the body is empty.
Contributor
Author
|
makes sense also did the same for when theres only 1 row in the table. |
netqo
force-pushed
the
feat/table-controls
branch
from
September 3, 2026 01:54
634c1f0 to
3cd90f5
Compare
Owner
|
LGTM! |
Owner
|
Send a Monero sub-address if you'd like to claim a bounty |
Contributor
Author
|
yay okie |
Owner
|
Please contact me on Signal regarding the bounty. It's important. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #30
Problem
Editing a table in the live editor was awkward. Rows could only be added by
pressing Enter/Tab inside a cell, and there was no way at all to add or remove a
column from the UI: the column mutation primitive (
_tableColumnResult) alreadyexisted in
writemark.jsbut had no caller.What this does
Adds hover-revealed controls on live-editor tables:
+tab at the top-right adds a column, and a+tab below the table adds arow;
-tab centered above each column deletes that column, and a-tab at eachbody row's right edge deletes that row.
All four are identically sized, slightly-rounded tabs (2px corners, matching the
Publish button) and appear only while hovering the table (each delete tab shows
when hovering its column/row).
How
on every re-render and never touch the markdown source: they are
contenteditable="false", carry nodata-editable/data-from, and areignored by the DOM-to-source mapping.
table edge via CSS (top, bottom, or right). The block adds no padding, so the
table keeps its normal spacing and stays flush with the editor, and every tab
stays within the table box - nothing spills outside to get clipped or to
trigger a scrollbar.
existing row/column primitives (
_tableColumnResult,_tableRowInsertionResult,_tableDeleteRowResult), so undo/redo andscreen-reader announcements work unchanged.
tab is hidden while only two columns remain and the delete-row tab while only
one row remains, keeping two columns and one row as the minimums.
No changes to the Rust renderer or the published output - this is editor-only.
Scope
One file,
templates/writemark.js(+72 / -5): the_renderTablemarkup, a smallCSS block, two lines in the live-click handler, a one-line mousedown guard, and
an ~18-line dispatch method.
Testing
control, and asserts the markdown source mutates correctly (add-col, add-row,
del-col, del-row), that a single-column table hides the delete-column tab, and
that a read-only editor renders no controls. 9/9 passing.
build strips module
exports and line comments; both the raw module and thestripped inline form parse), and that tables behave as described.