Giter Club home page Giter Club logo

undo's Introduction

Undo.js

This is only a proof of concept, not a proper library.

Undo.js provides an abstraction for undoing and redoing any task. It can run both in the browser and on the server (targetted at node.js). It can be used to add undo and redo features to a custom application, e.g. undo and redo changing the priority of a task in a TODO list. It can also be used to undo and redo native browser features: Clicking a checkbox, editing a textbox and eventually, editing a contenteditable element.

The base abstraction will stay independent of any framework, while plugins, like a command editing a sortable list, will likely depend on libraries such as jQuery.

Installation

Via npm: npm install undo.js

Roadmap for demos to add:

  • Extend sortable list demo with jQuery UI sortable
  • form: track all form changes: text input, checkbox change, radio change, select change
  • add undo/redo to Backbone TODO demo
  • contenteditable with bold command

Demos:

http://jzaefferer.github.com/undo/demos/ http://jzaefferer.github.com/undo/demos/contenteditable.html

To suggest a feature, report a bug, or general discussion:

http://github.com/jzaefferer/undo/issues/

undo's People

Contributors

dbkaplun avatar jzaefferer avatar yunfong 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

undo's Issues

bug: context name property overwrite

It should be good thing to prevent overwrite the name of the actual context where we init the undo.js.
Me was a problem, that its extend function overwrites the main window object name property.
There is a missing var keyword before name variable in the for loop.

Undo group of commands

This is useful when you have many little changes.

For example the user might move a graphical object by drag and drop.

The user would not want to undo every pixel-sized change.

I would like to be able to group some commands, that the user can undo at once.

If the project is still active I would gladly submit a pull request.

Undo to the wrong state

There appears to be a bug with the contenteditable demo, here's how it goes:

  1. Highlight any word and click the bold button
  2. Click undo
  3. Highlight another word and make it bold
  4. Click undo
  5. Now the editable div goes to back to the state between 1 & 2, basically it should go back to nothing being highlighted, but instead it goes back to the state when the first word was highlighted.

I've tried hitting save at all of the various intervals in the sequence but this is very persistent...

Integrate with NY-Times Ice

I'm trying to integrate this into Ice, what I'm wanting to do is add accept and reject changes to the stack.
I need to be able to make a function for this because I'm not able to bind to a click. I'm getting an error that the variable stack is not found, how can I make it so that I can add to the stack from outside of the $(function() {?

Here's the function that I want to implenent.

function acceptAll() {
        tracker.acceptAll();
        var newValue = $("#textbody").html(); 
        stack.execute(new EditCommand(text, startValue, newValue));
        startValue = newValue;
}

使用的时候,undo.js里报错。

undo: function() {
this.commands[this.stackPosition].undo();
//说这里的undo()未定义
this.stackPosition--;
this.changed();
},
redo: function() {
this.stackPosition++;
this.commands[this.stackPosition].redo();
//还有这里的redo(),也是未定义
this.changed();
},

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.