Skip to content

feat: simple editor tables#1190

Merged
3mcd merged 56 commits into
mainfrom
em/pm-tables
May 15, 2025
Merged

feat: simple editor tables#1190
3mcd merged 56 commits into
mainfrom
em/pm-tables

Conversation

@3mcd

@3mcd 3mcd commented Apr 28, 2025

Copy link
Copy Markdown
Collaborator

Issue(s) Resolved

Partial #1108, will add a follow-up PR for title and captions when #1177 lands.

High-level Explanation of PR

TODO: tests

  • Adds the prosemirror-tables table nodes to our schema.
  • Adds the prosemirror-tables tableEditing plugin to our plugin list.
  • Adds a new editor MenuBar button that will insert a fixed 3x3 table into the document immediately after the cursor position.
  • Adds some basic styling for tables.
  • Adds some basic Tab-key navigation for tables.

I also did some (fairly tame) refactoring of the way we track the active node that hopefully is a bit easier to understand and a little more fault-tolerant.

Test Plan

  • Add a table to the editor while editing any pub and experiment with inserting content in the fixed 3x3 cells.
  • Toggle the caption and title via the table's parent figure's attribute panel and try to add rich content to either.
  • Insert media somewhere (ideally outside of the table) and toggle the image's parent figure's title, caption, license, and credit nodes.

Screenshots (if applicable)

A table!

Screenshot 2025-04-29 at 11 53 30 AM

Notes

  • Lists look bad inside of the tables right now. Especially because I'm hiding the borders that would indicate why the spacing is so wonky.
  • prosemirror-table's columnResizing plugin currently breaks the editor, so it's disabled for now.
  • There are still several outstanding bugs, including one RangeError seemingly to do with document positions. I'll try to address them before merging the PR.

@3mcd 3mcd requested a review from allisonking April 28, 2025 16:53
@3mcd 3mcd marked this pull request as ready for review April 29, 2025 16:03
@3mcd 3mcd requested review from kalilsn and tefkah April 29, 2025 16:05
@3mcd 3mcd changed the title feat: first attempt at adding prosemirror-tables feat: simple editor tables Apr 29, 2025
@3mcd 3mcd added the preview Auto-deploys a preview application label Apr 29, 2025
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 April 29, 2025 18:19 Inactive
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 April 30, 2025 14:59 Inactive
Comment thread packages/context-editor/package.json Outdated
"prosemirror-tables": "^1.7.1",
"prosemirror-transform": "^1.10.0",
"prosemirror-view": "1.37.1",
"prosemirror-view": "1.39.2",

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.

I think we actually need this at 1.37.1 per https://github.com/handlewithcarecollective/react-prosemirror?tab=readme-ov-file#installation

Note: React ProseMirror releases are coupled to specific prosemirror-view releases, and are not guaranteed to work with other versions of prosemirror-view. Ensure that your version of prosemirror-view matches the version in React ProseMirror's peer dependencies!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hmmm okay. Everything seems to work with the bump, but I'll revert this change and silence the type errors I was getting.

@tefkah

tefkah commented May 1, 2025

Copy link
Copy Markdown
Member

was the goal to incorporate the designs that @ktyjscott shared here? https://knowledgefutures.slack.com/archives/CMAQM0BNV/p1741115441929979

i did not see it mentioned in the ticket, so maybe that was missed, but if it was skipped intentionally ofc ignore me!

@3mcd

3mcd commented May 1, 2025

Copy link
Copy Markdown
Collaborator Author

@tefkah Good question. I am omitting the precise table styling and interactivity, instead opting to just get a basic prosemirror-tables integration working. I'll also add the attributes menu for the title and caption. But all of the additional commands from the context menu, table resizing, etc should be considered OOS for this PR.

@3mcd 3mcd force-pushed the em/pm-tables branch 2 times, most recently from f8525ae to 6059fe9 Compare May 1, 2025 17:10
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 May 1, 2025 17:15 Inactive
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 May 1, 2025 17:22 Inactive
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 May 1, 2025 18:46 Inactive

@allisonking allisonking left a comment

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.

I think it looks great for a first pass! sorry for the merge conflicts 🙈

Comment thread core/app/components/ContextEditor/ContextEditorClient.tsx Outdated
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 May 14, 2025 16:52 Inactive
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 May 14, 2025 17:11 Inactive
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 May 14, 2025 19:16 Inactive
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 May 14, 2025 19:43 Inactive
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 May 14, 2025 20:29 Inactive
@3mcd 3mcd requested a deployment to gh-654103159-pr-1190 May 14, 2025 20:47 Pending
@3mcd 3mcd had a problem deploying to gh-654103159-pr-1190 May 14, 2025 22:03 Error
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 May 14, 2025 22:26 Inactive
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 May 14, 2025 22:59 Inactive
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 May 14, 2025 23:20 Inactive
@3mcd 3mcd temporarily deployed to gh-654103159-pr-1190 May 15, 2025 00:01 Inactive
@3mcd 3mcd requested a review from tefkah May 15, 2025 01:12

@tefkah tefkah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it works great now! other than small spacing/ordering changes (i would suggest we apply them) it works great!

thank you for your service 🫡 it seemed grueling

Comment thread packages/context-editor/src/style.css Outdated
Comment thread packages/context-editor/src/style.css Outdated
Comment thread packages/context-editor/src/style.css Outdated
3mcd and others added 3 commits May 15, 2025 06:51
Co-authored-by: Thomas F. K. Jorna <hello@tefkah.com>
Co-authored-by: Thomas F. K. Jorna <hello@tefkah.com>
Co-authored-by: Thomas F. K. Jorna <hello@tefkah.com>
@3mcd 3mcd merged commit 3e96677 into main May 15, 2025
10 checks passed
@3mcd 3mcd deleted the em/pm-tables branch May 15, 2025 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Auto-deploys a preview application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants