All Projects â†’ ABenassi87 â†’ ngx-text-diff

ABenassi87 / ngx-text-diff

Licence: other
A Text Diff component for Angular

Programming Languages

typescript
32286 projects
HTML
75241 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ngx-text-diff

indicium
🔎 A simple in-memory search for collections and key-value stores.
Stars: ✭ 41 (-16.33%)
Mutual labels:  text
diffhtml
Tools for generating diff output in HTML.
Stars: ✭ 23 (-53.06%)
Mutual labels:  diff
tqsdk-js
期čī§čĄŒæƒ…/历åē数æŪ/äšĪ易 垀发包
Stars: ✭ 52 (+6.12%)
Mutual labels:  diff
Omeclone
A clone of omegle.com
Stars: ✭ 66 (+34.69%)
Mutual labels:  text
fast diff match patch
Python package for Google's diff-match-patch native C++ implementation.
Stars: ✭ 55 (+12.24%)
Mutual labels:  diff
fdiff
An OpenType table diff tool for fonts. Based on the fontTools TTX format.
Stars: ✭ 33 (-32.65%)
Mutual labels:  diff
markovifyR
Markovify wrapper for R
Stars: ✭ 81 (+65.31%)
Mutual labels:  text
txt
📝 Simple text editor/notepad with cloud sync.
Stars: ✭ 35 (-28.57%)
Mutual labels:  text
react-native-text-area
Simple and easy to use TextArea for React Native.
Stars: ✭ 20 (-59.18%)
Mutual labels:  text
text-rnn-tensorflow
Tutorial: Multi-layer Recurrent Neural Networks (LSTM, RNN) for text models in Python using TensorFlow.
Stars: ✭ 22 (-55.1%)
Mutual labels:  text
text-style-editor
Text style editor widget for flutter
Stars: ✭ 25 (-48.98%)
Mutual labels:  text
Diff.Net
A differencing utility for Window desktop written in C#.
Stars: ✭ 34 (-30.61%)
Mutual labels:  diff
Geist
A free text/code editor made with C++ and Qt
Stars: ✭ 27 (-44.9%)
Mutual labels:  text
diff-text
Just get the diff of a simple inline text, simple mode.
Stars: ✭ 13 (-73.47%)
Mutual labels:  diff
gitdub
ðŸ“Ī A github WebHook that emails detailed diffs of your commits.
Stars: ✭ 25 (-48.98%)
Mutual labels:  diff
node-poppler
Asynchronous node.js wrapper for the Poppler PDF rendering library
Stars: ✭ 97 (+97.96%)
Mutual labels:  text
py midicsv
A Python port and library-fication of the midicsv tool by John Walker. If you need to convert MIDI files to human-readable text files and back, this is the library for you.
Stars: ✭ 55 (+12.24%)
Mutual labels:  text
textdiff-create
Create lean text diff deltas.
Stars: ✭ 25 (-48.98%)
Mutual labels:  diff
textTinyR
Text Processing for Small or Big Data Files in R
Stars: ✭ 32 (-34.69%)
Mutual labels:  text
tools-generation-detection-synthetic-content
Compilation of the state of the art of tools, articles, forums and links of interest to generate and detect any type of synthetic content using deep learning.
Stars: ✭ 107 (+118.37%)
Mutual labels:  text

ngx-text-diff

  • A simple text diff component to be used with Angular and based on google diff match patch library.

Dependencies

  • diff-match-patch : ^1.0.4

Required Packages

These packages will not be auto-installed and must be installed in addition to this library.

  • @angular/common >= 6.0.0
  • @angular/core >= 6.0.0
  • @angular/forms >= 6.0.0
  • @angular/cdk >= 6.0.0 (used for scrolling synchronization)

Demo

Ngx Text Diff Demo

Installation

npm i ngx-text-diff

API

module: NgxTextDiffModule
component: NgxTextDiffComponent
selector: td-ngx-text-diff

Inputs

Input Type Required Description
left string Yes First text to be compared
right string Yes Second text to be compared
diffContent Observable Optional DiffContent observable
format DiffTableFormat Optional, default: SideBySide Possible values:
-SideBySide
-LineByLine
loading boolean Optional, default: false Possible values:
-true: shows an loading spinner.
- false: hides the loading spinner
hideMatchingLines boolean Optional, default: false Possible values:
-true: Only shows lines with differences.
- false: shows all lines
showToolbar boolean Optional, default: true Possible values:
-true: shows the toolbar.
- false: hides the format toolbar
showBtnToolbar boolean Optional, default: true Possible values:
-true: shows the format toolbar.
- false: hides the format toolbar
outerContainerClass any Optional ngClass object for the outer div
outerContainerStyle any Optional ngStyle object for the outer style
toolbarClass any Optional ngClass object for the toolbar div
toolbarStyle any Optional ngStyle object for the toolbar style
compareRowsClass any Optional ngClass object for the div surrounding the table rows
compareRowsStyle any Optional ngStyle object for the div surrounding the table rows
synchronizeScrolling boolean Optional, default: true Possible values:
-true: Scrolls both tables together.
- false: Scrolls individually

Output

Input Type Required Description
compareResults DiffResults Optional Event fired when comparison is executed

Custom Objects

export interface DiffContent {
  leftContent: string;
  rightContent: string;
}

export type DiffTableFormat = 'SideBySide' | 'LineByLine';

export interface DiffResults {
  hasDiff: boolean;
  diffsCount: number;
  rowsWithDiff: {
    leftLineNumber?: number;
    rightLineNumber?: number;
    numDiffs: number;
  }[];
}

Usage

  1. Register the NgxTextDiffModule in a module, for example app module.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { ScrollDispatchModule } from '@angular/cdk/scrolling';

import { AppComponent } from './app.component';
import { NgxTextDiffModule } from 'ngx-text-diff';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, ScrollDispatchModule, NgxTextDiffModule],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}
import { Component, OnInit } from '@angular/core';
import { DiffContent, DiffResults } from 'ngx-text-diff/lib/ngx-text-diff.model';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: []
})
export class HomeComponent implements OnInit {
  left = `some text to\nbe compared!`
  right = `A changed\n version \n of the text to\nbe compared!`

  constructor() {}

  ngOnInit() {
  }

  onCompareResults(diffResults: DiffResults) {
    console.log('diffResults', diffResults);
  }
}
<td-ngx-text-diff
  [left]="left"
  [right]="right"
  (compareResults)="onCompareResults($event)"
>

Build the NgxTextDiff module

Run ng build ngx-text-diff to build the library. The build artifacts will be stored in the dist/ngx-text-diff directory.

Credits

This project is based on google diff match patch.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].