fix(editor): a read-only table's rows fit their cells
A table keeps each row's height on its cells and corrects it after layout through a transaction, which a read-only editor never applies: in a path step, a note or a card, a cell of several lines (る, う, つ in Tae Kim's conjugation tables) ran over its row's borders. Our fork of the editor now sizes the rows of a read-only table in place, as it already did the table's height (81c3006c on halkyon/win32-v6; upstream's main has the same code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
7d99feca7f
commit
192291d35a
2 changed files with 44 additions and 4 deletions
|
|
@ -29,7 +29,7 @@ dependencies:
|
|||
appflowy_editor:
|
||||
git:
|
||||
url: https://code.halkyon.app/project-halkyon/appflowy-editor.git
|
||||
ref: 83bdb2a3e66881eff9b2f8afe416b57fc791daf9
|
||||
ref: 81c3006c74e789ed2e470b8612529541b358fd26
|
||||
# Anki packages are zip files.
|
||||
archive: ^4.0.7
|
||||
# Sounds in content (pronunciations): one package for all five platforms; on
|
||||
|
|
|
|||
|
|
@ -92,6 +92,46 @@ void main() {
|
|||
}
|
||||
});
|
||||
|
||||
testWidgets('a row holding a cell of several lines grows to fit it, read '
|
||||
'only as in the editor', (tester) async {
|
||||
Map<String, Object?> cell(int row, String text) => {
|
||||
'type': 'table/cell',
|
||||
'data': {'colPosition': 0, 'rowPosition': row},
|
||||
'children': [
|
||||
{
|
||||
'type': 'paragraph',
|
||||
'data': {
|
||||
'delta': [
|
||||
{'insert': text},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
await show(
|
||||
tester,
|
||||
RichContent({
|
||||
'document': {
|
||||
'type': 'page',
|
||||
'children': [
|
||||
{
|
||||
'type': 'table',
|
||||
'data': {'colsLen': 1, 'rowsLen': 2},
|
||||
'children': [cell(0, 'る\nう\nつ'), cell(1, 'す')],
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
final cells = find.byType(TableCelBlockWidget);
|
||||
expect(
|
||||
tester.getSize(cells.at(0)).height,
|
||||
greaterThan(2 * tester.getSize(cells.at(1)).height),
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('shows the content', (tester) async {
|
||||
await show(tester, paragraph('猫は動物です。'));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue