Better handling of nested table composition (related to operations)
diff --git a/textLayout/src/flashx/textLayout/edit/EditManager.as b/textLayout/src/flashx/textLayout/edit/EditManager.as
index ba04a61..0eaafeb 100644
--- a/textLayout/src/flashx/textLayout/edit/EditManager.as
+++ b/textLayout/src/flashx/textLayout/edit/EditManager.as
@@ -480,6 +480,7 @@
// select next cell in table
if (cell && cell.textFlow && cell.textFlow.interactionManager is EditManager) {
//cell.textFlow.interactionManager.selectLastPosition();
+ deselect();
cell.textFlow.interactionManager.selectAll();
cell.textFlow.interactionManager.setFocus();
}
@@ -533,6 +534,10 @@
overwriteMode ? overwriteText(event.text) : insertText(event.text);
}
ignoreNextTextEvent = false;
+ // if the manager is nested inside another one, do not handle it again in the outer one
+ if(superManager)
+ event.preventDefault();
+
}
/** @private */
diff --git a/textLayout/src/flashx/textLayout/edit/SelectionManager.as b/textLayout/src/flashx/textLayout/edit/SelectionManager.as
index 4c59fa4..6415776 100644
--- a/textLayout/src/flashx/textLayout/edit/SelectionManager.as
+++ b/textLayout/src/flashx/textLayout/edit/SelectionManager.as
@@ -1065,8 +1065,22 @@
{
flushPendingOperations();
- if(subManager)
+ if(subManager && (anchorPosition != -1 || activePosition != -1))
+ {
subManager.selectRange(-1,-1);
+ subManager = null;
+ }
+ if(textFlow.nestedInTable())
+ {
+ var cell:TableCellElement = textFlow.parentElement as TableCellElement;
+ superManager = cell.getTextFlow().interactionManager;
+ superManager.currentTable = cell.getTable();
+ superManager.deselect();
+ superManager.anchorCellPosition.column = cell.colIndex;
+ superManager.anchorCellPosition.row = cell.rowIndex;
+ superManager.subManager = this;
+ }
+
// anchor and active can be in any order
// TODO: range check and clamp anchor,active
@@ -1145,7 +1159,10 @@
activePosition = -1;
}
else if(subManager)
+ {
+ subManager.flushPendingOperations();
subManager = null;
+ }
var lastSelectablePos:int = (_textFlow.textLength > 0) ? _textFlow.textLength - 1 : 0;
@@ -1966,6 +1983,8 @@
superManager = cell.getTextFlow().interactionManager;
if(event.shiftKey && cell.getTable() == superManager.currentTable)
{
+ flushPendingOperations();
+
// expand cell selection if applicable
coords = new CellCoordinates(cell.rowIndex,cell.colIndex);
if(
@@ -2906,6 +2925,8 @@
}
public function set subManager(value:ISelectionManager):void
{
+ if(value == _subManager)
+ return;
if(_subManager)
_subManager.selectRange(-1,-1);
_subManager = value;