angularquillngx-quill

ngx quill - set default format for editor


I use ngx-quill and try to set the default format of a new editor to be bold

onEditorCreated(quill) {
    quill.format('color', 'red');
    quill.format('align', 'right');
}

these work, however

onEditorCreated(quill) {
    quill.format('bold');
    quill.format('bold', 'bold');
    quill.format('format', 'bold');
    quill.format('inline', 'bold');
    );
  }

these dont.

Docs: https://quilljs.com/docs/api/#formatting


Solution

  • onEditorCreated(quill) {
        quill.format('bold','true');
        );
      }
    

    pfffff.... Just found out, by getting a hint from here:

    https://quilljs.com/docs/api/#updatecontents

    .retain(1, { bold: true })

    Also thanks https://github.com/KillerCodeMonkey for pushing me in the right direction:

    https://github.com/KillerCodeMonkey/ngx-quill/issues/971