-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Table feature #610
Comments
One of the first things we have to settle on is how will we represent a table in the model structure. The easiest and more obvious solution is by doing it how it is in HTML. However, keep in mind that our model gives us some room for experiments. Maybe we can gain something from a different table representation in the model, as we did with lists. Lists converters got much complicated in the process, but we were able to use same mechanisms and algorithms as we had for paragraphs which was a big gain. Another thing is an "add row + add column" collaborative-editing problem. We had an idea to use deltas for this, but since we already decided to drop deltas, we will have to resort to either having this managed by post-fixer or having this managed by a custom model data structure. |
This is a preliminary analysis of requirements. When it comes to use cases, we want to support data tables. This comes in contrast with the use case we don't want to support at this stage, which is clearly described in the HTML5 specs for tabular data:
We'll still see developers asking for the above though and we'll handle such requests in a separate issue. Macro elementsThe macro elements of the table feature are:
Users would like to operate on all the above elements. HTML-wise, we follow the Editor Recommendations specs on tables. FeaturesThese list of features may be incomplete and it focuses just on UX and high-level features. The order in the list matters as this is the proposed way to releasing enhancements to the feature as a whole. Milestone 1 (MVP)
Milestone 2
Details
|
There's one tricky bit – table's default width. If you won't set any then it's 0px and you can't put caret inside table cells. 100% width is not always preferred. Padding in table cells may help, but it's not applied by all developers (depends on page styling). Etc, etc. I also wonder if we shouldn't propose a similar feature here as image styles. In a certain way, tables are very similar to images (they are blocks of content). (EDIT: I can see it's in milestone 2)
Two things here:
What about split? |
I am against having a custom data format (no surprise ;) ). I was thinking about some formats we could use and don't see much we can get using a custom one, but I see much we can lose.
I think that post-fixers are the way to go. |
I was thinking about the UX of the feature and this is what it should look like IMO:
That should be possible using the (main) toolbar button, which opens a drop-down representing a clickable, highlightable grid. Using the grid, the user selects the shape of the table they want to insert at current caret location (2x2, 1x4, etc.).
I think the table should come with an in–place toolbar just like the image, which offers different styles (side table, full–width table).
The caption "field", just like in images, should appear once the selection lands in the table.
This is where things become tricky. Most text processors use contextual menus to provide these features and we don't have this option. That's why we must either:
We can't use the image–like balloon toolbar here because it's huge and we can't cover the content with it. There's a lot of things happening around the table so this UI must be small and smart. BTW: Let's create a ckeditor5-table repository with dedicated issues for the engine, UX, UI, etc.. |
When it comes to the caption, it is still unclear to me if this should be in the bottom, like in images, or at the top. Anyway, I found this interesting resource, which clarifies how CSS can control its positioning: So, it doesn't matter much if we output it at the beginning or the end of the figure element. Maybe to make it in line with the image element, we leave it at the end. |
@oleq Regarding the dropdown in table cells, how it would work? Would the menu button appear only when the cell is selected? I'm wondering how a table with some financial data would look like (plenty of narrow columns with numbers) with this proposal. |
Yes, that was the idea. Then I figured it might not be the best idea after all because of what you just mentioned. Knowing that, I'd rather see a balloon attached to the table cell instead. |
@oleq I thought Froala's (https://www.froala.com/wysiwyg-editor) way of handling the UI for tables -- both for inserting them and for modifying them on cell click, is pretty clean and simple. With regards to the modifying of tables on cell click, they do have quite a bit of bells and whistles though, hence resulting in quite a bit of buttons. |
Thanks for the feedback, @jefflam. We've been considering that option and we're now undecided whether to attach the toolbar to the cell or to the table, so we have just one static toolbar floating around, instead of having it moving over the table contents whenever I move between cells. What do you think about that option? |
There are definitely pros and cons for both decisions, but the concern I would have with one fixed static toolbar would be the lack of context in making changes: i.e. adding a row below a certain row, or a column to the left of another column. In addition, in the event that a table grows quite large, would the static table toolbar -- if say, positioned at the top of the table -- make it a hassle for the end user to make changes contextually and quickly? |
By static, I meant to say that it is always in a predictable place, no matter the cell you are. If you start scrolling on a long table, we could think about having the balloon stuck to the top of the viewport, always visible to the user. But this is indeed a problem to take in consideration though. |
An additional problem is that the editor itself may have its main toolbar stuck at the top of the viewport, so the table ballon could collide with it. It sounds like the "on cell" toolbar is leading this contest. |
Just wanted to mention that there is another use case for tables when creating HTML email content. For HTML email, "tables" are really the only possible mechanism for controlling page layout. So for users creating html email content, there may be a layout table (maybe 100% height and width, invisible borders). Then one cell in that layout table would typically be the main content cell. That cell would contain paragraphs, headings, images, or even other (tabular data) tables. Probably, a layout table would be managed by a separate plugin - like an Email Layout Template plugin. I just mention it here so that when designing support for regular tables, you can consider the possibility that a table might be nested inside a cell of another table. The normal table editor should probably ignore the layout table (maybe some class name says "I'm not a real table, ignore me") as any layout properties would be set by the layout-table plugin. I guess the only real concern for your regular table plugin would be that the regular table implementation does not break if the table is inside a cell of an outer layout table. |
+1 Very well said... I totally agree that this is a different use case that requires its own implementation to work right. But then, what is the really right way to face this requirement? Have an editor where you can insert a layout table inside of it or having an application tool that handles the layout tables and then create small little editors inside such table cells, eventually even having different editors for different purposes (title, text, image, etc.). I would go with the later option. It is much more work ofc, but it makes a much more powerful solution. |
Closing in favor of https://github.com/ckeditor/ckeditor5-table/issues/1 (and issues reported in that repository). |
I reported https://github.com/ckeditor/ckeditor5-table/issues/3 to discuss functional requirements for this feature. |
I can see that people look for this ticket, so I'm reopening. I shouldn't have closed it until it's done. The entire development of this feature takes place in the http://github.com/ckeditor/ckeditor5-table repository.
|
Have you considered providing support for complex, accessible data tables? |
For now, we're going to implement the accessibility level defined in http://ckeditor.github.io/editor-recommendations/features/table.html. With time, we may add more a11y features. That would certainly be nice and we'd like to do that. But, at the same time, we will need to be realistic about the cost which may be significant because designing and implementing usable UI for such features is generally tough. And I'm curious what's the benefit. How many people will actually use such a feature? How many of them will do this correctly? How often people create such complex tables? Actually, the longer I think about this the more I'd see this as a 3rd party plugin. |
cc @Comandeer |
Those sound like advanced HTML editing features, while we must be focused on creating a text editor that produces quality content without making it too technical. It must be a well-balanced solution without going to extremes in any direction. The "summary" feature is one we could take in consideration for the future, though, similarly to what we have for the "alt" attribute in images. |
@Reinmar Since we've published Table feature as an MVP I think that this might be closed as the discussion on particular tables features & bugs would go to http://github.com/ckeditor/ckeditor5-table. Also many ideas from this ticket are already obsolete. |
We plan to bootstrap the table feature very soon, so let's do it under this ticket. I don't have any concrete information yet, so I'll just leave this ticket like this...
The text was updated successfully, but these errors were encountered: