slate-edit-table icon indicating copy to clipboard operation
slate-edit-table copied to clipboard

Support merging cells

Open rendongsc opened this issue 7 years ago • 4 comments

any plans to provide merge cell functionality? thanks!

rendongsc avatar Jul 21 '17 09:07 rendongsc

We don't plan on implementing this feature. Anyone would like to help make it happen?

Edit: To be clear on the feature, it would be like any Google Docs or Word tables. You should be able to mark a group of adjacent cells as "merged". They still occupy the same space as a group, but they are shown as one big single cell.

Soreine avatar Sep 20 '17 09:09 Soreine

Stumbled on something (I think) related: when I use the plugin with some Slate state that I've parsed, it will normalize TR nodes to have a constant number of TD elements.

So the Slate state might be based off parsing HTML that looks like:

<tr><td></td><td></td></tr>
<tr><td colspan="2"></td>

But the editor will render all <tr> elements with 2 <td> elements.

Presumably implementing colspan handling is how merge cells would work?

sebastianiorga avatar Jun 07 '18 14:06 sebastianiorga

At my company we're using slate in production and the merge/split was a necessity. So we've made the changes to the slate-edit-table plugin. So far we only support single-row column merge and split and they're implemented using a colspan property (the key is user-defined) set on the cell data. The behavior is mirrored from Google Docs.

@Soreine, does this sound like an acceptable implementation? I can post a PR in the upcoming days if there's interest.

aRusenov avatar Jun 14 '18 16:06 aRusenov

@aRusenov - where's your fork? I'd love to see it.

edeustace avatar Aug 06 '18 16:08 edeustace