I'm trying to write a firefox extension to support persistant undo...
essentially so that you can preserve state of form fields past page
reloads, browser crashes, etc.
I'd like to implement it via the transaction manager like so: extension
looks to see if it has history for a field on page load, and if so,
takes its serialized state of the undo stack and plays that back into
the transaction manager so that the field now represents the previous
contents of the field (assuming that the transaction limit had not been
reached previously).
I'm attempting to write up some code to implement this in javascript,
and so far I've been able to get the transaction manager, and get the
undo stack, but when I attempt to play it back into a new field with a
different transactionmanager (but still a plaintexteditor so still
should support the same interfaces) it doesn't actually load anything
into the state, nor does it produce any discernable errors.
I have a few questions regarding this:
What exactly is a transaction object? Is it an insert/delete supporting
the transaction interface or is it a different state?
Is it possible to inspect and serialize the state of a transaction?
Is it possible to take a transaction from one editor and do() it in
another? If not feel free to solve the problem and tell me how I might
do so as this is the crux of the problem (that and serialization).
Finally and on perhaps a less editor specific note: using xpcom objects
via javascript is... interesting and is presenting me some problems with
debugging. Suggestions on means to debug the code via more than dump()
would be appreciated.
Any of the questions anyone would like to answer would help me a lot,
I'm certainly making progress but hoping some guidance might speed me
along. I also think that this would be a fantastic feature for anyone
who uses a <textarea> a lot and has lost work due to POST weirdness,
crashes, network connection loss, stupid ajax...
~!kenny
_______________________________________________
dev-tech-editor mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-editor