flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frédéric THOMAS (JIRA) <j...@apache.org>
Subject [jira] [Resolved] (FLEX-34592) Can't use optionnal importer for TLF plainTextFormat and TextLayoutFormat
Date Sat, 18 Oct 2014 14:04:33 GMT

     [ https://issues.apache.org/jira/browse/FLEX-34592?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Frédéric THOMAS resolved FLEX-34592.
------------------------------------
    Resolution: Fixed

> Can't use optionnal importer for TLF plainTextFormat and TextLayoutFormat
> -------------------------------------------------------------------------
>
>                 Key: FLEX-34592
>                 URL: https://issues.apache.org/jira/browse/FLEX-34592
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: .Unspecified - Framework
>    Affects Versions: Apache Flex 4.13.0
>            Reporter: dimitri kara
>            Assignee: Frédéric THOMAS
>            Priority: Minor
>              Labels: importer, tlf
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When you add importer to the TextConverter class, you should be able to let the importer
decline the conversion by having its importToFlow method returning null (as it is stated in
the TLF blogpost http://blogs.adobe.com/tlf/2010/11/custom-clipboard-formats.htm ).
> It works for all format except plainTextFormat and textLayoutFormat because of these
lines in flashx.textLayout.edit.TextClipboard, method importToScrap #170:
> {quote}
> var textFlow:TextFlow = importer.importToFlow(textOnClipboard);
> 				*if (textFlow)*
> 					textScrap = new TextScrap(textFlow); 				
> 				
> 				if (format == TextConverter.PLAIN_TEXT_FORMAT)
> 					*textScrap.setPlainText(true);* 
> 				else if (format == TextConverter.TEXT_LAYOUT_FORMAT)
> 					*textScrap.setPlainText(false);*
> {quote}
> If the importer return null, textFlow==null, so textScrap==null and textScrap.setPlainText(...)
cause a null object error.
> The solution is trivial. This method should not assume these formats will always have
the importer return a non-null textFlow, and should test either the existence of the textFlow
or the existence of the textScrap. The correct code would be:
> {quote}
> var textFlow:TextFlow = importer.importToFlow(textOnClipboard);
> 				if (textFlow)
> 					textScrap = new TextScrap(textFlow);
> 				
> 			
> 				if (format == TextConverter.PLAIN_TEXT_FORMAT *&& textScrap*)
> 					textScrap.setPlainText(true);
> 				else if (format == TextConverter.TEXT_LAYOUT_FORMAT  *&& textScrap*)
> 					textScrap.setPlainText(false);
> {quote}
> This bug prevent me from having some converter that check for patterns in a plain text
from clipboard and chose to handle the conversion if the patterns are found.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message