You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Harbs <ha...@gmail.com> on 2013/11/03 09:13:54 UTC

Copy/Paste in TLF

Looking into an issue I had, I noticed that user styles in TLF are not preserved on copy/paste. (Actually, it would probably be more correct to say that they're not preserved on copy.)

I'm looking into TextScrap/TextClipboard now, but if anyone has experience here as to why the styles are being dropped, I'd love to know…

Harbs

Re: Copy/Paste in TLF

Posted by Cosma Colanicchia <co...@gmail.com>.
In a similar situation, I handled cut/copy/paste text operation events and
put data in clipboard using a custom clipboard format... You may also try
to subclass the editmanager to have it use a custom exporter..
Il 04/nov/2013 06:21 "Alex Harui" <ah...@adobe.com> ha scritto:

> I'm not sure what user styles are and why the aren't in the markup.  Can
> you provide more details?
>
> Consider whether this is a general TLF issue or just something you should
> do in your app to add functionality.  A general TLF issue probably can't
> bypass the Clipboard because you should be able to copy/paste from one SWF
> to another SWF.
>
> -Alex
>
> On 11/3/13 1:01 PM, "Gavriel Harbater" <ga...@gmail.com> wrote:
>
> >Okay. After researching this, it looks like the problem is as follows:
> >
> >The TextFlow is saved to the clipboard as a string which is the markup
> >representation of the TextFlow. The markup is produced using
> >BaseTextLayoutExporter.export(). The markup produced from that is missing
> >custom user styles. My custom user styles are actually quite complex
> >classes.
> >
> >I'm looking for suggestions on the best way to handle this problem. I can
> >think of three possible angles:
> >1) Somehow write user styles into the TextFlow markup. I'm not sure if
> >there's a way to markup custom styles and complex ones are definitely an
> >issue.
> >2) Write complex objects to the clipboard. Is this possible? If yes, why
> >are strings currently used?
> >3) Skip the clipboard altogether and create some static function to call
> >when the clipboard content is pasted to apply custom styles.
> >
> >Thoughts?
> >
> >On Nov 3, 2013, at 10:13 AM, Harbs wrote:
> >
> >> Looking into an issue I had, I noticed that user styles in TLF are not
> >>preserved on copy/paste. (Actually, it would probably be more correct to
> >>say that they're not preserved on copy.)
> >>
> >> I'm looking into TextScrap/TextClipboard now, but if anyone has
> >>experience here as to why the styles are being dropped, I'd love to knowŠ
> >>
> >> Harbs
> >
>
>

Re: Copy/Paste in TLF

Posted by jude <fl...@gmail.com>.
Is it an AIR app or browser? What

1. Where are you pasting it into? If you're pasting into another location
in the same document then I would override and update the export method to
include your custom styles. How are the styles complex? They should be
inherited or if it's actual styles and classes it may be a bug if they
aren't being included.

2. You can set different
formats<http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/Clipboard.html>to
the clipboard. It might be a roundable way of keeping the format of
converting by exporting to HTML on copy and importing the HTML on paste. I
wouldn't be surprised if there is a undocumented TLF_Format type.

3. See 2.

Can you paste the actual TLF markup and the TLF markup that is copied to
the clipboard for comparison?




On Sun, Nov 3, 2013 at 3:01 PM, Gavriel Harbater <ga...@gmail.com> wrote:

> Okay. After researching this, it looks like the problem is as follows:
>
> The TextFlow is saved to the clipboard as a string which is the markup
> representation of the TextFlow. The markup is produced using
> BaseTextLayoutExporter.export(). The markup produced from that is missing
> custom user styles. My custom user styles are actually quite complex
> classes.
>
> I'm looking for suggestions on the best way to handle this problem. I can
> think of three possible angles:
> 1) Somehow write user styles into the TextFlow markup. I'm not sure if
> there's a way to markup custom styles and complex ones are definitely an
> issue.
> 2) Write complex objects to the clipboard. Is this possible? If yes, why
> are strings currently used?
> 3) Skip the clipboard altogether and create some static function to call
> when the clipboard content is pasted to apply custom styles.
>
> Thoughts?
>
> On Nov 3, 2013, at 10:13 AM, Harbs wrote:
>
> > Looking into an issue I had, I noticed that user styles in TLF are not
> preserved on copy/paste. (Actually, it would probably be more correct to
> say that they're not preserved on copy.)
> >
> > I'm looking into TextScrap/TextClipboard now, but if anyone has
> experience here as to why the styles are being dropped, I'd love to know…
> >
> > Harbs
>
>

Re: Copy/Paste in TLF

Posted by Cosma Colanicchia <co...@gmail.com>.
It does work this way, yes. I also remember that there was no easy way to
extend the default exporter and/or to use this custom exporter for a text
component instances, due to the complex class hierarchy and to missing
properties to directly control this, but it could have been improved since
I looked into it.


2013/11/4 Alex Harui <ah...@adobe.com>

> So is it as simple as serializing non-strings to text and de-serializing
> on import?
>
>
> On 11/3/13 11:12 PM, "Harbs" <ha...@gmail.com> wrote:
>
> >Here is a simple test case which illustrates the problem. I can change my
> >app for custom handling of copy/paste, but it seems to me that this is a
> >general short-coming in the was copy paste is handled in TLF.
> >
> >Note: customStyle1 is preserved when the TextFlow is exported because
> >it's simple text, but customStyle2 is not preserved.
> >
> >The result of TextFlowExporter.export() is what's written to the
> >clipboard, so it's missing any complex custom styles.
> >
> ><?xml version="1.0" encoding="utf-8"?>
> ><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
> >                          xmlns:s="library://ns.adobe.com/flex/spark"
> >                          xmlns:mx="library://ns.adobe.com/flex/mx"
> minWidth="955"
> >minHeight="600" creationComplete="onComplete()">
> >       <fx:Script>
> >               <![CDATA[
> >                       import flashx.textLayout.conversion.ITextExporter;
> >                       import flashx.textLayout.conversion.TextConverter;
> >                       import flashx.textLayout.edit.EditManager;
> >                       import flashx.textLayout.elements.ParagraphElement;
> >                       import flashx.textLayout.elements.SpanElement;
> >                       import flashx.textLayout.elements.TextFlow;
> >                       import flashx.undo.UndoManager;
> >                       [Bindable]private var textFlow:TextFlow;
> >
> >                       private function onComplete():void{
> >                               var para:ParagraphElement;
> >                               var span:SpanElement;
> >                               var i:int;
> >                               textFlow =  new TextFlow();
> >                               textFlow.interactionManager = new
> EditManager(new UndoManager());
> >                               textFlow.tabStops = "s12 s72";
> >                               textFlow.paragraphSpaceAfter = 16;
> >                               para = new ParagraphElement();
> >                               span = new SpanElement();
> >                               span.fontSize = 16;
> >                               span.fontWeight = "bold";
> >                               span.text = "Here's some text.";
> >                               span.setStyle("customStyle1","hello");
> >
> span.setStyle("customStyle2",{id:1,content:"this is some custom
> >content"});
> >                               para.addChild(span);
> >                               textFlow.addChild(para);
> >
> >                               var exporter:ITextExporter =
> >TextConverter.getExporter("textLayoutFormat");
> >                               var res:Object =
> exporter.export(textFlow,"stringType");
> >                               trace(res);
> >                       }
> >               ]]>
> >       </fx:Script>
> >       <s:RichEditableText verticalCenter="0" width="400"
> >textFlow="{textFlow}"/>
> >
> ></s:Application>
> >
> >Harbs
> >
> >On Nov 4, 2013, at 7:21 AM, Alex Harui wrote:
> >
> >> I'm not sure what user styles are and why the aren't in the markup.  Can
> >> you provide more details?
> >>
> >> Consider whether this is a general TLF issue or just something you
> >>should
> >> do in your app to add functionality.  A general TLF issue probably can't
> >> bypass the Clipboard because you should be able to copy/paste from one
> >>SWF
> >> to another SWF.
> >>
> >> -Alex
> >>
> >> On 11/3/13 1:01 PM, "Gavriel Harbater" <ga...@gmail.com> wrote:
> >>
> >>> Okay. After researching this, it looks like the problem is as follows:
> >>>
> >>> The TextFlow is saved to the clipboard as a string which is the markup
> >>> representation of the TextFlow. The markup is produced using
> >>> BaseTextLayoutExporter.export(). The markup produced from that is
> >>>missing
> >>> custom user styles. My custom user styles are actually quite complex
> >>> classes.
> >>>
> >>> I'm looking for suggestions on the best way to handle this problem. I
> >>>can
> >>> think of three possible angles:
> >>> 1) Somehow write user styles into the TextFlow markup. I'm not sure if
> >>> there's a way to markup custom styles and complex ones are definitely
> >>>an
> >>> issue.
> >>> 2) Write complex objects to the clipboard. Is this possible? If yes,
> >>>why
> >>> are strings currently used?
> >>> 3) Skip the clipboard altogether and create some static function to
> >>>call
> >>> when the clipboard content is pasted to apply custom styles.
> >>>
> >>> Thoughts?
> >>>
> >>> On Nov 3, 2013, at 10:13 AM, Harbs wrote:
> >>>
> >>>> Looking into an issue I had, I noticed that user styles in TLF are not
> >>>> preserved on copy/paste. (Actually, it would probably be more correct
> >>>>to
> >>>> say that they're not preserved on copy.)
> >>>>
> >>>> I'm looking into TextScrap/TextClipboard now, but if anyone has
> >>>> experience here as to why the styles are being dropped, I'd love to
> >>>>knowŠ
> >>>>
> >>>> Harbs
> >>>
> >>
> >
>
>

Re: Copy/Paste in TLF

Posted by Alex Harui <ah...@adobe.com>.
Re #2.  Don't know for sure but I'd bet they didn't think about custom
styles and thought they could get everything they needed on the clipboard
in a more generic format so it would be more multipurpose and handle data
to from other applications and SWFs.

There is a way to serialize objects to text and back.  I think there may
be code in the RPC library for a stringified AMF, or you may be able to
write the objects to a bytearray, serialize that to string and then
reverse the process.


On 11/4/13 5:32 AM, "Cosma Colanicchia" <co...@gmail.com> wrote:

>Agree on 1, it should be more "pluggable" (unless it improved since the
>last time I checked).
>
>Regarding 2, clipboard class (see [1]) seems to support object references
>in clipboard. If the TextScrap is completely independent from its
>originating TextFlow, placing itself in the Clipboard (probably using a
>dedicated clipboard format, and in addition to the current serialized
>form)
>may have sense.
>
>
>[1]
>http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/d
>esktop/Clipboard.html
>
>
>
>
>2013/11/4 Harbs <ha...@gmail.com>
>
>> I'm not sure. Is there any way to deserialize to resolve to a reference
>>to
>> a class instance?
>>
>> For the most part, I'm using custom styles to track character and
>> paragraph styles. setStyle() and getStyle() writes and reads references
>>to
>> common styles that can be applied to any number of TextLayoutElements.
>> (Yes. I can probably track them using strings rather than object
>>references
>> to solve my problem, but object references is much neater and I'd rather
>> solve the underlying issue if possible.)
>>
>> Is there a reason that the TextScrap is not written to and read from the
>> clipboard directly? Is it really necessary to serialize it?
>>
>> There's really two separate issues here:
>> 1) Serialization of TLF could probably be more robust.
>> 2) The question as to whether serialization is really necessary. Is that
>> to facilitate copying the data from one swf to another? What about
>>copying
>> BOTH serialized data as well as the original TextScrap? The TextScrap
>>could
>> be used for the same swf and the serialized data can be used for a
>> different one.
>>
>> Harbs
>>
>> On Nov 4, 2013, at 9:19 AM, Alex Harui wrote:
>>
>> > So is it as simple as serializing non-strings to text and
>>de-serializing
>> > on import?
>> >
>> >
>> > On 11/3/13 11:12 PM, "Harbs" <ha...@gmail.com> wrote:
>> >
>> >> Here is a simple test case which illustrates the problem. I can
>>change
>> my
>> >> app for custom handling of copy/paste, but it seems to me that this
>>is a
>> >> general short-coming in the was copy paste is handled in TLF.
>> >>
>> >> Note: customStyle1 is preserved when the TextFlow is exported because
>> >> it's simple text, but customStyle2 is not preserved.
>> >>
>> >> The result of TextFlowExporter.export() is what's written to the
>> >> clipboard, so it's missing any complex custom styles.
>> >>
>> >> <?xml version="1.0" encoding="utf-8"?>
>> >> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>> >>                         xmlns:s="library://ns.adobe.com/flex/spark"
>> >>                         xmlns:mx="library://ns.adobe.com/flex/mx"
>> minWidth="955"
>> >> minHeight="600" creationComplete="onComplete()">
>> >>      <fx:Script>
>> >>              <![CDATA[
>> >>                      import
>>flashx.textLayout.conversion.ITextExporter;
>> >>                      import
>>flashx.textLayout.conversion.TextConverter;
>> >>                      import flashx.textLayout.edit.EditManager;
>> >>                      import
>>flashx.textLayout.elements.ParagraphElement;
>> >>                      import flashx.textLayout.elements.SpanElement;
>> >>                      import flashx.textLayout.elements.TextFlow;
>> >>                      import flashx.undo.UndoManager;
>> >>                      [Bindable]private var textFlow:TextFlow;
>> >>
>> >>                      private function onComplete():void{
>> >>                              var para:ParagraphElement;
>> >>                              var span:SpanElement;
>> >>                              var i:int;
>> >>                              textFlow =  new TextFlow();
>> >>                              textFlow.interactionManager = new
>> EditManager(new UndoManager());
>> >>                              textFlow.tabStops = "s12 s72";
>> >>                              textFlow.paragraphSpaceAfter = 16;
>> >>                              para = new ParagraphElement();
>> >>                              span = new SpanElement();
>> >>                              span.fontSize = 16;
>> >>                              span.fontWeight = "bold";
>> >>                              span.text = "Here's some text.";
>> >>                              span.setStyle("customStyle1","hello");
>> >>
>>  span.setStyle("customStyle2",{id:1,content:"this is some custom
>> >> content"});
>> >>                              para.addChild(span);
>> >>                              textFlow.addChild(para);
>> >>
>> >>                              var exporter:ITextExporter =
>> >> TextConverter.getExporter("textLayoutFormat");
>> >>                              var res:Object =
>> exporter.export(textFlow,"stringType");
>> >>                              trace(res);
>> >>                      }
>> >>              ]]>
>> >>      </fx:Script>
>> >>      <s:RichEditableText verticalCenter="0" width="400"
>> >> textFlow="{textFlow}"/>
>> >>
>> >> </s:Application>
>> >>
>> >> Harbs
>> >>
>> >> On Nov 4, 2013, at 7:21 AM, Alex Harui wrote:
>> >>
>> >>> I'm not sure what user styles are and why the aren't in the markup.
>>  Can
>> >>> you provide more details?
>> >>>
>> >>> Consider whether this is a general TLF issue or just something you
>> >>> should
>> >>> do in your app to add functionality.  A general TLF issue probably
>> can't
>> >>> bypass the Clipboard because you should be able to copy/paste from
>>one
>> >>> SWF
>> >>> to another SWF.
>> >>>
>> >>> -Alex
>> >>>
>> >>> On 11/3/13 1:01 PM, "Gavriel Harbater" <ga...@gmail.com> wrote:
>> >>>
>> >>>> Okay. After researching this, it looks like the problem is as
>>follows:
>> >>>>
>> >>>> The TextFlow is saved to the clipboard as a string which is the
>>markup
>> >>>> representation of the TextFlow. The markup is produced using
>> >>>> BaseTextLayoutExporter.export(). The markup produced from that is
>> >>>> missing
>> >>>> custom user styles. My custom user styles are actually quite
>>complex
>> >>>> classes.
>> >>>>
>> >>>> I'm looking for suggestions on the best way to handle this
>>problem. I
>> >>>> can
>> >>>> think of three possible angles:
>> >>>> 1) Somehow write user styles into the TextFlow markup. I'm not
>>sure if
>> >>>> there's a way to markup custom styles and complex ones are
>>definitely
>> >>>> an
>> >>>> issue.
>> >>>> 2) Write complex objects to the clipboard. Is this possible? If
>>yes,
>> >>>> why
>> >>>> are strings currently used?
>> >>>> 3) Skip the clipboard altogether and create some static function to
>> >>>> call
>> >>>> when the clipboard content is pasted to apply custom styles.
>> >>>>
>> >>>> Thoughts?
>> >>>>
>> >>>> On Nov 3, 2013, at 10:13 AM, Harbs wrote:
>> >>>>
>> >>>>> Looking into an issue I had, I noticed that user styles in TLF are
>> not
>> >>>>> preserved on copy/paste. (Actually, it would probably be more
>>correct
>> >>>>> to
>> >>>>> say that they're not preserved on copy.)
>> >>>>>
>> >>>>> I'm looking into TextScrap/TextClipboard now, but if anyone has
>> >>>>> experience here as to why the styles are being dropped, I'd love
>>to
>> >>>>> knowŠ
>> >>>>>
>> >>>>> Harbs
>> >>>>
>> >>>
>> >>
>> >
>>
>>


Re: Copy/Paste in TLF

Posted by Cosma Colanicchia <co...@gmail.com>.
Agree on 1, it should be more “pluggable” (unless it improved since the
last time I checked).

Regarding 2, clipboard class (see [1]) seems to support object references
in clipboard. If the TextScrap is completely independent from its
originating TextFlow, placing itself in the Clipboard (probably using a
dedicated clipboard format, and in addition to the current serialized form)
may have sense.


[1]
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/Clipboard.html




2013/11/4 Harbs <ha...@gmail.com>

> I'm not sure. Is there any way to deserialize to resolve to a reference to
> a class instance?
>
> For the most part, I'm using custom styles to track character and
> paragraph styles. setStyle() and getStyle() writes and reads references to
> common styles that can be applied to any number of TextLayoutElements.
> (Yes. I can probably track them using strings rather than object references
> to solve my problem, but object references is much neater and I'd rather
> solve the underlying issue if possible.)
>
> Is there a reason that the TextScrap is not written to and read from the
> clipboard directly? Is it really necessary to serialize it?
>
> There's really two separate issues here:
> 1) Serialization of TLF could probably be more robust.
> 2) The question as to whether serialization is really necessary. Is that
> to facilitate copying the data from one swf to another? What about copying
> BOTH serialized data as well as the original TextScrap? The TextScrap could
> be used for the same swf and the serialized data can be used for a
> different one.
>
> Harbs
>
> On Nov 4, 2013, at 9:19 AM, Alex Harui wrote:
>
> > So is it as simple as serializing non-strings to text and de-serializing
> > on import?
> >
> >
> > On 11/3/13 11:12 PM, "Harbs" <ha...@gmail.com> wrote:
> >
> >> Here is a simple test case which illustrates the problem. I can change
> my
> >> app for custom handling of copy/paste, but it seems to me that this is a
> >> general short-coming in the was copy paste is handled in TLF.
> >>
> >> Note: customStyle1 is preserved when the TextFlow is exported because
> >> it's simple text, but customStyle2 is not preserved.
> >>
> >> The result of TextFlowExporter.export() is what's written to the
> >> clipboard, so it's missing any complex custom styles.
> >>
> >> <?xml version="1.0" encoding="utf-8"?>
> >> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
> >>                         xmlns:s="library://ns.adobe.com/flex/spark"
> >>                         xmlns:mx="library://ns.adobe.com/flex/mx"
> minWidth="955"
> >> minHeight="600" creationComplete="onComplete()">
> >>      <fx:Script>
> >>              <![CDATA[
> >>                      import flashx.textLayout.conversion.ITextExporter;
> >>                      import flashx.textLayout.conversion.TextConverter;
> >>                      import flashx.textLayout.edit.EditManager;
> >>                      import flashx.textLayout.elements.ParagraphElement;
> >>                      import flashx.textLayout.elements.SpanElement;
> >>                      import flashx.textLayout.elements.TextFlow;
> >>                      import flashx.undo.UndoManager;
> >>                      [Bindable]private var textFlow:TextFlow;
> >>
> >>                      private function onComplete():void{
> >>                              var para:ParagraphElement;
> >>                              var span:SpanElement;
> >>                              var i:int;
> >>                              textFlow =  new TextFlow();
> >>                              textFlow.interactionManager = new
> EditManager(new UndoManager());
> >>                              textFlow.tabStops = "s12 s72";
> >>                              textFlow.paragraphSpaceAfter = 16;
> >>                              para = new ParagraphElement();
> >>                              span = new SpanElement();
> >>                              span.fontSize = 16;
> >>                              span.fontWeight = "bold";
> >>                              span.text = "Here's some text.";
> >>                              span.setStyle("customStyle1","hello");
> >>
>  span.setStyle("customStyle2",{id:1,content:"this is some custom
> >> content"});
> >>                              para.addChild(span);
> >>                              textFlow.addChild(para);
> >>
> >>                              var exporter:ITextExporter =
> >> TextConverter.getExporter("textLayoutFormat");
> >>                              var res:Object =
> exporter.export(textFlow,"stringType");
> >>                              trace(res);
> >>                      }
> >>              ]]>
> >>      </fx:Script>
> >>      <s:RichEditableText verticalCenter="0" width="400"
> >> textFlow="{textFlow}"/>
> >>
> >> </s:Application>
> >>
> >> Harbs
> >>
> >> On Nov 4, 2013, at 7:21 AM, Alex Harui wrote:
> >>
> >>> I'm not sure what user styles are and why the aren't in the markup.
>  Can
> >>> you provide more details?
> >>>
> >>> Consider whether this is a general TLF issue or just something you
> >>> should
> >>> do in your app to add functionality.  A general TLF issue probably
> can't
> >>> bypass the Clipboard because you should be able to copy/paste from one
> >>> SWF
> >>> to another SWF.
> >>>
> >>> -Alex
> >>>
> >>> On 11/3/13 1:01 PM, "Gavriel Harbater" <ga...@gmail.com> wrote:
> >>>
> >>>> Okay. After researching this, it looks like the problem is as follows:
> >>>>
> >>>> The TextFlow is saved to the clipboard as a string which is the markup
> >>>> representation of the TextFlow. The markup is produced using
> >>>> BaseTextLayoutExporter.export(). The markup produced from that is
> >>>> missing
> >>>> custom user styles. My custom user styles are actually quite complex
> >>>> classes.
> >>>>
> >>>> I'm looking for suggestions on the best way to handle this problem. I
> >>>> can
> >>>> think of three possible angles:
> >>>> 1) Somehow write user styles into the TextFlow markup. I'm not sure if
> >>>> there's a way to markup custom styles and complex ones are definitely
> >>>> an
> >>>> issue.
> >>>> 2) Write complex objects to the clipboard. Is this possible? If yes,
> >>>> why
> >>>> are strings currently used?
> >>>> 3) Skip the clipboard altogether and create some static function to
> >>>> call
> >>>> when the clipboard content is pasted to apply custom styles.
> >>>>
> >>>> Thoughts?
> >>>>
> >>>> On Nov 3, 2013, at 10:13 AM, Harbs wrote:
> >>>>
> >>>>> Looking into an issue I had, I noticed that user styles in TLF are
> not
> >>>>> preserved on copy/paste. (Actually, it would probably be more correct
> >>>>> to
> >>>>> say that they're not preserved on copy.)
> >>>>>
> >>>>> I'm looking into TextScrap/TextClipboard now, but if anyone has
> >>>>> experience here as to why the styles are being dropped, I'd love to
> >>>>> knowŠ
> >>>>>
> >>>>> Harbs
> >>>>
> >>>
> >>
> >
>
>

Re: Copy/Paste in TLF

Posted by Harbs <ha...@gmail.com>.
I'm not sure. Is there any way to deserialize to resolve to a reference to a class instance?

For the most part, I'm using custom styles to track character and paragraph styles. setStyle() and getStyle() writes and reads references to common styles that can be applied to any number of TextLayoutElements. (Yes. I can probably track them using strings rather than object references to solve my problem, but object references is much neater and I'd rather solve the underlying issue if possible.)

Is there a reason that the TextScrap is not written to and read from the clipboard directly? Is it really necessary to serialize it?

There's really two separate issues here:
1) Serialization of TLF could probably be more robust.
2) The question as to whether serialization is really necessary. Is that to facilitate copying the data from one swf to another? What about copying BOTH serialized data as well as the original TextScrap? The TextScrap could be used for the same swf and the serialized data can be used for a different one.

Harbs

On Nov 4, 2013, at 9:19 AM, Alex Harui wrote:

> So is it as simple as serializing non-strings to text and de-serializing
> on import?
> 
> 
> On 11/3/13 11:12 PM, "Harbs" <ha...@gmail.com> wrote:
> 
>> Here is a simple test case which illustrates the problem. I can change my
>> app for custom handling of copy/paste, but it seems to me that this is a
>> general short-coming in the was copy paste is handled in TLF.
>> 
>> Note: customStyle1 is preserved when the TextFlow is exported because
>> it's simple text, but customStyle2 is not preserved.
>> 
>> The result of TextFlowExporter.export() is what's written to the
>> clipboard, so it's missing any complex custom styles.
>> 
>> <?xml version="1.0" encoding="utf-8"?>
>> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>> 			   xmlns:s="library://ns.adobe.com/flex/spark"
>> 			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955"
>> minHeight="600" creationComplete="onComplete()">
>> 	<fx:Script>
>> 		<![CDATA[
>> 			import flashx.textLayout.conversion.ITextExporter;
>> 			import flashx.textLayout.conversion.TextConverter;
>> 			import flashx.textLayout.edit.EditManager;
>> 			import flashx.textLayout.elements.ParagraphElement;
>> 			import flashx.textLayout.elements.SpanElement;
>> 			import flashx.textLayout.elements.TextFlow;
>> 			import flashx.undo.UndoManager;
>> 			[Bindable]private var textFlow:TextFlow;
>> 
>> 			private function onComplete():void{
>> 				var para:ParagraphElement;
>> 				var span:SpanElement;
>> 				var i:int;
>> 				textFlow =  new TextFlow();
>> 				textFlow.interactionManager = new EditManager(new UndoManager());
>> 				textFlow.tabStops = "s12 s72";
>> 				textFlow.paragraphSpaceAfter = 16;
>> 				para = new ParagraphElement();
>> 				span = new SpanElement();
>> 				span.fontSize = 16;
>> 				span.fontWeight = "bold";
>> 				span.text = "Here's some text.";
>> 				span.setStyle("customStyle1","hello");
>> 				span.setStyle("customStyle2",{id:1,content:"this is some custom
>> content"});
>> 				para.addChild(span);
>> 				textFlow.addChild(para);
>> 				
>> 				var exporter:ITextExporter =
>> TextConverter.getExporter("textLayoutFormat");
>> 				var res:Object = exporter.export(textFlow,"stringType");
>> 				trace(res);
>> 			}
>> 		]]>
>> 	</fx:Script>
>> 	<s:RichEditableText verticalCenter="0" width="400"
>> textFlow="{textFlow}"/>
>> 	
>> </s:Application>
>> 
>> Harbs
>> 
>> On Nov 4, 2013, at 7:21 AM, Alex Harui wrote:
>> 
>>> I'm not sure what user styles are and why the aren't in the markup.  Can
>>> you provide more details?
>>> 
>>> Consider whether this is a general TLF issue or just something you
>>> should
>>> do in your app to add functionality.  A general TLF issue probably can't
>>> bypass the Clipboard because you should be able to copy/paste from one
>>> SWF
>>> to another SWF.
>>> 
>>> -Alex
>>> 
>>> On 11/3/13 1:01 PM, "Gavriel Harbater" <ga...@gmail.com> wrote:
>>> 
>>>> Okay. After researching this, it looks like the problem is as follows:
>>>> 
>>>> The TextFlow is saved to the clipboard as a string which is the markup
>>>> representation of the TextFlow. The markup is produced using
>>>> BaseTextLayoutExporter.export(). The markup produced from that is
>>>> missing
>>>> custom user styles. My custom user styles are actually quite complex
>>>> classes.
>>>> 
>>>> I'm looking for suggestions on the best way to handle this problem. I
>>>> can
>>>> think of three possible angles:
>>>> 1) Somehow write user styles into the TextFlow markup. I'm not sure if
>>>> there's a way to markup custom styles and complex ones are definitely
>>>> an
>>>> issue.
>>>> 2) Write complex objects to the clipboard. Is this possible? If yes,
>>>> why
>>>> are strings currently used?
>>>> 3) Skip the clipboard altogether and create some static function to
>>>> call
>>>> when the clipboard content is pasted to apply custom styles.
>>>> 
>>>> Thoughts?
>>>> 
>>>> On Nov 3, 2013, at 10:13 AM, Harbs wrote:
>>>> 
>>>>> Looking into an issue I had, I noticed that user styles in TLF are not
>>>>> preserved on copy/paste. (Actually, it would probably be more correct
>>>>> to
>>>>> say that they're not preserved on copy.)
>>>>> 
>>>>> I'm looking into TextScrap/TextClipboard now, but if anyone has
>>>>> experience here as to why the styles are being dropped, I'd love to
>>>>> knowŠ
>>>>> 
>>>>> Harbs
>>>> 
>>> 
>> 
> 


Re: Copy/Paste in TLF

Posted by Alex Harui <ah...@adobe.com>.
So is it as simple as serializing non-strings to text and de-serializing
on import?


On 11/3/13 11:12 PM, "Harbs" <ha...@gmail.com> wrote:

>Here is a simple test case which illustrates the problem. I can change my
>app for custom handling of copy/paste, but it seems to me that this is a
>general short-coming in the was copy paste is handled in TLF.
>
>Note: customStyle1 is preserved when the TextFlow is exported because
>it's simple text, but customStyle2 is not preserved.
>
>The result of TextFlowExporter.export() is what's written to the
>clipboard, so it's missing any complex custom styles.
>
><?xml version="1.0" encoding="utf-8"?>
><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
>			   xmlns:s="library://ns.adobe.com/flex/spark"
>			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955"
>minHeight="600" creationComplete="onComplete()">
>	<fx:Script>
>		<![CDATA[
>			import flashx.textLayout.conversion.ITextExporter;
>			import flashx.textLayout.conversion.TextConverter;
>			import flashx.textLayout.edit.EditManager;
>			import flashx.textLayout.elements.ParagraphElement;
>			import flashx.textLayout.elements.SpanElement;
>			import flashx.textLayout.elements.TextFlow;
>			import flashx.undo.UndoManager;
>			[Bindable]private var textFlow:TextFlow;
>
>			private function onComplete():void{
>				var para:ParagraphElement;
>				var span:SpanElement;
>				var i:int;
>				textFlow =  new TextFlow();
>				textFlow.interactionManager = new EditManager(new UndoManager());
>				textFlow.tabStops = "s12 s72";
>				textFlow.paragraphSpaceAfter = 16;
>				para = new ParagraphElement();
>				span = new SpanElement();
>				span.fontSize = 16;
>				span.fontWeight = "bold";
>				span.text = "Here's some text.";
>				span.setStyle("customStyle1","hello");
>				span.setStyle("customStyle2",{id:1,content:"this is some custom
>content"});
>				para.addChild(span);
>				textFlow.addChild(para);
>				
>				var exporter:ITextExporter =
>TextConverter.getExporter("textLayoutFormat");
>				var res:Object = exporter.export(textFlow,"stringType");
>				trace(res);
>			}
>		]]>
>	</fx:Script>
>	<s:RichEditableText verticalCenter="0" width="400"
>textFlow="{textFlow}"/>
>	
></s:Application>
>
>Harbs
>
>On Nov 4, 2013, at 7:21 AM, Alex Harui wrote:
>
>> I'm not sure what user styles are and why the aren't in the markup.  Can
>> you provide more details?
>> 
>> Consider whether this is a general TLF issue or just something you
>>should
>> do in your app to add functionality.  A general TLF issue probably can't
>> bypass the Clipboard because you should be able to copy/paste from one
>>SWF
>> to another SWF.
>> 
>> -Alex
>> 
>> On 11/3/13 1:01 PM, "Gavriel Harbater" <ga...@gmail.com> wrote:
>> 
>>> Okay. After researching this, it looks like the problem is as follows:
>>> 
>>> The TextFlow is saved to the clipboard as a string which is the markup
>>> representation of the TextFlow. The markup is produced using
>>> BaseTextLayoutExporter.export(). The markup produced from that is
>>>missing
>>> custom user styles. My custom user styles are actually quite complex
>>> classes.
>>> 
>>> I'm looking for suggestions on the best way to handle this problem. I
>>>can
>>> think of three possible angles:
>>> 1) Somehow write user styles into the TextFlow markup. I'm not sure if
>>> there's a way to markup custom styles and complex ones are definitely
>>>an
>>> issue.
>>> 2) Write complex objects to the clipboard. Is this possible? If yes,
>>>why
>>> are strings currently used?
>>> 3) Skip the clipboard altogether and create some static function to
>>>call
>>> when the clipboard content is pasted to apply custom styles.
>>> 
>>> Thoughts?
>>> 
>>> On Nov 3, 2013, at 10:13 AM, Harbs wrote:
>>> 
>>>> Looking into an issue I had, I noticed that user styles in TLF are not
>>>> preserved on copy/paste. (Actually, it would probably be more correct
>>>>to
>>>> say that they're not preserved on copy.)
>>>> 
>>>> I'm looking into TextScrap/TextClipboard now, but if anyone has
>>>> experience here as to why the styles are being dropped, I'd love to
>>>>knowŠ
>>>> 
>>>> Harbs
>>> 
>> 
>


Re: Copy/Paste in TLF

Posted by Harbs <ha...@gmail.com>.
Here is a simple test case which illustrates the problem. I can change my app for custom handling of copy/paste, but it seems to me that this is a general short-coming in the was copy paste is handled in TLF.

Note: customStyle1 is preserved when the TextFlow is exported because it's simple text, but customStyle2 is not preserved.

The result of TextFlowExporter.export() is what's written to the clipboard, so it's missing any complex custom styles.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="onComplete()">
	<fx:Script>
		<![CDATA[
			import flashx.textLayout.conversion.ITextExporter;
			import flashx.textLayout.conversion.TextConverter;
			import flashx.textLayout.edit.EditManager;
			import flashx.textLayout.elements.ParagraphElement;
			import flashx.textLayout.elements.SpanElement;
			import flashx.textLayout.elements.TextFlow;
			import flashx.undo.UndoManager;
			[Bindable]private var textFlow:TextFlow;

			private function onComplete():void{
				var para:ParagraphElement;
				var span:SpanElement;
				var i:int;
				textFlow =  new TextFlow();
				textFlow.interactionManager = new EditManager(new UndoManager());
				textFlow.tabStops = "s12 s72";
				textFlow.paragraphSpaceAfter = 16;
				para = new ParagraphElement();
				span = new SpanElement();
				span.fontSize = 16;
				span.fontWeight = "bold";
				span.text = "Here's some text.";
				span.setStyle("customStyle1","hello");
				span.setStyle("customStyle2",{id:1,content:"this is some custom content"});
				para.addChild(span);
				textFlow.addChild(para);
				
				var exporter:ITextExporter = TextConverter.getExporter("textLayoutFormat");
				var res:Object = exporter.export(textFlow,"stringType");
				trace(res);
			}
		]]>
	</fx:Script>
	<s:RichEditableText verticalCenter="0" width="400" textFlow="{textFlow}"/>
	
</s:Application>

Harbs

On Nov 4, 2013, at 7:21 AM, Alex Harui wrote:

> I'm not sure what user styles are and why the aren't in the markup.  Can
> you provide more details?
> 
> Consider whether this is a general TLF issue or just something you should
> do in your app to add functionality.  A general TLF issue probably can't
> bypass the Clipboard because you should be able to copy/paste from one SWF
> to another SWF.
> 
> -Alex
> 
> On 11/3/13 1:01 PM, "Gavriel Harbater" <ga...@gmail.com> wrote:
> 
>> Okay. After researching this, it looks like the problem is as follows:
>> 
>> The TextFlow is saved to the clipboard as a string which is the markup
>> representation of the TextFlow. The markup is produced using
>> BaseTextLayoutExporter.export(). The markup produced from that is missing
>> custom user styles. My custom user styles are actually quite complex
>> classes.
>> 
>> I'm looking for suggestions on the best way to handle this problem. I can
>> think of three possible angles:
>> 1) Somehow write user styles into the TextFlow markup. I'm not sure if
>> there's a way to markup custom styles and complex ones are definitely an
>> issue.
>> 2) Write complex objects to the clipboard. Is this possible? If yes, why
>> are strings currently used?
>> 3) Skip the clipboard altogether and create some static function to call
>> when the clipboard content is pasted to apply custom styles.
>> 
>> Thoughts?
>> 
>> On Nov 3, 2013, at 10:13 AM, Harbs wrote:
>> 
>>> Looking into an issue I had, I noticed that user styles in TLF are not
>>> preserved on copy/paste. (Actually, it would probably be more correct to
>>> say that they're not preserved on copy.)
>>> 
>>> I'm looking into TextScrap/TextClipboard now, but if anyone has
>>> experience here as to why the styles are being dropped, I'd love to knowŠ
>>> 
>>> Harbs
>> 
> 


Re: Copy/Paste in TLF

Posted by Alex Harui <ah...@adobe.com>.
I'm not sure what user styles are and why the aren't in the markup.  Can
you provide more details?

Consider whether this is a general TLF issue or just something you should
do in your app to add functionality.  A general TLF issue probably can't
bypass the Clipboard because you should be able to copy/paste from one SWF
to another SWF.

-Alex

On 11/3/13 1:01 PM, "Gavriel Harbater" <ga...@gmail.com> wrote:

>Okay. After researching this, it looks like the problem is as follows:
>
>The TextFlow is saved to the clipboard as a string which is the markup
>representation of the TextFlow. The markup is produced using
>BaseTextLayoutExporter.export(). The markup produced from that is missing
>custom user styles. My custom user styles are actually quite complex
>classes.
>
>I'm looking for suggestions on the best way to handle this problem. I can
>think of three possible angles:
>1) Somehow write user styles into the TextFlow markup. I'm not sure if
>there's a way to markup custom styles and complex ones are definitely an
>issue.
>2) Write complex objects to the clipboard. Is this possible? If yes, why
>are strings currently used?
>3) Skip the clipboard altogether and create some static function to call
>when the clipboard content is pasted to apply custom styles.
>
>Thoughts?
>
>On Nov 3, 2013, at 10:13 AM, Harbs wrote:
>
>> Looking into an issue I had, I noticed that user styles in TLF are not
>>preserved on copy/paste. (Actually, it would probably be more correct to
>>say that they're not preserved on copy.)
>> 
>> I'm looking into TextScrap/TextClipboard now, but if anyone has
>>experience here as to why the styles are being dropped, I'd love to knowŠ
>> 
>> Harbs
>


Re: Copy/Paste in TLF

Posted by Alex Harui <ah...@adobe.com>.
I'm not sure what user styles are and why the aren't in the markup.  Can
you provide more details?

Consider whether this is a general TLF issue or just something you should
do in your app to add functionality.  A general TLF issue probably can't
bypass the Clipboard because you should be able to copy/paste from one SWF
to another SWF.

-Alex

On 11/3/13 1:01 PM, "Gavriel Harbater" <ga...@gmail.com> wrote:

>Okay. After researching this, it looks like the problem is as follows:
>
>The TextFlow is saved to the clipboard as a string which is the markup
>representation of the TextFlow. The markup is produced using
>BaseTextLayoutExporter.export(). The markup produced from that is missing
>custom user styles. My custom user styles are actually quite complex
>classes.
>
>I'm looking for suggestions on the best way to handle this problem. I can
>think of three possible angles:
>1) Somehow write user styles into the TextFlow markup. I'm not sure if
>there's a way to markup custom styles and complex ones are definitely an
>issue.
>2) Write complex objects to the clipboard. Is this possible? If yes, why
>are strings currently used?
>3) Skip the clipboard altogether and create some static function to call
>when the clipboard content is pasted to apply custom styles.
>
>Thoughts?
>
>On Nov 3, 2013, at 10:13 AM, Harbs wrote:
>
>> Looking into an issue I had, I noticed that user styles in TLF are not
>>preserved on copy/paste. (Actually, it would probably be more correct to
>>say that they're not preserved on copy.)
>> 
>> I'm looking into TextScrap/TextClipboard now, but if anyone has
>>experience here as to why the styles are being dropped, I'd love to knowŠ
>> 
>> Harbs
>


Re: Copy/Paste in TLF

Posted by Alex Harui <ah...@adobe.com>.
I'm not sure what user styles are and why the aren't in the markup.  Can
you provide more details?

Consider whether this is a general TLF issue or just something you should
do in your app to add functionality.  A general TLF issue probably can't
bypass the Clipboard because you should be able to copy/paste from one SWF
to another SWF.

-Alex

On 11/3/13 1:01 PM, "Gavriel Harbater" <ga...@gmail.com> wrote:

>Okay. After researching this, it looks like the problem is as follows:
>
>The TextFlow is saved to the clipboard as a string which is the markup
>representation of the TextFlow. The markup is produced using
>BaseTextLayoutExporter.export(). The markup produced from that is missing
>custom user styles. My custom user styles are actually quite complex
>classes.
>
>I'm looking for suggestions on the best way to handle this problem. I can
>think of three possible angles:
>1) Somehow write user styles into the TextFlow markup. I'm not sure if
>there's a way to markup custom styles and complex ones are definitely an
>issue.
>2) Write complex objects to the clipboard. Is this possible? If yes, why
>are strings currently used?
>3) Skip the clipboard altogether and create some static function to call
>when the clipboard content is pasted to apply custom styles.
>
>Thoughts?
>
>On Nov 3, 2013, at 10:13 AM, Harbs wrote:
>
>> Looking into an issue I had, I noticed that user styles in TLF are not
>>preserved on copy/paste. (Actually, it would probably be more correct to
>>say that they're not preserved on copy.)
>> 
>> I'm looking into TextScrap/TextClipboard now, but if anyone has
>>experience here as to why the styles are being dropped, I'd love to knowŠ
>> 
>> Harbs
>


Re: Copy/Paste in TLF

Posted by Gavriel Harbater <ga...@gmail.com>.
Okay. After researching this, it looks like the problem is as follows:

The TextFlow is saved to the clipboard as a string which is the markup representation of the TextFlow. The markup is produced using BaseTextLayoutExporter.export(). The markup produced from that is missing custom user styles. My custom user styles are actually quite complex classes.

I'm looking for suggestions on the best way to handle this problem. I can think of three possible angles:
1) Somehow write user styles into the TextFlow markup. I'm not sure if there's a way to markup custom styles and complex ones are definitely an issue.
2) Write complex objects to the clipboard. Is this possible? If yes, why are strings currently used?
3) Skip the clipboard altogether and create some static function to call when the clipboard content is pasted to apply custom styles.

Thoughts?

On Nov 3, 2013, at 10:13 AM, Harbs wrote:

> Looking into an issue I had, I noticed that user styles in TLF are not preserved on copy/paste. (Actually, it would probably be more correct to say that they're not preserved on copy.)
> 
> I'm looking into TextScrap/TextClipboard now, but if anyone has experience here as to why the styles are being dropped, I'd love to know…
> 
> Harbs