Project

General

Profile

Actions

Feature #43950

closed

Add support for pasting spreadsheet tables as CommonMark/Textile tables in wiki textareas

Added by Katsuya HIDAKA 20 days ago. Updated 15 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Text formatting
Target version:
Resolution:
Fixed

Description

I think Redmine is often used alongside spreadsheet applications such as Microsoft Excel and Google Sheets. In such cases, it would be useful to paste tables from those applications directly into Redmine issues, wiki pages, and other wiki textareas as CommonMark or Textile tables. A similar feature has long been available on GitHub.

This issue adds support for converting pasted spreadsheet tables into CommonMark/Textile table syntax when they are pasted into wiki textareas.

  • Convert table elements contained in pasted text/html clipboard data into CommonMark/Textile table syntax
  • Support both CommonMark and Textile
  • Text and cell styles are not preserved
  • Confirmed to work with Microsoft Excel, Excel for the web, Google Sheets, and Numbers
  • As implemented, this also ends up supporting pasted HTML tables
  • Confirmed that all tests and lint checks pass: https://github.com/hidakatsuya/redmine/pull/37

Google Sheets:

CommonMark:

Textile:

About patch 0001:

Automatic list marker insertion was added to the search field in #43095, but that feature is unnecessary that field. Patch 0001 removes that unnecessary implementation.


Files

Actions #1

Updated by Go MAEDA 19 days ago

  • Category changed from Wiki to Text formatting
  • Target version set to Candidate for next major release
Actions #2

Updated by Katsuya HIDAKA 18 days ago

I updated patch 0002.

The main reason for the update is to avoid dropping non-table content unexpectedly. For example, with the previous implementation, if pasted HTML contained both a table and other content, the non-table content could be lost.

The revised patch now applies table paste only when the pasted HTML consists of a single standalone table, and otherwise leaves the paste to the browser's normal handling. In other words, it now converts the paste only when the pasted content is a single table.

I also limited the feature to tables with at least 2 rows and 2 columns, so that single-row or single-column tables are not converted.

It also includes some refactoring to improve code readability.

Actions #3

Updated by Go MAEDA 17 days ago

  • Target version changed from Candidate for next major release to 7.0.0

Setting the target version to 7.0.0.

Actions #4

Updated by Go MAEDA 15 days ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patches in r24585 and r24586. Thank you for your contribution.

Actions

Also available in: Atom PDF