pangratz / ember-memento Goto Github PK
View Code? Open in Web Editor NEWUndo / Redo functionality for Ember.Object's
License: ISC License
Undo / Redo functionality for Ember.Object's
License: ISC License
Currently, when an array property is replaced, its changes are not tracked anymore since the observer was attached to the replaced array:
var obj = Ember.Object(Ember.Memento, {
mementoProperties: 'myArray'.w(),
myArray: []
});
obj.set('myArray', [1,2,3]); // not tracked for Undo/Redo
obj.get('myArray').pushObject(4); // not tracked for Undo/Redo
To fix this, the old listener must be removed when an array is about to be replaced and a new listener has to be added when the array is set.
Add properties undoCount
and redoCount
which indicates how many undo
's and redo
's can be made.
Remove either the whole history or specify parameter how many history items shall be kept.
Add rake task to upload the mixin as development and minified version to GitHub downloads.
These are simple computed properties which observe the length of undoCount
and redoCount
as defined in #5.
Would it be possible to implement another method (or extend this one) to merge properties that are object fields without replacing the whole object? e.g.
Editor.Element = Em.Object.extend(Editor.Memento, {
style: {
'border-style': 'none',
width: '200px',
height: '40px'
}
});
var el = Editor.Element.create();
el.updateProperties({style: {'width':'300px','height':'200px'}}); //this should replace width and height only and leave border-style unchanged, but would push a new state into the history
Create a property which allows to limit the amount of history/memento items.
This method allows the modification of multiple properties like Ember.setProperties
but all changes are available as one history item and not one history item per changed property.
Hi,
Is there a way to integrate it with ember data?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.