Giter Club home page Giter Club logo

blazorxmleditor's Introduction

Blazor xml editor

A tag-view-style xml editor for dotnet blazor webassembly

Blazor xml editor

This is a port of the xml-editor for dotnet WinForms, which was created 2006 for the Windows version of the GaitoBotEditor. The project is currently under revision to remove old issues from 2006. Therefore it still contains German source code and outdated coding paradigms.

So the current version is still an early beta version.

Project is developed and maintained by Daniel Springwald

Demo

live demo

Requirements

The following libraries are required:

Documentation

Installation

In Program.cs add CurrieTechnologies.Razor.Clipboard service:

builder.Services.AddClipboard();

In index.html body add Blazor Extensions Canvas, CurrieTechnologies.Razor.Clipboard service and the blazor xml editor JS:

<script src="_content/Blazor.Extensions.Canvas/blazor.extensions.canvas.js"></script>
<script src="_content/CurrieTechnologies.Razor.Clipboard/clipboard.min.js"></script>
<script src="_content/de.springwald.xml.blazor/springwaldXmlEditBlazor.js"></script>

Use the standard layout

In the standard layout, the editor is located on the left. Above it is the toolbar with the actions. Attributes can be edited in the right area.

@using de.springwald.xml.editor
@using de.springwald.xml.blazor
@using de.springwald.xml.blazor.Components

<XmlEditorStandardLayout EditorContext="this.editorContext" OnReady="this.EditorIsReady" />

standard layout

Create an own layout

You can also layout the various controls and toolbars by hand:

@using de.springwald.xml.editor
@using de.springwald.xml.blazor
@using de.springwald.xml.blazor.Components

<div class="row">
    <div class="col-6">
        <XmlEditor EditorContext="this.editorContext" OnReady="this.EditorIsReady" />
    </div>
    <div class="col-6">
        <ActionsToolbar EditorContext="this.editorContext"></ActionsToolbar>
        <hr />
        <h5>insert element</h5>
        <AddElement EditorContext="this.editorContext" />
        <hr />
        <h5>edit attributes</h5>
        <EditAttributes EditorContext="this.editorContext" />
    </div>
</div>

individual layout

Connect the editor

@code {
    private string documentContent =    
        "<category>" +
            "<pattern>Lorem ipsum dolor sit amet, consetetur sadipscing elitr Lorem ipsum dolor sit amet, consetetur</pattern>" +
            "<template>Lorem<script>lorem</script> ipsum <star/> ipsum Dolor sit amet</template>" +
        "</category>";

    private EditorContext editorContext;
    private System.Xml.XmlDocument xmlDocument;

    protected override async Task OnInitializedAsync()
    {
        var demoDtd = DemoDtd.LoadDemoDtd();
        this.editorContext = new EditorContext(BlazorEditorConfig.StandardConfig, new DemoXmlRules(demoDtd));
        this.xmlDocument = new System.Xml.XmlDocument();
        this.xmlDocument.LoadXml(this.documentContent);
        await base.OnInitializedAsync();
    }

    private async Task EditorIsReady()
    {
        await this.editorContext.EditorStatus.SetRootNode(xmlDocument.DocumentElement);
        await this.editorContext.EditorStatus.CursorRoh.BeideCursorPosSetzenMitChangeEventWennGeaendert(xmlDocument.DocumentElement.ChildNodes[1].ChildNodes[1].FirstChild, cursor.XMLCursorPositionen.CursorAufNodeSelbstVorderesTag, 2);
    }
}

Third party material

This toolbox also contains modules from other authors - in unchanged or revised form.

For details see the license info.

blazorxmleditor's People

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.