mzijlstra / flowcharts

Flowcharts: Computational Thinking Tool
Apache License 2.0
2 stars 0 forks source link

Undo and Redo #14

Open mzijlstra opened 9 years ago

mzijlstra commented 9 years ago

It would be great to have undo / redo functionality for the flowchart editor.

Probably use the command pattern, and simply keep the previous InsData and VarData objects (full HTML) around.

mzijlstra commented 8 years ago

I realized that he easiest way to do this would be with a new table (possible called data), with the following columns:

longint id: surrogate key function_id: FK to the function char(3) type: ins (instruction) or var (variable) longtext html: the innerHTML for the ins or var int version: sequence number with which we can go back to undo, forward to redo??

This would of course also require an update to the function table: ins column would become a FK to the data table var column would become a FK to the data table version column would be the last used version??

I need to think a bit more about how and what the version -- in theory I could also base it on the data table's PK... but it would skip around and I would have to do general selects to find the next one... While an index on the version would allow me to just get the next / prev easily.

mzijlstra commented 8 years ago

Should just store JS in DB and generate flowchart from it. Simplifies DB version table (as JS has vars and ins' inside it). And generating flowchart from JS is needed feature already