Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

148 Commits

Repository files navigation

@codemirror/merge NPM version

[ WEBSITE | DOCS | ISSUES | FORUM | CHANGELOG ]

This package implements a merge interface for the CodeMirror code editor.

The project page has more information, a number of examples and the documentation.

This code is released under an MIT license.

We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.

Usage

A split merge view can be created like this:

import{MergeView}from"@codemirror/merge"import{EditorView,basicSetup}from"codemirror"import{EditorState}from"@codemirror/state"letdoc=`onetwothreefourfive`constview=newMergeView({a: {
doc,extensions: basicSetup},b: {doc: doc.replace(/t/g,"T")+"\nSix",extensions: [basicSetup,EditorView.editable.of(false),EditorState.readOnly.of(true)]},parent: document.body})

Or a unified view like this:

import{EditorView,basicSetup}from"codemirror"import{unifiedMergeView}from"@codemirror/merge"constview=newEditorView({parent: document.body,doc: "one\ntwo\nthree\nfour",extensions: [basicSetup,unifiedMergeView({original: "one\n...\nfour"})]})

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages