Skip to content

feat: Add native support for inserting editable and responsive tables (#21)#29

Open
Rishabh1925 wants to merge 2 commits into
Ashish94312:mainfrom
Rishabh1925:feat/insert-table-21
Open

feat: Add native support for inserting editable and responsive tables (#21)#29
Rishabh1925 wants to merge 2 commits into
Ashish94312:mainfrom
Rishabh1925:feat/insert-table-21

Conversation

@Rishabh1925

Copy link
Copy Markdown

Closes #21

Summary: This PR introduces support for inserting tables into the editor, complete with basic structural controls and responsive handling for mobile viewports.

Key Implementation Details:

  1. Toolbar Button: Added the 'Insert Table' button (📋) to the main Insert Group of the editor toolbar (EditorToolbar.jsx).
  2. Insertion Handler: Implemented the insertTable command in useEditor (Editor.jsx).
  3. Stability Hack (Critical): The implementation utilizes document.execCommand('insertHTML') to inject a static HTML table structure wrapped in a <div contenteditable='false'> container. This prevents the rich text editor (which relies on document.execCommand) from corrupting the table's internal DOM structure, ensuring the table remains functional and stable within the editor.
  4. Table Structure (TableComponent.jsx): Provides a basic 3x3 table with inline styles for visibility.
  5. Responsiveness: The injected table structure includes min-width: 600px and is wrapped in a container with overflow-x: auto to ensure the table scrolls horizontally on mobile devices without causing the main document page to overflow.

Ready for Review.

@Rishabh1925

Rishabh1925 commented Oct 29, 2025

Copy link
Copy Markdown
Author

Hi @Ashish94312,

I've submitted PR #21 which adds table support.

@Ashish94312

Copy link
Copy Markdown
Owner

@Rishabh1925 can you check again its not working ig, or it's good if you share demo video.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add support for inserting table

2 participants