Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 1, 2025

This PR implements a comprehensive CSV editor for BlockPy, addressing the need for easy CSV file editing in the introductory block-based data science environment.

Implementation Overview

The CSV editor provides a user-friendly table interface for editing CSV data, following the same architectural patterns as existing editors (JSON, Markdown, etc.). It integrates seamlessly with BlockPy's file system and editor switching mechanism.

Key Features

Table Editing Interface: Edit CSV data in a structured table format with individual cell editing, making it intuitive for users to work with tabular data.

Dynamic Row/Column Management: Add and delete rows and columns with dedicated buttons, allowing users to reshape their data structure as needed.

Raw Text Mode: Toggle between table view and raw CSV text editing for advanced users who need direct access to the CSV format.

Robust CSV Parsing: Handles complex CSV cases including:

  • Fields containing commas, quotes, and newlines
  • Proper quote escaping and unescaping
  • Empty fields and rows

Visual Selection: Click-to-select functionality for rows and columns, with visual highlighting to indicate what will be deleted.

Technical Implementation

The implementation consists of:

  • src/editor/csv.js: New CSV editor component (331 lines) with custom CSV parser and table rendering
  • src/editors.js: Registration of CSV editor for .csv file extension
  • src/css/blockpy.css: Comprehensive styling for table interface, including hover effects, selection highlighting, and responsive design

The CSV editor follows the AbstractEditor pattern, ensuring consistent behavior with file watching, upload/download functionality, and read-only mode support.

Demonstration

CSV Editor Demo

The screenshot shows the CSV parser correctly handling complex data with commas and quotes, demonstrating the robust implementation that can handle real-world CSV files.

Quality Assurance

  • ✅ Build process completes successfully with no errors
  • ✅ ESLint passes with no warnings or style violations
  • ✅ Follows existing BlockPy architectural patterns
  • ✅ Comprehensive CSV parsing tests verify correct handling of edge cases

This implementation provides the foundation for making BlockPy a leading data science education platform by enabling intuitive CSV file editing capabilities.

Fixes #100.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Editable CSV Files Implement editable CSV files with table-based editor Sep 1, 2025
Copilot finished work on behalf of acbart September 1, 2025 04:05
Copilot AI requested a review from acbart September 1, 2025 04:05
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.

Editable CSV Files

2 participants