Skip to main content
October 1, 2009
Answered

pasteTextScrap makes new line at the end?

  • October 1, 2009
  • 1 reply
  • 922 views

Im trying to paste a formated textScrap in a middle of a sentence, but after im pasting the text it makes me a new line at the bottom, for example if i want to paste text in the middle of this line "herehere", it should look like heretexthere

but instead it looks like:

heretext

here

code:

var pastedTextFlow:TextFlow=TextConverter.importToFlow(textToPaste,TextConverter.TEXT_LAYOUT_FORMAT);
var textScrap:TextScrap=new TextScrap(pastedTextFlow);

the same thing happends with

var pasteOperation:PasteOperation=new PasteOperation(new SelectionState(textFlow,4,4),textScrap);
_editor.editManager.pasteTextScrap(textScrap);

_editor.editManager.doOperation(pasteOperation);

any ideas?

This topic has been closed for replies.
Correct answer robin_briggs

Yes, I think that's what you need. Unfortunately the paste code will always give you a new paragraph if it thinks you copied a complete paragraph -- and in this case since you "copied" the whole flow, that is what you get. I agree that adding the API you suggest would be very helpful.

In the meantime, since you know you are going to get the new line, and you know you don't want it, you could delete it. Not ideal, but it would get you where you need to go.

Hope this helps,

- robin

1 reply

Adobe Employee
October 2, 2009

Did was copied include the end of the paragraph?

October 4, 2009

yes,

basicly what im trying to do is to send to someone the text i have pasted in the middle of the line

so im trying send the pasted formated text in the middle of the line.

so I take the pasted text and send the pasted text to another computer.

the pasted text looks like this:

<TextFlow>
    <p>
        <span fontWeight="bold">test</span>
    </p>
</TextFlow>

i event tryed to remove the <p></p> but it was the same result as my first post.

textflow.importToFlow creates a new text flow so it is not an option for me.

if there was something like

textflow.importToFlowAtSelectionRange(num,formatedText);

and then i would add only the <span fontWeight="bold">test</span>

It would be helpfull.

robin_briggsCorrect answer
Adobe Employee
October 6, 2009

Yes, I think that's what you need. Unfortunately the paste code will always give you a new paragraph if it thinks you copied a complete paragraph -- and in this case since you "copied" the whole flow, that is what you get. I agree that adding the API you suggest would be very helpful.

In the meantime, since you know you are going to get the new line, and you know you don't want it, you could delete it. Not ideal, but it would get you where you need to go.

Hope this helps,

- robin