slate-edit-table
slate-edit-table copied to clipboard
Support merging cells
any plans to provide merge cell functionality? thanks!
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.
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?
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 - where's your fork? I'd love to see it.