Angular quill-editor does not align text left

Viewed 675

Here, I am trying to align my text in a range 0-34 (i.e. one line) to left

Code snippet:

quill.formatText(0, 34, {
      'color': "White",
      'align': 'left',
      'background-color': "Black"
}, 'api');

Expected:

After adding above code - the text from index 0 to length 34 should be aligned left inside the editor.

Actual Result:

The text remains in center.

I need help to align range of text in different alignment(left/right/center)

1 Answers

According to their documentation:

For line level formats, such as text alignment, target the newline character or use the formatLine helper:

quill.formatText(0, 34, {
  'color': "White",
  'background-color': "Black"
}, 'api');

quill.formatLine(0, 1, 'align', 'left');
Related