Repository: flex-tlf Updated Branches: refs/heads/develop 601f0977e -> 095a165a5
Better handling of nested table composition (related to operations) Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/095a165a Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/095a165a Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/095a165a Branch: refs/heads/develop Commit: 095a165a5ccfcc19d0c8b3b102cdcabc02290783 Parents: 601f097 Author: Harbs <[email protected]> Authored: Mon Dec 28 11:51:49 2015 +0200 Committer: Harbs <[email protected]> Committed: Mon Dec 28 11:51:49 2015 +0200 ---------------------------------------------------------------------- .../src/flashx/textLayout/edit/EditManager.as | 5 +++++ .../flashx/textLayout/edit/SelectionManager.as | 23 +++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/095a165a/textLayout/src/flashx/textLayout/edit/EditManager.as ---------------------------------------------------------------------- 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 @@ package flashx.textLayout.edit // 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 @@ package flashx.textLayout.edit 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 */ http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/095a165a/textLayout/src/flashx/textLayout/edit/SelectionManager.as ---------------------------------------------------------------------- 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 @@ package flashx.textLayout.edit { 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 @@ package flashx.textLayout.edit activePosition = -1; } else if(subManager) + { + subManager.flushPendingOperations(); subManager = null; + } var lastSelectablePos:int = (_textFlow.textLength > 0) ? _textFlow.textLength - 1 : 0; @@ -1966,6 +1983,8 @@ package flashx.textLayout.edit 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 @@ package flashx.textLayout.edit } public function set subManager(value:ISelectionManager):void { + if(value == _subManager) + return; if(_subManager) _subManager.selectRange(-1,-1); _subManager = value;
