Giter Site home page Giter Site logo

history-plugin's People

Contributors

dependabot[bot] avatar dlohvinov avatar ni55an avatar petrkrejci1 avatar rete-js[bot] avatar theolympicdream avatar tradebot-tsanders avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

history-plugin's Issues

Undoing connection changes in a certain order causes "stray" path

I've found a situation that causes a connection path to stick around after the connection has been removed. The connection will be stuck until the page is reloaded.

Steps to reproduce:

  1. Create two nodes (I'll call them A and B)
  2. Connect A to B
  3. Remove connection between A and B
  4. Undo (re-adding connection)
  5. Undo again (re-removing connection)
  6. Move either node to see that the connection path is "stuck" where it was

Example codepen: https://codepen.io/gollum999/pen/rNxoaLB

History actions count restriction

Hi!

First of all, thank you for the great plugin!
In my project, I need an ability to restrict a count of stored history actions. I've downloaded this plugin and implemented it for myself, but, I suppose, it would be great if original plugin will have this functionality too.

Don't you mind if I will make a pull request with this feature?

Thanks for your response! ๐Ÿ’›๐Ÿ’™

Provide access to history object

I would like to be able to modify actions in the history under certain circumstances. (Similar to how the code that sets up DragNodeAction combines multiple node moves into a single action.)

As far as I can tell, there is no way to get at the History object in client code.

A couple of potential ideas:

  • Let the install function of all plugins return something to the caller, which could be stored alongside options in Context.plugins.
  • Store a reference to history inside Action, setting the value when 'addhistory' is triggered.

Undo event arguments

Thanks for very nice library and for you continues support,

My question is about editor.on('undo', (p1) => {}). I'm receiving an empty object here p1, is this ok ?
I expect the object to describe the action.

Undo/Redo does not work well with editor.clear()

Hi, thank you for the plugin.

For the issue. I believe the plugin does not properly add the history for the clear action that is called with the editor engine itself. Plugin may need to integrate it better with the editor action such as clear. Which clears/resets the stage/graph/

Unhandled Rejection (Error): The event clear does not exist

I'm getting the error Unhandled Rejection (Error): The event clear does not exist when just trying to use this plugin. Using "rete-history-plugin": "^0.2.2" and "rete": "^1.3.0" (for rete-dock-plugin).

Here's the whole stacktrace:

Unhandled Rejection (Error): The event clear does not exist
(anonymous function)
src/core/emitter.ts:16
  13 | const events = names instanceof Array ? names : (names as string).split(' ');
  14 | 
  15 | (events as string[]).forEach(name => {
> 16 |     if (!this.events[name])
     | ^  17 |         throw new Error(`The event ${name} does not exist`);
  18 |     this.events[name].push(handler);
  19 | });
View compiled
NodeEditor.on
src/core/emitter.ts:15
  12 | on<K extends keyof EventTypes>(names: K | K[], handler: (args: EventTypes[K]) => any) {
  13 |     const events = names instanceof Array ? names : (names as string).split(' ');
  14 | 
> 15 |     (events as string[]).forEach(name => {
     | ^  16 |         if (!this.events[name])
  17 |             throw new Error(`The event ${name} does not exist`);
  18 |         this.events[name].push(handler);
View compiled
install
src/index.js:33
NodeEditor.use
src/core/context.ts:27
  24 | use<T extends Plugin, O extends PluginParams<T>>(plugin: T, options?: O) {
  25 |     if (plugin.name && this.plugins.has(plugin.name)) throw new Error(`Plugin ${plugin.name} already in use`)
  26 | 
> 27 |     plugin.install(this, options || {});
     | ^  28 |     this.plugins.set(plugin.name, options)
  29 | }
  30 | 
View compiled
createEditor
src/component/Rete.jsx:153
  150 | });
  151 | // editor.use(SelectionPlugin, { enabled: true });
  152 | 
> 153 | editor.use(HistoryPlugin, { keyboard: true });
      | ^  154 | 
  155 | // editor.on('editcomment', async (comment) => {
  156 | //     comment.text = await openEditModal(comment.text);
View compiled
(anonymous function)
src/component/Rete.jsx:207
  204 | 
  205 | useEffect(() => {
  206 |     if (container) {
> 207 |         createEditor(container).then((value) => {
      | ^  208 |             console.log("created");
  209 |             editorRef.current = value;
  210 |         });
View compiled
โ–ถ 18 stack frames were collapsed.
Module.<anonymous>
src/index.js:7
   4 | import App from './App';
   5 | import reportWebVitals from './reportWebVitals';
   6 | 
>  7 | ReactDOM.render(
   8 |   <React.StrictMode>
   9 |     <App />
  10 |   </React.StrictMode>,
View compiled
Module../src/index.js
http://localhost:3000/static/js/main.chunk.js:840:30
__webpack_require__
/home/hugo/EIA/PGE/proto-sym-ui/webpack/bootstrap:856
  853 | 
  854 | __webpack_require__.$Refresh$.init();
  855 | try {
> 856 | 	modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  857 | } finally {
  858 | 	__webpack_require__.$Refresh$.cleanup(moduleId);
  859 | }
View compiled
fn
/home/hugo/EIA/PGE/proto-sym-ui/webpack/bootstrap:150
  147 | 		);
  148 | 		hotCurrentParents = [];
  149 | 	}
> 150 | 	return __webpack_require__(request);
      | ^  151 | };
  152 | var ObjectFactory = function ObjectFactory(name) {
  153 | 	return {
View compiled
1
http://localhost:3000/static/js/main.chunk.js:963:18
__webpack_require__
/home/hugo/EIA/PGE/proto-sym-ui/webpack/bootstrap:856
  853 | 
  854 | __webpack_require__.$Refresh$.init();
  855 | try {
> 856 | 	modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
      | ^  857 | } finally {
  858 | 	__webpack_require__.$Refresh$.cleanup(moduleId);
  859 | }
View compiled
checkDeferredModules
/home/hugo/EIA/PGE/proto-sym-ui/webpack/bootstrap:45
  42 | 	}
  43 | 	if(fulfilled) {
  44 | 		deferredModules.splice(i--, 1);
> 45 | 		result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
     | ^  46 | 	}
  47 | }
  48 | 
View compiled
Array.webpackJsonpCallback [as push]
/home/hugo/EIA/PGE/proto-sym-ui/webpack/bootstrap:32
  29 | 	deferredModules.push.apply(deferredModules, executeModules || []);
  30 | 
  31 | 	// run deferred modules when all chunks ready
> 32 | 	return checkDeferredModules();
     | ^  33 | };
  34 | function checkDeferredModules() {
  35 | 	var result;
View compiled
(anonymous function)
http://localhost:3000/static/js/main.chunk.js:1:77

Avoid to add to list certain type of actions

Hi, I can see that you automatically add node creation for example.
Is there a way to to make a workaround if i have a non-removable node that exists by default in my app, to avoid to add to the undo redo list when the model is being created?
Any idea?
Thanks in advance

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.