Giter Site home page Giter Site logo

ember-memento's People

Contributors

onkel-dirtus avatar pangratz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ember-memento's Issues

Re-add listener to array when it's changed

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.

Using updateProperties on object properties

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

Add updateProperties method

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.