I'm struggling with the TLF UndoManager. All is well when working only with the text component, but when it loses focus, and then gains it back, i cannot undo/redo anything.
I've seen someone post a backdoor with
use namespace mx_internal; RichEditableText(textArea.textDisplay).clearUndoOnFocusOut = false;
But it does not help, nor does it give an error.
Currently implementing my own UndoManager and just silencing the built-in one, but still hoping to make this work and not re-invent the wheel.
If anyone has encountered this problem, can you please show me the solution?
No skins applied.
You can see the same behaviour here:
Just scroll down to the example, write something in the first TextArea, then switch focus to the other one, then click back on the first one and try to undo what you previously did (CTRL-Z). Nothing is undone/redone.
If the TextArea doesn't lose focus, you can undo/redo as usual.
You can see the source code there as well. No skins are applied.
Default behavior is to reset undo on focusOut, so the example works as expected. What isn’t clear is whether your flipping of that undocumented flag is known to work or not. I took a quick look at the code and it definitely alters a code path, but maybe UndoManager has its own focusOut logic.
Well the default behavior is the probelm.
Doesn't really make any sense, why dump the undo operations?
All they do is store links to objects, which should be dumped on object deletion, not focus loss.
It's a normal thing for a user to write something in a text field, then press a button / use another control, then go back to the text field and try to undo.
Is there a way to overwrite this default behavior?
Didn't find anything related in the UndoManager source code, so it's probably hiding in the spark.TextArea code.
Yeah, I was unaware of the default behavior. I’m surprised it clears on focusOut. That flag you found looks like it should do the trick and I don’t know why it doesn’t. I’ll try to find time to look. What version of Flex are you using?
Looks like it saves text deletion/insertion operations.
When i try to change the format (bold/italic/font etc.) , not only does it ignore these changes, it removes all previously saved operations (deletion/insertion).