Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting to HTML - delta with bullets, center/right align and qoute not getting its value and attributes #1842

Open
1 task done
aguilanbk opened this issue Apr 30, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@aguilanbk
Copy link

aguilanbk commented Apr 30, 2024

Is there an existing issue for this?

Flutter Quill version

9.3.9

Steps to reproduce

[{"insert":"gagagsagda\n","attributes":{"blockquote":true}},{"insert":"\n"},{"insert":"fsafsafas\n.gfsgfsgdfa","attributes":{"list":"bullet"}},{"insert":"afdfd","attributes":{"list":"bullet","bold":true}},{"insert":"\n","attributes":{"list":"bullet"}},{"insert":"fsafasfasdsa","attributes":{"list":"bullet","bold":true,"italic":true}},{"insert":"\n","attributes":{"list":"bullet"}}]

Expected results

value


  • value






with values and attributes ofcourse

Actual results

"











"

Code sample

Code sample
 QuillSimpleToolbarConfigurations toolbarConfig(controller) =>
        QuillSimpleToolbarConfigurations(
          controller: controller,
          axis: Axis.horizontal,
          multiRowsDisplay: true,
          showDividers: false,
          showSubscript: false,
          showSuperscript: false,
          showCodeBlock: false,
          sectionDividerSpace: 0,
          sharedConfigurations: const QuillSharedConfigurations(
            locale: Locale('en'),
          ),
        );

    QuillEditorConfigurations editorConfig(controller) =>
        QuillEditorConfigurations(
          minHeight: 250,
          padding: const EdgeInsets.all(20),
          controller: controller,
          readOnly: false,
          placeholder: 'Write something...',
          sharedConfigurations: const QuillSharedConfigurations(
            locale: Locale('en'),
          ),
        );

 Column(
                          children: [
                            Container(
                              child: QuillToolbar.simple(
                                  configurations: toolbarConfig(_controllerA)),
                            ),
                            Container(
                              decoration: const BoxDecoration(
                                border: Border(
                                  top: BorderSide(
                                      color: CustomColorSwatch.lighGreyBorder,
                                      width: 1),
                                ),
                              ),
                              child: QuillEditor.basic(
                                  configurations: editorConfig(_controllerA)),
                            ),
                          ],
                        ),
                        
                        RoundedCornerButton(
                        onPressed: () async {
                          final json = jsonEncode(
                              _controllerA.document.toDelta().toJson());
                          print(json);

                          // Convert Delta to HTML
                          final html = _controllerA.document.toDelta().toHtml();

                          print(html);
                        },
                        labelText: 'Create',
                        width: 140,
                        height: 45,
                      ),

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]
@aguilanbk aguilanbk added the bug Something isn't working label Apr 30, 2024
@aguilanbk aguilanbk changed the title Converting to HTML - delta with bullets and qoute not getting its value and attributes Converting to HTML - delta with bullets, center/right align and qoute not getting its value and attributes Apr 30, 2024
@andresguerreroh
Copy link

same problem,
image
list is not converted in HTML code

@CatHood0
Copy link

CatHood0 commented May 24, 2024

@aguilanbk I make a package to fix this. You can use https://pub.dev/packages/flutter_quill_to_pdf

Import the package and use convertDeltaToHtml is you only need HTML from delta

//this is what the function looks like
String convertDeltaToHtml(Delta delta, [ConverterOptions? options]) {
  return QuillDeltaToHtmlConverter(
    delta.toJson(),
    options ?? HTMLConverterOptions.options(), //this is a custom implementation from the package
  ).convert();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants