Skip to content

Instantly share code, notes, and snippets.

@fmpwizard
Created May 27, 2018 07:55
Show Gist options
  • Save fmpwizard/58f0df6249f9584b1ea107ee553b5d72 to your computer and use it in GitHub Desktop.
Save fmpwizard/58f0df6249f9584b1ea107ee553b5d72 to your computer and use it in GitHub Desktop.
var Delta = Quill.import('delta');
var quill = new Quill('#editor-container', {
modules: {
toolbar: true
},
placeholder: 'Compose an epic...',
theme: 'snow'
});
// Store accumulated changes
var change = new Delta();
quill.on('text-change', function(delta) {
change = change.compose(delta);
});
var a = new Delta().insert('a')
var b = new Delta().retain(1).insert('b')
var c = new Delta().retain(1).insert('c')
var x = a.compose(b).transform(c, true)
quill.updateContents(a, 'api')
quill.updateContents(b, 'api')
//quill.updateContents(c, 'api')
quill.updateContents(x, 'api')
console.log('a', a.compose(b))
console.log('x', x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment