You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ha...@apache.org on 2015/09/20 09:49:15 UTC
git commit: [flex-tlf] [refs/heads/develop] - FLEX-34807 Fixed the
case where it's not he last paragrpah
Repository: flex-tlf
Updated Branches:
refs/heads/develop 96a959d1b -> 219260876
FLEX-34807
Fixed the case where it's not he last paragrpah
Project: http://git-wip-us.apache.org/repos/asf/flex-tlf/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-tlf/commit/21926087
Tree: http://git-wip-us.apache.org/repos/asf/flex-tlf/tree/21926087
Diff: http://git-wip-us.apache.org/repos/asf/flex-tlf/diff/21926087
Branch: refs/heads/develop
Commit: 219260876588016c5086765850aaf88839254c68
Parents: 96a959d
Author: Harbs <ha...@in-tools.com>
Authored: Sun Sep 20 10:49:10 2015 +0300
Committer: Harbs <ha...@in-tools.com>
Committed: Sun Sep 20 10:49:10 2015 +0300
----------------------------------------------------------------------
textLayout/src/flashx/textLayout/edit/TextFlowEdit.as | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-tlf/blob/21926087/textLayout/src/flashx/textLayout/edit/TextFlowEdit.as
----------------------------------------------------------------------
diff --git a/textLayout/src/flashx/textLayout/edit/TextFlowEdit.as b/textLayout/src/flashx/textLayout/edit/TextFlowEdit.as
index 0fc41fb..6a0a561 100644
--- a/textLayout/src/flashx/textLayout/edit/TextFlowEdit.as
+++ b/textLayout/src/flashx/textLayout/edit/TextFlowEdit.as
@@ -239,12 +239,12 @@ package flashx.textLayout.edit
{
removePasteAttributes(scrapLeaf);
var scrapElement:FlowElement = scrapLeaf; // highest level complete element in the scrap
+ var scrapParagraph:ParagraphElement = scrapLeaf.getParagraph();
// On the first paragraph, it always merges in to the destination paragraph if the destination paragraph has content
var destinationParagraph:ParagraphElement = destinationLeaf ? destinationLeaf.getParagraph() : destinationParagraph;
if (firstParagraph && (destinationParagraph.textLength > 1 || applyFormat))
{
- var scrapParagraph:ParagraphElement = scrapLeaf.getParagraph();
if (!scrapParagraph.format || scrapParagraph.format.getStyle(ConverterBase.MERGE_TO_NEXT_ON_PASTE) === undefined)
doSplit = true;
scrapElement = scrapParagraph.getChildAt(0);
@@ -323,7 +323,19 @@ package flashx.textLayout.edit
insertPosition = destinationLeaf ? destinationLeaf.getAbsoluteStart() : textFlow.textLength - 1;
scrapLeaf = scrapFlow.getFirstLeaf();
+ // check to make sure we're inserting into the right paragraph
+ if(destinationLeaf && scrapLeaf && scrapLeaf.getParagraph() == scrapParagraph)
+ {
+ if(destinationLeaf.getParagraph() != destinationParagraph)
+ {
+ insertPosition--;
+ destinationLeaf = null;
+ }
+ }
}
+ // keep the cursor in the same paragraph unless a whole paragraph was inserted
+ if(scrapParagraph.getStyle(ConverterBase.MERGE_TO_NEXT_ON_PASTE) == "true" && insertPosition == destinationParagraph.getAbsoluteStart() + destinationParagraph.textLength)
+ insertPosition--;
return insertPosition;
}