Code Monkey home page Code Monkey logo

tlf-table-work's People

Contributors

harbs avatar velara3 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

tlf-table-work's Issues

Comments requested on the following classes

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

Remove column method does not remove the column

Calling table.removeColumnAt(0); does not remove the column.

Steps to reproduce

  1. In Table Explorer click Add Table
  2. Click Remove Column

Expected Results
The first column is removed

Actual Results
The table column or column content is not removed

Error is thrown when attempting to use insertRow or insertColumn

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);

Cell height change does not trigger table recomposition

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.

findLeaf() does not work on tables

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);

Error when adding a Table after adding a paragraph

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.

Table is not selected when selecting text in the text flow

Selecting the text before and then after a table should select the table.

Steps to reproduce

  1. In Table Explorer type in some text
  2. Click Add Table
  3. Right click and select Select All

Expected Results
The table is selected

Actual Results
The table is not selected

Error when attempting to clear the composition results

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)

SelectionManager is not selecting cell contents

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.

cell stroke tweaking

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:

  1. To figure out if a specific stroke is an external one, and draw it halfway outside the bounds if yes.
  2. To add an "externalStrokeWidth" property which would be drawn if the stroke is an outside border of the table.

Any other ideas?

Verify the code in Table Explorer

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?

Extra ParagraphElement being added to cells

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 when removing all cells from the table

Error is created when all cells or row have been removed.

Steps to reproduce:

  1. Click Add Table
  2. Click Remove row until the last row is removed.

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]

Content position within cells

Currently cell content is not being positioned within the cell container.

The following TLF properties currently exist:

  1. cellPadding
  2. cellSpacing
  3. paddingTop/Bottom/Left/Right

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:

  1. 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.

  2. 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.

  3. 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.

Table row is not removed when calling remove row

Calling table.removeRowAt(0); does not remove the row.

Steps to reproduce

  1. In Table Explorer click Add Table
  2. Click Remove Row

Expected Results
The first row is removed

Actual Results
The table row or row content is not removed

Table cells are not removed from view when removing the table

The cells are not removed from view when removing the table.

Steps to Reproduce

  1. Click Add Table
  2. Click Remove Table

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

Click-drag selecting cells does not deselect text in first cell

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 throws error when removed

Table element is throwing an error and not removed when using removeChild on textFlow.

In TableExplorer:

  1. Click Add Table
  2. Click Remove Table

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]

Selection does not work unless alpha is manually set to 1

Programmatic selection of cells does not appear to work. It is but the fill alpha is set to 0.

To test

  1. Comment out the change in ContainerController (see code below) and recompile.
  2. In TableExplorer click Add Editable Table
  3. Click the select rows or select cells

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

Calling insertRow without cells throws error

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

Clicking on table cells that extend below the content

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.
screenshot

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.

Just a test

This is a test issue to see how it works.

Call selection of row, column or table when on edges of the table

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

  1. Open Table Explorer
  2. Click Add Editable Table
  3. Position mouse to the left of the table about the middle row
  4. The mouse cursor should change to a horizontal arrow (currently there is a related bug where the mouse cursor doesn't always change)
  5. Click or hold down the mouse

Expected results
The row should be selected. All the cells with rowIndex == to the row are selected.

Actual result
Nothing at this time

Selection of cells need to be handled

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:

  1. We need to track cell selection across cells.
  2. SelectionState currently assumes index based selections within a textflow and it assumes selections to be contiguous. Cell selections are a different beast. Even if we were to give cells an index within the table and textflow, selecting vertical cells would not fit within the SelectionState model. I'm not sure of the best way to handle this.
  3. We need to get the coordinates of the cell for drawing the selection rect. To do this, we need to be able to get a reference to the TextFlowTableBlock from the mouse event target (CellContainer).

insertTableElement method

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

getParagraph() does not work on tables

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:

  1. Change that assumption in lots of places. (daunting job)
  2. Require TableElement to be a child of ParagraphElement. This would allow returning the parent paragraph of the table.

I do not see any obvious problems with the second approach.

Cell Range Question

Currently the cell range selections includes the run of cells from the starting one through the ending one including all columns
screenshot
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?

Table contents are not removed when calling remove child

Calling textFlow.removeChild(table) does not remove the table graphics and contents.

Steps to reproduce

  1. In Table Explorer click Add Table
  2. Click Remove Table

Expected Results
Table and data is removed

Actual Results
Table is removed from the text flow but graphics and contents are not

Table Cell Element is not currently exporting the contents on export

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:

  1. Open Table Explorer
  2. Click Add Editable Table
  3. Type content into the first cell
  4. Check the Text Flow output text area

It should be showing the contents of the cell but it currently does not.

Create unit tests or test methods for testing table functionality

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.

Selection cursor does not appear consistently when around edge of table

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

  1. Open TableExplorer
  2. Click Add Editable table
  3. Move the mouse around the left and top edges of the table
  4. Move the mouse from top to bottom and bottom to top on the left and top edges

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.

Select cell ranges via click/drag

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.