retejs / dock-plugin

https://retejs.org
MIT License
5 stars 18 forks source link

Dragging pseudo-nodes from a dock #1

Closed Ni55aN closed 5 years ago

Ni55aN commented 5 years ago

Opera Snapshot_2019-03-24_173346_127 0 0 1

akshayred commented 5 years ago

Where can I find code or working example for this?

Ni55aN commented 5 years ago

@akshayred Code: https://github.com/retejs/rete.js.org/tree/master/src/components/Examples/list/dock Example: https://rete.js.org/#/examples/dock

akshayred commented 5 years ago

@Ni55aN Thanks for your quick response. I checked the code and example. But what I am implementing is by using html and Nodejs. So when I added https://cdn.jsdelivr.net/npm/rete-dock-plugin@0.1.1/build/dock-plugin.common.min.js to my html file, I am getting error ReferenceError: exports in not defined.

Ni55aN commented 5 years ago

This minified bundle by JsDelivr has CommonJs format (for Node.js, not browser). You need a UMD - this one

Then you must use it as follows:

editor.use(DockPlugin.default, ...
Ni55aN commented 5 years ago

By the way, I always advise to use ES modules if you have the opportunity to use a bundler. UMDs are only useful when you want to use it on Codepen, for example

akshayred commented 5 years ago

@Ni55aN Thanks for your inputs. But what I am trying to do here is, I am building a drupal 8 module and I don't want to have a dependency of Nodejs for that module. So when someone will use that module it should be just easy enabling that module and it should work. Do you think this could have some problem?

Ni55aN commented 5 years ago

Do you think this could have some problem?

Its harder to manage dependencies in this way. In addition, UMD modules have polyfills, which leads to an increase in the size of each bundle by about 5 KB