-
-
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
Use triggerBy
conversion for table
#8138
Comments
Problem statementWhat should be reconverted by the main downcast converter? Model -> View
<table headingRows=0> -> <figure>
<!- other stuff like UI ->
<table>
<thead>
<tableRow> -> <tr>
<tableCell> -> <td>
<paragraph>Foo</paragraph> -> <p>Foo</p>
</tableCell> </td>
</tableRow> </tr>
</thead>
<tbody>
<tableRow> -> <tr>
<tableCell> -> <td>
<paragraph>Bar</paragraph> -> <p>Bar</p>
</tableCell> </td>
</tableRow> </tr>
</tbody>
</table>
</table> </figure> The table model -> view mapping is troublesome because:
Options: What should be converted by the
|
Option 1 is basically too hard to pursue IMO. I'm torn between 2 & 3. Option 2: Can have a probably simpler Option 3: Handles |
The main part will be handled in #1589 as we need to enhance API for it as well. |
I've started to digging up in here. I've noticed one problem with the implementation from the #8099 PR. The consumed items handled by reconvert (it would also do insert/attribute conversion) are not passed to other handlers. This is because we clear conversion API after every I tried to filter out changes if item was inside already reconverted but this was a no-go. We can't predict which items will be reconverted and which should fire event. |
Possible blocker: Partial support for In table downcast there's a custom remove row downcast converter. It does cause problems with reconversion as it removes the wrong row. There's no need to remove it as table reconversion would create a new structure. Maybe its implementation is not needed as its tasks (ensuring any empty |
At this moment it looks that implementing "Differ#getChanges() could return items for remove entries" should do the trick. The problem here is that the default |
Since the above problems with reconversion trigger only on heading rows is problematic I've tested the following setup: conversion.for( 'editingDowncast' ).elementToElement( {
model: 'table',
view: downcastInsertTable( { asWidget: true } ),
triggerBy: {
attributes: [ 'headingRows' ],
children: [ 'tableRow' ]
}
} ); So reconverting always on added / removed row. Findings:
Ad 3. I've tested it using 43 rows x 15 columns table (sorry for odd numbers):
|
And the case for reconverting a whole table on any child change ( conversion.for( 'editingDowncast' ).elementToElement( {
model: 'table',
view: downcastInsertTable( { asWidget: true } ),
triggerBy: {
attributes: [ 'headingRows' ],
children: [ 'tableRow', 'tableCell' ]
}
} ); The code got a bit tangled again, but almost all atomic converters were removed, but:
Performance (compare with the above comment)
|
After F2F talk with @Reinmar we concluded that going with option "Reconvert table with table rows" option is the way to go for now. It is OK to rename table cell's in the view - check |
DUP #10502 |
📝 Provide a description of the improvement
Follow up of the #8099 & #7956 .
During the work on #7956 I had troubles with using
differ.refreshItem()
ortriggerBy
converter option to simplify table re-converions on big structural changes.In order to implement this I think that we need three-way-binding (or layered binding) in conversion. More info can be found here: #7956 (comment).
If you'd like to see this improvement implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: