Why doesn't quill-delta yield the right align attribute?

Viewed 40

Context

I am working on an editor that uses quill-react and delta. I'm using delta because I have functions that directly edit the delta from outside the editor, and it sounded like the right approach.

Problem

The delta value doesn't seem to have the right align attribute. For example, I'd expect this: enter image description here

to have a delta value of:

{"ops":[
{"insert":"center", "attributes":{"align":"center"}},
{"insert":"\nright", "attributes":{"align":"right"}}
]}

instead of:

{"ops":[
{"insert":"center\nright"},
{"attributes":{"align":"center"},"insert":"\n"}
]}

which is very ambiguous: reading this value from outside quill, there's no way I can determine that the word "right" needs to be aligned right.

What am I doing wrong? Am I misunderstanding how quill delta works?

Codesandbox: https://codesandbox.io/s/blissful-kalam-u04hsn?file=/src/App.tsx

0 Answers
Related