Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization of table block #1456

Merged
merged 38 commits into from
Oct 13, 2019
Merged

Optimization of table block #1456

merged 38 commits into from
Oct 13, 2019

Conversation

Jocs
Copy link
Member

@Jocs Jocs commented Oct 7, 2019

Q A
Bug fix? no
New feature? yes
Fixed tickets #32 #538
License MIT

Description

  • Support drag and drop row and column. Feature: make rows and columns in table block draggable #32 Allow moving/dragging table cells #538
  • Support click more button, and add/remove columns and rows.
  • Support select multiple cells in the same table and will highlight the selected cells.
  • Support copy and paste selected cells, create a new table when paste at blank paragraph.
  • Press backspace to remove all the content of selected cells. press backspace again will remove column or row if select one empty column or row.
  • Press backspace to remove whole table when selected all the cells of table and the table is empty.
  • SelectAll will select one cell or whole table.
  • Remove table tools in editor context menu(remove/insert row, remove/insert column, copy table etc),please click table drag bar.
  • Update table resize icon.

Existed Bugs

  • No need to show left drag bar if only one row, and no need to show bottom drag bar if only one column.
  • Table resize is not work in table tool bar.
  • Create an empty table in source code mode, turn to preview mode, there are more than two drag bars in one table.
  • Press tab will not show the table drag bars.
  • Drag any row to the top to editor will cause error.
  • Select multiples should not show the table drag bars.
  • Copy paste table will result in extra row table #1472Can not copy table upstream lib bug, should fix in other PR.
  • Select one cell and press backspace will cause bug
  • Cannot resize 1xY table #1461
  • Can not copy and paste 1 * 1, 1 * n, n * 1 selected cells as table.
  • The table drag bar location error when there are tow tables in the editor
  • backspace to jump to previous cell is not work, and select whole cell content, and press backspace is not work.

Screen shot

截屏2019-10-09下午10 14 00


This change is Reviewable

@Jocs Jocs changed the title Optimization of table block [WIP] Optimization of table block Oct 7, 2019
@Jocs Jocs added the 🐜 in progress This issue is in progress label Oct 7, 2019
@Jocs Jocs mentioned this pull request Oct 7, 2019
9 tasks
@Jocs Jocs force-pushed the opti-table-block branch 2 times, most recently from c196b14 to 2ecdf20 Compare October 9, 2019 18:04
@Jocs Jocs requested a review from fxha October 11, 2019 11:46
@Jocs Jocs changed the title [WIP] Optimization of table block Optimization of table block Oct 11, 2019
@Jocs Jocs added 🔍 need review This PR need review and removed 🐜 in progress This issue is in progress todo 🗒️ labels Oct 11, 2019
Copy link
Contributor

@fxha fxha left a comment

Choose a reason for hiding this comment

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

Really cool feature and I like it 😄 I found a few improvements and one bug, please see below.

  • I prefer the delete button from table tools on the right side - like before
  • The current drag&drop context menu text is a little bit confusing. Please adjust to something like Insert Row/Column Above/Below, Remove (current) Row/Column.
  • Table cell content should be deleted when selecting multiple cells and pressing delete key like Backspace
  • Please remove all console.log debug lines
  • Editor context menu Copy is disabled when selecting multiple cells but copies table cells

Bug:

  • TypeError: Cannot read property 'row' of null when insert a paragraph before or after table with editor context menu and type some text in new paragraph.

src/muya/lib/contentState/copyCutCtrl.js Outdated Show resolved Hide resolved
src/muya/lib/contentState/tableDragBarCtrl.js Show resolved Hide resolved
src/muya/lib/contentState/tableSelectCellsCtrl.js Outdated Show resolved Hide resolved
src/muya/lib/contentState/tableSelectCellsCtrl.js Outdated Show resolved Hide resolved
src/muya/lib/contentState/tableSelectCellsCtrl.js Outdated Show resolved Hide resolved
src/muya/lib/eventHandler/clickEvent.js Show resolved Hide resolved
src/muya/lib/eventHandler/mouseEvent.js Outdated Show resolved Hide resolved
src/muya/lib/utils/importMarkdown.js Show resolved Hide resolved
@Jocs
Copy link
Member Author

Jocs commented Oct 12, 2019

I prefer the delete button from table tools on the right side - like before

This is not easy to implemented only by css, because our table is not 100% width now.

The current drag&drop context menu text is a little bit confusing. Please adjust to something like Insert Row/Column Above/Below, Remove (current) Row/Column.

Modified

Table cell content should be deleted when selecting multiple cells and pressing delete key like Backspace

Added

Please remove all console.log debug lines

Fixed

Editor context menu Copy is disabled when selecting multiple cells but copies table cells

Support copy and cut selected table cells by shortcut and context menu.

TypeError: Cannot read property 'row' of null when insert a paragraph before or after table with editor context menu and type some text in new paragraph.

Can not reproduce it!?

@Jocs Jocs requested a review from fxha October 12, 2019 06:51
@fxha
Copy link
Contributor

fxha commented Oct 12, 2019

If you set the cursor in a cell that is not the first row and click the create paragraph after:

mt_table_exception

@Jocs
Copy link
Member Author

Jocs commented Oct 12, 2019

If you set the cursor in a cell that is not the first row and click the create paragraph after:

Fixed, pls test again.

@fxha
Copy link
Contributor

fxha commented Oct 12, 2019

If you set the cursor in a cell that is not the first row and click the create paragraph after:

Fixed, pls test again.

The bug is fixed but I noticed another issue when selecting multiple cells (so the cells are blue) and keep pressing left mouse button until the cursor is outside the table. The blue selection get unmarked but when you stop pressing left mouse button outside the table row === null exception occurs.

@Jocs
Copy link
Member Author

Jocs commented Oct 12, 2019

The bug is fixed but I noticed another issue when selecting multiple cells (so the cells are blue) and keep pressing left mouse button until the cursor is outside the table. The blue selection get unmarked but when you stop pressing left mouse button outside the table row === null exception occurs.

Fixed

@fxha fxha merged commit 289b17c into develop Oct 13, 2019
@fxha fxha deleted the opti-table-block branch October 13, 2019 11:23
@Jocs Jocs removed the 🔍 need review This PR need review label Oct 17, 2019
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.

None yet

2 participants