Skip to content

A Blazor JSInterop wrapper for jsMind

License

Notifications You must be signed in to change notification settings

wkoeter/jsMind.Blazor

This branch is 1 commit ahead of, 49 commits behind StefH/jsMind.Blazor:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6b56022 · Nov 16, 2021

History

93 Commits
Aug 14, 2021
Nov 16, 2021
May 9, 2020
Nov 16, 2021
Apr 27, 2021
Jun 23, 2021
Jun 23, 2021
May 5, 2020
May 9, 2020
Jun 23, 2021
Apr 12, 2021
May 10, 2020
May 11, 2020

Repository files navigation

jsMind.Blazor

A Blazor JSInterop wrapper for jsMind.

NuGet

Example

Live Demo

https://stefh.github.io/jsMind.Blazor

Supported Functionality

See Wiki : Supported-Functionality

Usage

Install the NuGet

PM> Install-Package jsMind.Blazor

Add the required javascripts and stylesheet to _Host.cshtml (Server) or index.html (WebAssembly)

<head>
. . .
+    <script type="text/javascript" src="_content/jsMind.Blazor/jsmind.min.js"></script>
+    <script type="text/javascript" src="_content/jsMind.Blazor/jsmind-interop.min.js"></script>

+    <link type="text/css" rel="stylesheet" href="_content/jsMind.Blazor/jsmind.min.css" />
</head>

Add the required imports to the _Imports.razor

. . .
@using Microsoft.JSInterop
+ @using JsMind.Blazor.Components
+ @using JsMind.Blazor.Models
+ @using JsMind.Blazor.Events
+ @using JsMind.Blazor.Constants

Use the MindMapContainer

razor-html

@page "/"

<!-- Add the component -->
<MindMapTreeContainer @ref="_myTreeNodeContainer"
                      Options="@_options"
                      Data="@_treeData"
                      OnShow="@OnShowTree"
                      style="border:solid 1px blue; background:#f4f4f4;" />

razor - @code

{
    private MindMapTreeContainer _myTreeNodeContainer;

    // Define the MindMapOptions
    readonly MindMapOptions _options = new MindMapOptions
    {
        Editable = false,
        Theme = MindMapThemes.Primary
    };

    // Define some MindMapTreeData
    readonly MindMapTreeData _treeData = new MindMapTreeData
    {
        RootNode = new MindMapTreeNode
        {
            Id = "root",
            Topic = "-Root-",
            Children = new List<MindMapTreeNode>
            {
                new MindMapTreeNode
                {
                    Id = "sub1.0",
                    Topic = "sub1.0-right"
                },
                new MindMapTreeNode
                {
                    Id = "sub1.1",
                    Topic = "sub1.1-right",
                    Children = new List<MindMapTreeNode>
                    {
                        new MindMapTreeNode
                        {
                            Id = "sub1.1a",
                            Topic = "sub1.1a-right"
                        }
                    }
                },
                new MindMapTreeNode
                {
                    Id = "sub2",
                    Topic = "sub2-left",
                    Direction = MindMapNodeDirection.Left
                }
            }
        }
    };

    async Task OnShowTree(EventArgs args)
    {
        // When the MindMap is displayed, expand all nodes
        await _myTreeNodeContainer.Expand();
    }
}

About

A Blazor JSInterop wrapper for jsMind

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 78.6%
  • C# 15.7%
  • CSS 5.4%
  • Batchfile 0.3%