jejacks0n / mercury

Mercury Editor: The Rails WYSIWYG editor that allows embedding full page editing capabilities directly inline.
http://jejacks0n.github.com/mercury
Other
2.63k stars 531 forks source link

Getting regions history buffer #415

Open goozzik opened 11 years ago

goozzik commented 11 years ago

I want to add global undo feature in project so it can undo action no matter which region is currently focused.

new Mercury.Region($('#header', $('iframe').contents()), window).history e {maxLength: 200, index: 0…}

Mercury.region.history e {maxLength: 200, index: 2....}

My question: How can I get region which is not currently focused with its history buffery?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/969371-getting-regions-history-buffer?utm_campaign=plugin&utm_content=tracker%2F134071&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F134071&utm_medium=issues&utm_source=github).
jejacks0n commented 11 years ago

You would need to bind to region events (probably adding a new one) that tracks all regions and when they push to the history.

Then you would need cmd+z (etc.) to be handled by the thing that you've added, and not the region.. then you could track what region was last changed, and tell the region to undo it's history. You probably also want to scroll to that region that will be changing so people can see that it's changing.


Jeremy Jackson

On Sep 24, 2013, at 5:04 AM, Jakub notifications@github.com wrote:

I want to add global undo feature in project so it can undo action no matter which region is currently focused.

new Mercury.Region($('#header', $('iframe').contents()), window).history e {maxLength: 200, index: 0…}

Mercury.region.history e {maxLength: 200, index: 2....}

My question: How can I get region which is not currently focused with its history buffery

— Reply to this email directly or view it on GitHub.

goozzik commented 11 years ago

Thanks for answer. Now I have history track of changed regions. One last question, how can I change behaviour of buttons undo and redo? In wiki I found this

Mercury.dialogHandlers contains the methods for when selects, palettes, and panels are loaded. Mercury.modalHandlers contains the methods for when modal windows are loaded (the one's that come down from the top and are centered). Mercury.lightviewHandlers contains the methods for lightviews (the ones that are black and in the center of the window -- the about dialog for instance)

How can I change these behaviours?