var Parchment = Quill.import('parchment');
var Delta = Quill.import('delta');
let Break = Quill.import('blots/break');
let Embed = Quill.import('blots/embed');
let Block = Quill.import('blots/block');
function lineBreakMatcher() {
  var newDelta = new Delta();
  newDelta.insert({'break': ''});
  return newDelta;
}

var QuillkeyboardOptions = {
  bindings: {
    linebreak: {
      key: 13,
      shiftKey: true,
        handler: function (range, context) {
          var nextChar = this.quill.getText(range.index + 1, 1)
          var ee = this.quill.insertEmbed(range.index, 'break', true, 'user');
          if (nextChar.length == 0) {
           var ee = this.quill.insertEmbed(range.index, 'break', true, 'user');
          }
          this.quill.setSelection(range.index + 1, Quill.sources.SILENT);
        }
      }
    }
};
Break.prototype.insertInto = function(parent, ref) {
    Embed.prototype.insertInto.call(this, parent, ref)
};
Break.prototype.length= function() {
    return 1;
}
Break.prototype.value= function() {
    return '\n';
}

var QuilltoolbarOptions_full = [
  ['bold', 'italic', 'underline', 'strike'],        // toggled buttons
  ['blockquote', 'code-block'],

  [{ 'header': 1 }, { 'header': 2 }],               // custom button values
  [{ 'list': 'ordered'}, { 'list': 'bullet' }],
  [{ 'script': 'sub'}, { 'script': 'super' }],      // superscript/subscript
  [{ 'indent': '-1'}, { 'indent': '+1' }],          // outdent/indent
  [{ 'direction': 'rtl' }],                         // text direction

  [{ 'size': ['small', false, 'large', 'huge'] }],  // custom dropdown
  [{ 'header': [1, 2, 3, 4, 5, 6, false] }],

  [{ 'color': [] }, { 'background': [] }],          // dropdown with defaults from theme
  [{ 'font': [] }],
  [{ 'align': [] }],

  ['image', 'video', 'formula'],

  ['clean']                                         // remove formatting button
];