Skip to main content
casper_no
Known Participant
December 22, 2010
Question

Paste with empty clipboard inserts "null"

  • December 22, 2010
  • 1 reply
  • 1064 views

Flex 4.1

To reproduce :

Place cursor in textFlow, select nothing.

Copy

Paste

The text "null" is inserted instead of the expected "" empty string.

I've created a workaround, we can listen for paste events and manipulate the pasted content.

myTextFlow.addEventListener(FlowOperationEvent.FLOW_OPERATION_BEGIN, handleFlowEvents);

...

private function handleFlowEvents(e:FlowOperationEvent):void {

     if (e.operation is PasteOperation) {

trapPaste(e.operation as PasteOperation);

}

}

private function trapPaste(po:PasteOperation):void {

var pasteTxtflow:TextFlow = po.textScrap.textFlow

pasteTxtflow.interactionManager = new EditManager();

if (pasteTxtflow.mxmlChildren.length == 1 && pasteTxtflow.getFirstLeaf().text == "null" && pasteTxtflow.getFirstLeaf() is SpanElement) {

(pasteTxtflow.getFirstLeaf() as SpanElement).text = "";

return;

}

}

This topic has been closed for replies.

1 reply

Adobe Employee
December 22, 2010

I'm not able to reproduce this on the latest TLF 2.0. Can you tell me what version of TLF you are using, and what you are doing to trigger the copy & paste? It looks to me like the PasteOperation does nothing to cvhange the TextFlow if the scrap is null, although it still does send the FlowOperationEvents.

Thanks,

- robin

Adobe Employee
December 22, 2010

Are you doing this from a browser or an AIR app? Can you also tell me what platform, and what browser version?

Thanks,

- robin