Giter VIP home page Giter VIP logo

Comments (5)

hizzgdev avatar hizzgdev commented on June 18, 2024 1

Thank you for your kindness @Vente16 .

I have considered the solution to merge all plugins to jsMind core library. TBH, I don't like it, since we have to load all features whether we use them or not.

A better solution is publishing plugins as standalone npm packages, but I haven't figured out if they should be.

from jsmind.

hizzgdev avatar hizzgdev commented on June 18, 2024

Hi @Vente16 , have you seen the error below:
image

  1. jsMind is the dependency of draggable_node, and should be loaded before load draggable_node
  2. jsMind should be global so it can be used in draggable_node
  3. it's expected that draggableNode is undefined, since nothing is exported

try it:

    require(["jsMind"], function (jsMind) {
        window.jsMind = jsMind
        require(["draggable_node"], function (draggableNode) {
            var mind={};
            var jm = new jsMind(options);
            jm.show(mind)
        });
    });

I know it's not a good solution, but it can be used as a workaround.
And, do you have any suggestion about that?

from jsmind.

Vente16 avatar Vente16 commented on June 18, 2024

Hi @Vente16 , have you seen the error below: image

  1. jsMind is the dependency of draggable_node, and should be loaded before load draggable_node
  2. jsMind should be global so it can be used in draggable_node
  3. it's expected that draggableNode is undefined, since nothing is exported

try it:

    require(["jsMind"], function (jsMind) {
        window.jsMind = jsMind
        require(["draggable_node"], function (draggableNode) {
            var mind={};
            var jm = new jsMind(options);
            jm.show(mind)
        });
    });

I know it's not a good solution, but it can be used as a workaround. And, do you have any suggestion about that?

Yep, I've seen that error before and I solve it loading jsmind first and then draggable_node

I was wondering if there is any chance to have draggable_node in jsmind and enable it or disabled it with a param something like this:

   const options = { draggable: true }
   const jm = new jsMind(options);

If that would be possible I'd like to contribute with that

from jsmind.

Vente16 avatar Vente16 commented on June 18, 2024

Thank you for your kindness @Vente16 .

I have considered the solution to merge all plugins to jsMind core library. TBH, I don't like it, since we have to load all features whether we use them or not.

A better solution is publishing plugins as standalone npm packages, but I haven't figured out if they should be.

Okay, cool.

    require(["jsMind"], function (jsMind) {
        window.jsMind = jsMind
        require(["draggable_node"], function (draggableNode) {
            var mind={};
            var jm = new jsMind(options);
            jm.show(mind)
        });
    });

This previous code didn't work for me, same error but I will close this issue and figured out another way. Thanks!

from jsmind.

hizzgdev avatar hizzgdev commented on June 18, 2024

A new version v0.6.5 has been published. jsMind will work fine with requirejs:

Please note that jsmind.js is not in the js directory but in es6

<script src="https://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
<script type="text/javascript">
    require.config({
        paths: {
            // note: replace `latest` with a specific version on production
            'jsmind': 'https://unpkg.com/jsmind@latest/es6/jsmind',
            'jsmind/draggable_node':
                'https://unpkg.com/jsmind@latest/es6/jsmind.draggable-node',
        },
    });
    require(['jsmind', 'jsmind/draggable_node'], function (jsMind, _) {
        let mind = {...};
        let options = {
            container: 'jsmind_container',
            editable: true,
            theme: 'primary',
        };
        let jm = new jsMind(options);
        jm.show(mind);
    });
</script>

https://hizzgdev.github.io/jsmind/example/3_requirejs.html

from jsmind.

Related Issues (20)

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.