Giter Club home page Giter Club logo

blazortextdiff's Introduction

Blazor Text Diff

A component to display side by side text diff using the DiffPlex library. There is probably some issues that I have looked over so if you notice one please submit an issue or do a pull request!

publish to nugetNuget

Static Diff Async Diff

Installation

You will need to add the nuget package DiffPlex into your project for this to work. An example project can be found in the Samples Folder for implementation.

// Program.cs
public static async Task Main(string[] args)
{
    var builder = WebAssemblyHostBuilder.CreateDefault(args);
    
    // These must be injected into your application to supply the component with its diff checking.
    builder.Services.AddScoped<ISideBySideDiffBuilder, SideBySideDiffBuilder>();
    builder.Services.AddScoped<IDiffer, Differ>();

    builder.RootComponents.Add<App>("app");

    await builder.Build().RunAsync();
}
<!-- Index.html -->
<link href="_content/BlazorTextDiff/css/BlazorDiff.css" rel="stylesheet" />
<script src="_content/BlazorTextDiff/js/BlazorTextDiff.js"></script>

Usage

<TextDiff

  <!-- The left side of the comparison -->
  OldText="Old Text"
  
  <!-- The right side of the comparison -->
  NewText="New Text"

  <!-- Determines if the div containing the diffs should be collapsed if there is a lot of data. -->
  <!-- There is currently an issue where the toggling doesn't work accurately with the js interop. -->
  CollapseContent="true"
  
  <!-- Converts space values into \u00B7 and tab values into \u00B7\u00B7 -->
  ShowWhiteSpace="true"

>
    <Header>
      <!-- Context Variables -->
      <!-- @context.Additions -->
      <!-- @context.Modifications -->
      <!-- @context.Deletions -->
    </Header>
</TextDiff>

blazortextdiff's People

Contributors

davidkarlas avatar lzinga avatar yomodo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

blazortextdiff's Issues

getHeight interop not updating correctly

When running the example it doesn't load the async diff height correctly.

paneHeight = await JSRuntime.InvokeAsync<int>("blazorTextDiff.getHeight", pane);

It starts at 0 and when toggled it is opposite of what it should be and it not loaded correctly upon first render. Somewhat new to Blazor so if anyone wants to help on this I would appreciate it!

No license

Hello @lzinga
Thanks for this controls, it fits my needs really well and would save me some time.
Unfortunately there is no license attached to it. I'd like to use your component for some internal website within my company but don't know if I'm allowed to.

Could you add a license (preferrably a permissive one) please?

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.