singerdmx / flutter-quill

Rich text editor for Flutter
https://pub.dev/packages/flutter_quill
MIT License
2.43k stars 770 forks source link

`customStyles` are not saved #1971

Closed geronimol closed 1 day ago

geronimol commented 4 days ago

Is there an existing issue for this?

Flutter Quill version

9.5.3

Steps to reproduce

I want to set the default text color to red:

QuillEditor.basic(
  configurations: QuillEditorConfigurations(
    controller: _controller,
    autoFocus: true,
    customStyles: const DefaultStyles(
      paragraph: DefaultListBlockStyle(
        TextStyle(color: Colors.red),
        VerticalSpacing(0, 0),
        VerticalSpacing(0, 0),
        null,
        null,
      ),
    ),
  ),
),

The editor shows default text color as red Captura de pantalla 2024-07-04 a la(s) 17 12 16

But when I save it using

_controller.document.toDelta()

print() Captura de pantalla 2024-07-04 a la(s) 17 13 11

_controller.document.toDelta().toJson()

print() Captura de pantalla 2024-07-04 a la(s) 17 13 27

Related: #1925

Expected results

Using controller.document.toDelta() should save the customStyles

Actual results

customStyles aren't saved when using controller.document.toDelta()

Code sample

Code sample ```dart [Paste your code here] ```

Screenshots or Video

Screenshots / Video demonstration [Upload media here]

Logs

Logs ```console [Paste your logs here] ```
CatHood0 commented 4 days ago

Custom styles is just a visual configurations, them never have any effect on the Delta result

EchoEllet commented 3 days ago

Custom styles is just a visual configurations, them never have any effect on the Delta result

I think what he might try to do is to have the same content style as Delta JS (#1925), I would suggest changing the style in the Quill JS Editor Element/Component.