Git Product home page Git Product logo

live-diff-html-editor's Introduction

live diff html editor

generate exact diffs of rich text by tracking all changes in a wysiwyg html editor

all diff-algos will, in rare cases, produce "false diffs" which are not intended by the user. the diff format is always ambiguous, since there are many representations of one change

status

deprecated

this was just a proof of the "live diff html editor" concept

prosemirror track changes plugin

probably the best candidate to implement a FOSS "track changes" editor is the prosemirror rich text editor, with support for live collaboration via y-prosemirror and yts

similar but different: track changes as commits

other track changes plugins

ckeditor5 has a commercial track changes but we want a FOSS solution

live demo

codesandbox.io: live diff html editor

offline demo

git clone https://github.com/milahu/live-diff-html-editor.git
cd live-diff-html-editor
npm install
npm run start

use cases

  • feedback: allow users to edit html documents in their browser and generate patches in unidiff format (diff -u)
  • postprocessing: edit diff files to optimize the <del> and <ins> chunks for human-readability

implementation

we use inputevent and selectionchangeevent to build an exact live diff view of the user input

we use the contenteditable="true" attribute to make html contents editable

status

there are many edge-cases to solve ...

working

  • insert text. this only requires to insert a <ins> tag, and continued inputs simply append to that <ins> tag
  • delete text without crossing tag boundaries. simple. the cursor is by default placed after the <del> tag (forward delete as default), except when the user hits backspace, then the cursor is placed before the <del> tag

todo

  • delete text across tag boundaries. non-trivial. some bugs are known
  • merge <ins> and <del> tags. non-trivial. not implemented
  • inserting text into a <del> should be a noop. simple

related

this could be interesting for the pijul VCS, where exact diffs are desired

annotation

github as data store

collaboration

these tools focus on low-latency collaboration (real-time collaboration), similar to text chats or agile software development

rich text editors

more: https://github.com/JefMari/awesome-wysiwyg

data labeling for machine learning

license

license is CC0-1.0: zero limits and zero warranty

live-diff-html-editor's People

Contributors

milahu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

live-diff-html-editor's Issues

chardiff test 2021-05-11 17:59:01

i suggest this change:

chardiff 1.0
esc: \
code: utf16
wrap: $
width: 40
name: just a test
files: 1

file: some-file.html
chunks: 1

chunk: 1
offset: 0
length: 227
sha1: cDRgMrFbextyAz6i8wujm12yT4U=


  hello world
  <b>please just</b>
  e<del>dit me
  \\backslashes\\ and $dollars$ are wel$
come here,
  also 
carriage returns
 are accepted.
  unicode: \u00e4\u00f6\u00fc\u00df\u00$
b4`\u00a7\u20ac
  &amp;am</del>pers<ins>&nbsp;hello hel$
lo!&nbsp;</ins>and test&amp;


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.