[
https://issues.apache.org/jira/browse/FLEX-33278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13712787#comment-13712787
]
Vitali Kabak commented on FLEX-33278:
-------------------------------------
Update:
The code I provided above as a solution will not solve this problem. It turned
that the issue is much more complicated and most likely will appear only on
Windows.
When you paste a text like (no quotes):
"F
S"
into app, running in Flash Player, it will internally convert it to "F\nS" in
SystemClipboard
When you paste the same text into AIR app, it will internally convert it to
"F\r\nS" in SystemClipboard
When clipboard content is imported into textFlow by
PlainTextImporter.importFromString method (this is what happens, when you press
Ctrl+V), it will be processed differently at lines:
// Mark partial last paragraph (string doesn't end in
paragraph terminator)
if (useClipboardAnnotations &&
(source.lastIndexOf('\u000A', source.length -
2) < 0 ||
source.lastIndexOf('\u000D\u000A',
source.length - 3) < 0))
{
var lastLeaf:FlowLeafElement =
textFlow.getLastLeaf();
lastLeaf.setStyle(ConverterBase.MERGE_TO_NEXT_ON_PASTE, "true");
lastLeaf.parent.setStyle(ConverterBase.MERGE_TO_NEXT_ON_PASTE, "true");
textFlow.setStyle(ConverterBase.MERGE_TO_NEXT_ON_PASTE, "true");
}
Later this difference causes a creation of additional empty ParagraphElement in
textFlow, which in case causes problems with maxChars and display of multiple
lines in a single line TextInput.
For Justin Mclean: I don't think, that a fix for FLEX-33544 will solve this
problem - at handlePasteOperation it is too late to fix the issue with extra
empty ParagraphElement in textFlow.
For my project I added the following lines to the constructor of the AIR app
class :
TextConverter.removeFormat(TextConverter.PLAIN_TEXT_FORMAT);
TextConverter.addFormat(TextConverter.PLAIN_TEXT_FORMAT, PlainTextImporter,
PlainTextExporter, "air:text");
where PlainTextImporter is a slightly modified class from TLF framework. I just
added the following line to the very beginning of
PlainTextImporter.importFromString method:
source = source.split("\u000D\u000A").join("\u000A");
> Ctrl+V doesn't work properly
> ----------------------------
>
> Key: FLEX-33278
> URL: https://issues.apache.org/jira/browse/FLEX-33278
> Project: Apache Flex
> Issue Type: Bug
> Components: Spark: RichEditableText
> Affects Versions: Adobe Flex SDK Previous, Apache Flex 4.8 (parity release)
> Environment: Windows 7
> Reporter: Nazar Yavny
>
> The issue is present when user tries to paste text that starts with new line.
> When maxChars variable is specified and user tries to paste with Ctrl+V text
> bigger than maxChars - component will cut of extra chars, but when user
> presses Ctrl+V one more time - text will be pasted again. So, in this
> situation length of component's inner text will be greater than specified
> maxChars variable.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira