The MVP of the table feature doesn't contain a support for block content inside table cells. So, the first version will only support inline content (no images, no lists, no hard line breaks etc.)
Support for block content is our next priority after releasing the MVP. The challenge here is the UX. By default, we insert a table with inline content only:
<table>
<tr>
<td>Foo</td>
<td>Boo</td>
</tr>
</table>
When the user presses Enter in one of the cells, what should happen? We need to insert paragraphs there:
<table>
<tr>
<td><p>Foo</p><p>Bar</p></td>
<td>Boo</td>
</tr>
</table>
Is it ok that only one cell has block content and the other has inline content? This may cause vertical misalignment due to styling (paragraphs have margins) and general mess. So perhaps once you create block content in one of the cells, we should turn the entire table into "block table"?
There are also implementation issues. How to reflect that in the schema? A cell may contain inline content. Or it may contain block content. These are two different types of cells. Two different elements. Also, for features like headings, lists, etc. to be enabled, a block must be allowed in the current selection position. So, without paragraphs in the model all these features will be disabled. So, in fact, we always need paragraphs in the model.
And so on and so on :)
Quick test of:
schema.extend( '$block', { allowIn: 'tableCell' } );
Kinda works (I didn't check for bugs long enough to find any):

As you can see both types of content are allowed in tableCell so maybe it will work on single tableCell element :thinking:.
Some observations:
<p>'s in tableCell on enter yet... (probably a similar check in the schema is need as in blockquote)
$text out of the box ;)Mah... infinite table nesting FTW!

Does it work with collaboration?
@pjasiun kinda works (I didn't check for editing in the same time of a table though):

:D
BTW, I'm ok with disallowing tables in tables. I even think that it should be the default. Block content makes sense in table cells, but whole tables do not. Let's start with such a simplification and see.
BTW, I'm ok with disallowing tables in tables. I even think that it should be the default. Block content makes sense in table cells, but whole tables do not. Let's start with such a simplification and see.
Me too. But it is cool that it is possible :)
OK time for some decisions to make as I've almost got this working:

@Reinmar / @pjasiun / @oleq : Things to consider:
<paragraph> and then execute enter command (for me not executing enter is not OK as it might lead to WTFs if "nothing changes" after one enter press.<paragraph>s - YES / NO?paragraph model is not available (kinda makes sense)?$text and $block inside tableCell is OK or do we need tow different elements like in @Reinmar's issue description?$text only should be wrapped in <paragraph> before merging$text + $text as now, <blockA> + <blockB> no merging even if same type of node (paragraph, list, etc)?ps.: Right now I have this thing working with some minor bugs with tab/shift+tab but this probably will be resolved quickly.
Edit: Added point 5 about tab in list in table cell.
Edit 2: Added point 6 about merging cells...
After some F2F talks:
<paragraph> inside <tableCell> in the model for empty cells and text-only cells. However it will be rendered differently for editng/data:<paragraph> will be rendered as <span> (if necessary), all other block (if single) or more then one <paragraph> will be rendered as in other places.<paragraph> will not be reneder (so it's $text will be placed directly into the <td> element.<p> elements.<paragraph> always present in the model.Table feature will not work without Paragraph properly but as for now we do not care as much - editor will throw error eventually.<listItem> will indent list.@Reinmar & @pjasiun another thing...
What if <paragraph> has attribute like alignment="right" - I suppose that we should output the <p> even if such scenario:
<table>
<tableRow>
<tableCell>
<paragraph textAlign="left">foo</pargraph>
</tableCell>
</tableRow>
</table>
so the output will be:
<table>
<tbody>
<tr>
<td>
<p style="text-align:right;">foo</p>
</td>
</tr>
</tbody>
</table>
Yes... and no. I forgot about this but we discussed it on the first meeting. The problem here is that when you have a single block of content in a table cell then clicking the alignment buttons may also apply to the entire table cell... In fact, such option might also be useful even if there are multiple blocks. Unfortunately, as most non-semantical information, it can be applied pretty much everywhere and I can easily imagine people wanting to do all these things.
Let's extract this to a separate ticket because it may be a long and tiring discussion.
@oleq: maybe something to consider is how to style block contents inside table. With current styles we have something like this:

The most annoying are centered lists but other styles might some tuning also.
I guess we should fix the styles. OTOH:
It's unlikely a table will mix an inline and block content
I think that a table with one table cell with block contend and single paragraphs (inline content?) will already mix:

I'm not sure whether they should be fixed in the table content styles or feature (list, heading) content styles.
A perfect solution would be conditionally loaded styles for integration purposes like theme/table-paragraph.css or theme/table-list.css but we do not have such mechanism :) So I'm for the first option - table.css should do this.
It's unlikely a table will mix an inline and block content
This is quite frequent use case. See for example:
@oleq As ckeditor/ckeditor5-table#97 is almost ready: how to change table's content styles: should we revert to left alignment for table cells? Mixed? Follow up?
Ping, @oleq
@oleq As ckeditor/ckeditor5-table#97 is almost ready: how to change table's content styles: should we revert to left alignment for table cells? Mixed? Follow up?
TBH I'm not sure I understand this question.
But I'd go with either:
table.css which makes the block content look like there was no table around (e.g. list items aligned to left instead of center). Unless we come up with some very smart table styles management system, leaving the whole "problem" to developers feels like a safe decision.I guess there's no good reason for CKE5 to stand out so I'd rather go with the later. It's simpler too and doesn't need maintanence as new content types arrive down the road. TBH, I don't quite remember why we went with centered table content in the first place (anyone?).
table cell content aligned to the left by default. Then, there's no problem in the first place 馃槢 It's also the styling most of the WYSIWYG (and native too) editors implement out-of-the-box.
馃憤
We may perhaps consider whether headings should be centred or not. They will rarely contain block content and I think that it's frequent to centre them, but I don't know if it's worth potential problems and introducing such a difference in comparison to normal cells.
@Reinmar & @oleq to sum up and finish ckeditor/ckeditor5-table#97:
The styles of block contents inside a table will be as they are in other parts of the editor:
Paragraph: left alignedHeading: left alignedListItem: left aligned