[ 
https://issues.apache.org/jira/browse/FLEX-34013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13970370#comment-13970370
 ] 

Justin Mclean commented on FLEX-34013:
--------------------------------------

Thanks for the code to reproduce the issue.

The issues is related to this code:

                    // If copied/cut from displayAsPassword field the pastedText
                    // is '*' characters but this is correct.
                    var pastedText:String = staticPlainTextExporter.export(
                        po.textScrap.textFlow, ConversionType.STRING_TYPE) as 
String;
                    
                    // If there are no newlines there is nothing
                    // more to do.
                    if (pastedText.search(ALL_NEWLINES_REGEXP) != -1)
                    {
                        pastedText = pastedText.replace(ALL_NEWLINES_REGEXP, 
"");
                        po.textScrap = 
                            TextClipboard.importToScrap(pastedText, 
po.textScrap.isPlainText() ?
                                TextConverter.PLAIN_TEXT_FORMAT : 
TextConverter.TEXT_LAYOUT_FORMAT);
                    }

i.e. calling importToScap a second time when pasting text that contains a new 
line

In the second import it calls importToFlow which calls importFromString and 
then importFromXML:

                protected function importFromXML(xmlSource:XML):TextFlow
                        // Parse an XFL hierarchy into a TextFlow, using the 
geometry supplied by a TextFrame
                        // to host child containers (e.g. tables). This is the 
main entry point into this class.
                {
                        return parseContent(xmlSource[0]);
                }

In the second case xmlSource does't have any children and xmlSource[0] does't 
exist so importFromXML returns null causing the RTE.

I'm not 100% what the best solution to solve this issue is however.



> RTE at TextClipboard#importToScrap()
> ------------------------------------
>
>                 Key: FLEX-34013
>                 URL: https://issues.apache.org/jira/browse/FLEX-34013
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Spark: RichEditableText
>    Affects Versions: Apache Flex 4.11.0
>         Environment: Windows 7
>            Reporter: Shigeru Nakagaki
>              Labels: easytest
>         Attachments: TextScrap.fxp
>
>
> This problem should be related with FLEX-33988.
> However,  I guess this is not same problem exactly.
> I can not reproduce this RTE. But it's happened.
> thanks
>  TypeError: Error #1009
>       at 
> flashx.textLayout.edit::TextClipboard$/http://ns.adobe.com/textLayout/internal/2008::importToScrap()
>       at 
> spark.components::RichEditableText/textContainerManager_flowOperationBeginHandler()
>       at flash.events::EventDispatcher/dispatchEvent()
>       at flashx.textLayout.container::TextContainerManager/dispatchEvent()
>       at flash.events::EventDispatcher/dispatchEvent()
>       at flashx.textLayout.elements::TextFlow/dispatchEvent()
>       at flashx.textLayout.edit::EditManager/doInternal()
>       at flashx.textLayout.edit::EditManager/doOperation()
>       at flashx.textLayout.edit::EditManager/pasteTextScrap()
>       at flashx.textLayout.edit::EditManager/editHandler()
>       at flashx.textLayout.container::ContainerController/editHandler()
>       at flashx.textLayout.container::TextContainerManager/editHandler()
>       at flash.desktop::NativeApplication/_onKeyDownBubble()



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to