Copy link to clipboard
Copied
Hi,
I wanna to add a operation in the queue of operations, when I run the following code.
EditManager(textFlow.interactionManager).beginCompositeOperation()
var para:ParagraphElement = new ParagraphElement();
var spanBullet:SpanElement = new SpanElement();
var span:SpanElement = new SpanElement();
spanBullet.text = "1."
span.text = "testing";
para.addChild(spanBullet);
para.addChild(span);
textFlow.addChild(para);
EditManager(textFlow.interactionManager).endCompositeOperation();
Copy link to clipboard
Copied
To create your own operation you should subclass FlowOperation. Then write a doOperation undo and redo method. When you actually want to execute the operation call EditManager.doOperation with an instance of your subclass.
In this case you don't need begin/endCompositeOperation. Those methods are for combining multiple FlowOperations into a single operation.
Hope that helps,
Richard
Copy link to clipboard
Copied
Hi Richard,
Thanks for reply
Copy link to clipboard
Copied
The closet thing to adding a paragraph is SplitParagraphOperation. Do that at the end of a Paragraph.
Model changes (addChild/removeChild etc.) are not automatically recorded for undo. Each operation is responsible for recording initial state to undo (and later redo) the change.
By the way more recent docs are available here:
http://livedocs.adobe.com/flex/gumbo/langref/
Richard
Copy link to clipboard
Copied
Hi, Richard
Thanks for reply,
So just to finish, can not put into the queue of undo and redo calling addChild and removeChild from TextFlow ?
Copy link to clipboard
Copied
Each operation manages undo/redo on its own. None of the model changes are recorded for undo.
Richard
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more