flutter-quill icon indicating copy to clipboard operation
flutter-quill copied to clipboard

Placeholder String doesn't take control characters in string.

Open SMH-Lily opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

Flutter Quill version

9.3.4

Steps to reproduce

placeholder: '''Here are a few ideas:

• Daily Goals • Client Insights...

Make the most of it!''',

or: placeholder: 'Here are a few ideas:\n\n• Daily Goals\n• Client Insights...\n\nMake the most of it!',

Expected results

image

Actual results

image

Code sample

Code sample
Column(
                          children: [
                            Expanded(
                              child: QuillEditor.basic(
                                configurations: QuillEditorConfigurations(
                                  controller: _controller,
                                  readOnly: false,
                                  placeholder: '''Here are a few ideas: 
                                      • Daily Goals
                                      • Client Insights...
                                      Make the most of it!''',
                                  customStyles: DefaultStyles(
                                      placeHolder: DefaultListBlockStyle(
                                          TextStyle(
                                              fontSize: 16,
                                              color:
                                                  Colors.grey.withOpacity(.7)),
                                          const VerticalSpacing(1, 1),
                                          const VerticalSpacing(1, 1),
                                          null,
                                          null)),
                                  sharedConfigurations:
                                      const QuillSharedConfigurations(
                                          locale: Locale('en')),
                                ),
                              ),
                            ),
                            QuillToolbar.simple(
                              configurations: QuillSimpleToolbarConfigurations(
                                controller: _controller,
                                sharedConfigurations:
                                    const QuillSharedConfigurations(
                                  locale: Locale('en'),
                                ),
                              ),
                            ),
                          ],
                        )

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

SMH-Lily avatar Apr 28 '24 22:04 SMH-Lily

Your problem is due to \n. When placed intrinsically in the string, the string will add or print new lines (whatever we want, but causing problems) as it should. But you need to pass a string like:

r"Here are some ideas:\n\n• Daily goals\n• Client insights...\n\nMake the most of it!'" Either

"Here are some ideas:\\n\\n• Daily goals\\n• Client insights...\\n\\nMake the most of it!'"

With these ropes you can solve this problem. This happens because the delta needs to have only \n as characters, in the string instead of intrinsic newlines.

CatHood0 avatar May 05 '24 23:05 CatHood0