Shigeru Nakagaki created FLEX-34407:
---------------------------------------

             Summary: a bug of TextClipboard#importToScrap()
                 Key: FLEX-34407
                 URL: https://issues.apache.org/jira/browse/FLEX-34407
             Project: Apache Flex
          Issue Type: Bug
    Affects Versions: Apache Flex 4.11.0
         Environment: Windows 7 64bit Japanese, AIR 14, Apache Flex SDK 4.11.0
            Reporter: Shigeru Nakagaki


We got an exception at TextClipboard#importToScrap() but I can not reproduce.

 TypeError: Error #1009
        at 
flashx.textLayout.edit::TextClipboard$/http://ns.adobe.com/textLayout/internal/2008::importToScrap()
        at 
flashx.textLayout.edit::TextClipboard$/http://ns.adobe.com/textLayout/internal/2008::importScrap()
        at flashx.textLayout.edit::TextClipboard$/getContents()
        at flashx.textLayout.edit::EditManager/editHandler()
        at flashx.textLayout.container::ContainerController/editHandler()
        at flashx.textLayout.container::TextContainerManager/editHandler()
        at flash.desktop::NativeApplication/_onKeyDownBubble()


So I looked into the code and I guess I found a wrong logic.

Here is the code of TextClipboard#importToScrap().

/*---------+---------+---------+---------+---------+---------+---------+*/
var textFlow:TextFlow = importer.importToFlow(textOnClipboard);
if (textFlow)
        textScrap = new TextScrap(textFlow);

/** Hint to the scrap about whether text is plain or formatted. If not set, 
scrap will inspect text for attributes. */
if (format == TextConverter.PLAIN_TEXT_FORMAT)
        textScrap.setPlainText(true);
else if (format == TextConverter.TEXT_LAYOUT_FORMAT)
        textScrap.setPlainText(false);

// Backwards compatibility: check for older scrap format
if (!textScrap && format == TextConverter.TEXT_LAYOUT_FORMAT)
        textScrap = importOldTextLayoutFormatToScrap(textOnClipboard);
/*---------+---------+---------+---------+---------+---------+---------+*/

The block of "Backwards compatibility: check for older scrap format" should be 
above the block of "if (format == TextConverter.PLAIN_TEXT_FORMAT)", right?

thanks




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

Reply via email to