harbs / tlf-table-work Goto Github PK
View Code? Open in Web Editor NEWTLF Table Work
TLF Table Work
I've added empty asdoc blocks where I need more comments to understand what is going on. I've marked these in the following classes:
TableElement, TextFlowTableBlock, TableBlockContainer
Calling table.removeColumnAt(0); does not remove the column.
Steps to reproduce
Expected Results
The first column is removed
Actual Results
The table column or column content is not removed
An error is thrown when using insertRow or insertColumn call and no cells are passed in.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flashx.textLayout.elements::FlowGroupElement/replaceChildren()[FlowGroupElement.as:677]
Test code:
table = new TableElement();
table.numColumns = 3;
table.insertRow(); // or insertColumn()
textFlow.addChild(table);
Click inside a table cell and hit enter and type so text.
The row height of the table does not change until some text in the main story is edited.
The main textflow should be invalidated when the cell height changes and recomposed immmediately.
Open TableTest.
Key through the main text until the cursor is as far down as it goes.
Hit Enter.
EditManager will get an error on line 389
The following returns null:
var firstLeaf:FlowLeafElement = textFlow.findLeaf(absoluteStart);
Add undo and redo operations for the table element.
When adding a Table (possibly only with background fill) after adding a paragraph with a background fill an error occurs.
TypeError: Error #1034: Type Coercion failed: cannot convert flashx.textLayout.elements::TableBlockContainer@12d84b701 to flash.text.engine.TextLine.
asrc/flashx/textLayout/elements/BackgroundManager.as:622
Expected Results
Table is added
Actual Results
An error occurs and only one row of the table is added.
Selecting the text before and then after a table should select the table.
Steps to reproduce
Expected Results
The table is selected
Actual Results
The table is not selected
TypeError: Error #1034: Type Coercion failed: cannot convert flashx.textLayout.elements::TableBlockContainer@1879abd01 to flash.text.engine.TextLine at ContainerController.as line 3048
• for each (var textLine:TextLine in _shapeChildren)
When trying to select cell content, the cursor is placed in the text above the table.
I think what's happening is that the mouse event is bubbling up to the textflow of the main text and the selection is being set twice. We need to either prevent the event from bubbling, or check the target and respond accordingly.
Currently, cell strokes are drawn within the cell bounds. If you have a cell which has a 1 pixel stroke, and the next cell also has a 1 pixel stoke, you will get a two pixel stroke between the two. This works well for strokes inside a table. The question remains, how to handle outside strokes. In that case, we need a method to draw a stroke outside the bounds of the cell.
Take a look at InDesign to see how things work there.
I currently have two ideas:
Any other ideas?
In Table Explorer there are methods to add and remove a row, column, table and more. Would you go through the code in these methods and verify that I'm creating the table, row and cells correctly?
When an EditManager is added to cells, and extra ParagraphElement is added to the beginning of the cell. I'm not sure where/why this is happening, but we need to fix this.
Error is created when all cells or row have been removed.
Steps to reproduce:
Expected Result
The last table row or cells are removed (and possibly the table is removed or it is empty)
Actual Result
An error is generated.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flashx.textLayout.elements::TableElement/composeCells()[/TableElement.as:698]
Currently cell content is not being positioned within the cell container.
The following TLF properties currently exist:
It seems to me that we should use the padding properties to pad the text content inside the cell. Here's how I envision it working:
We get the coordinates and size of the cell. cellSpacing should be able to be applied to tables/columns/rows. The cellSpacing would affect the position of the cells, but the container would be within the cellSpacing boundaries. cellPadding does not make sense to me. The four padding properties more than cover that. I think we should remove cellPadding.
The cell stroke should be measured, and the content should be inset by that value. The size of the cell should be the size INCLUDING the cell strokes, but the content needs to be inset, so the strokes do not conflict with the text.
The content should further be inset based on the padding values.
There's a design question here: Should we add 2 and 3, or should we take the greater value of 2 and 3? It looks to me that InDesign takes the greater of the two values.
Calling table.removeRowAt(0); does not remove the row.
Steps to reproduce
Expected Results
The first row is removed
Actual Results
The table row or row content is not removed
The cells are not removed from view when removing the table.
Steps to Reproduce
Expected Results
Table is removed from text flow and no longer visible
Actual Results
Table is removed from the text flow object but the visual elements are still visible
When encountering table, tr and td tags in a text flow add support to the importer to parse and add these elements.
When click-dragging to select more than one cell, the text in the original cell stays selected.
It should probably lose its selection -- although I'm not sure exactly how it should work when the cursor is then dragged back to the original cell. Should it select text, or should the whole cell remain selected?
What to do here?
Table element is throwing an error and not removed when using removeChild on textFlow.
In TableExplorer:
Expected Result
Table is removed
Actual result
Table is not removed and error is thrown.
ArgumentError: Child to remove not found
at flashx.textLayout.elements::FlowGroupElement/removeChild()[930]
Programmatic selection of cells does not appear to work. It is but the fill alpha is set to 0.
To test
Expected:
The rows or cells are selected
Actual:
It appears that nothing is changed. No selection is visible.
In ContainerController in addSelectionChild the format that is used is returning an alpha of 0. This makes the selection invisible.
Here is the change:
if (selectionSprite.alpha != curAlpha)
- selectionSprite.alpha = curAlpha;
+ selectionSprite.alpha = 1;//curAlpha; testing remove this - when set to 1 it works
Create a new table with this code:
table.numColumns = 3;
table.insertRow();
textFlow.addChild(table);
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at flashx.textLayout.elements::TableElement/insertRowAt():362
Add an API to programmatically select rows, cells and columns.
If you have a table row where one cell is higher than another, clicking on the bottom portion of the cell sends an event to the main textflow rather than the cell.
In the above image, clicking on the second cell below the first line will place the cursor in the main text. To fix this, we'd need to add logic to ContainerController to track where table content lives and adjust the events accordingly.
This is a test issue to see how it works.
We need to add logic to offset tables based on the descent of the text above.
We also need to take stroke into account.
When tab key is pressed in a text flow and manageTabKey is enabled we move the cursor to the next text flow.
Currently the cursor changes when it's near the edge of the table. When the cursor has been changed then when the user clicks the mouse the event related to the current selection cursor should be executed. For example, if the user is at the left edge of the table the cursor will change to a row selection cursor. If the user clicks or holds the mouse button down in this case the whole row should be selected. If the cursor is above the table the column should be selected.
Steps to reproduce
Expected results
The row should be selected. All the cells with rowIndex == to the row are selected.
Actual result
Nothing at this time
When the cursor is dragged outside the border of a cell, the whole cell should be selected, and when dragged to other cells, the other cells should be added to that selection.
This has a number of challenges:
How to use TLF Table with (textFlow.interactionManager as IEditManager).insertTableElement ?
Gives me the following exception: ArgumentError: NewElement not of a type that this can be parent of. TextFlow
cannot own table
There's a (silly?) assumption that one can always get a paragraph from a leaf. One such example is in SplitParagraphOperation, but there appears to be such an assumption in many places.
This does not work when it comes to tables.
The two ways I see of dealing with this are:
I do not see any obvious problems with the second approach.
Currently the cell range selections includes the run of cells from the starting one through the ending one including all columns
I think the default selection should be rectangular areas of cells.
The question is whether it makes sense to have different "selection modes" There could be "select by row", "select by column" and "select rectangle".
Thoughts?
Dragging back over fist cell does not lose the selection of the cell(s) outside the first cell.
Calling textFlow.removeChild(table) does not remove the table graphics and contents.
Steps to reproduce
Expected Results
Table and data is removed
Actual Results
Table is removed from the text flow but graphics and contents are not
When exporting a Table Cell Element, the contents of the cell are not exported. For example, a table cell with a paragraph that says "Hello world" should export the following:
<table>
<tr>
<td><p>Hello World</p></td>
</tr>
</table>
Or:
<table>
<tr>
<td><TextFlow><p>Hello World</p></TextFlow></td>
</tr>
</table>
but currently it is only exporting:
<table>
<tr>
<td />
</tr>
</table>
Steps to reproduce:
It should be showing the contents of the cell but it currently does not.
We should have unit tests or commands that we can call to easily test the table functionality. Preferably, to be able to test the following functionality.
• Adding a table
• Adding an empty row
• Adding an empty column
• Adding multiple empty rows
• Adding multiple empty columns
• Adding a row with content
• Adding a column with content
• Adding multiple rows with content
• Adding multiple columns with content
• Selecting a row
• Selecting multiple rows
• Selecting a column
• Selecting multiple columns
• Selecting a range of cells
• Finding a cell by coordinates
• Adding a cell that spans multiple rows
• Adding a cell that spans multiple columns
• Adding a cell that spans multiple rows and columns
• Joining cells that span multiple rows or columns
• Adding a border to a cell
• Removing a border from a cell
• Checking the top left right and bottom border on a cell
• Checking the export as valid
• Checking the import of the exported value as valid
• Checking Table border add and remove
• More?
I think someone committed FlexUnit for TLF recently. We could use this eventually.
The code for changing the cursor when around the edge of the table has been added but it is inconsistent. It appears sometimes when moving the mouse down but not up or the other way around. It seems the mouse move and mouse over events may not be dispatched consistently. I've added trace statements to both and mouse move does not seem to fire every mouse move (maybe because I'm canceling some mouse events) but mouse move is inconsistent as well. It may also be that the setMouseCursor is being called from another place and that is changing the cursor back to an ibeam.
Steps to reproduce
Expect result
The cursor to remain one of the 3 selection cursors
Actual results
The cursor is inconsistent. It works sometimes or when the mouse enters from a certain direction such as top to bottom but not the other way around.
Currently, the only way to select cell ranges is to click and shift click on another cell. Dragging outside the bounds of a cell should select the range of cells in the drag rectangle.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.