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

Only value received is '"[{insert: \n}]"'

Open matboy82 opened this issue 2 years ago • 7 comments

Is there an existing issue for this?

The question

I'm a noob at flutter so maybe I'm just all screwed up, but when I call _controller.document.toDelta() to get what I typed in, I only ever get the insert key, I've tried toPlainText() and even converting via toHtml (that returned

<br/

).

My widget:

import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:quill_html_converter/quill_html_converter.dart';

class RichTextEditor extends StatelessWidget {
  RichTextEditor({super.key});

  final QuillController _controller = QuillController.basic();
 
  @override
  Widget build(BuildContext context) {
    return QuillProvider(
      configurations: QuillConfigurations(
        controller: _controller,
        sharedConfigurations: const QuillSharedConfigurations(
          locale: Locale('en', 'US'),
        ),
      ),
      child: ListView(
      shrinkWrap: true,
      children: [
        const QuillToolbar(),
        
        QuillEditor.basic(
            configurations: const QuillEditorConfigurations(
              readOnly: false,
              minHeight: 200,
              maxHeight: 500,
              showCursor: true,
              )
            ),
      ],
    ),
    );
  }

String getJsonDocument() {
  var delta = _controller.document.toDelta().toHtml();
  return delta;
}

  void dispose() {
    _controller.dispose();
  }
}

matboy82 avatar Dec 08 '23 22:12 matboy82

Hello there, on behalf the Flutter Quill Team I would like to thank you for opening your first issue. Your inputs and insights are valuable in shaping a stable and reliable version for all our users. Thank you for being part of the open-source community!

singerdmx avatar Dec 08 '23 22:12 singerdmx

Hi, thank you for the report, can you explain what you mean by only insert key?? can you send us the result and input? some images will help us understand the question

EchoEllet avatar Dec 08 '23 22:12 EchoEllet

Hi, thank you for the report, can you explain what you mean by only insert key?? can you send us the result and input? some images will help us understand the question

It looks like a json key, debug output from the call is [{insert: debug debug2 debug3

matboy82 avatar Dec 08 '23 22:12 matboy82

Hi, thank you for the report, can you explain what you mean by only insert key?? can you send us the result and input? some images will help us understand the question

It looks like a json key, debug output from the call is [{insert: debug debug2 debug3

You should use jsonEncode instead of toString

EchoEllet avatar Dec 08 '23 22:12 EchoEllet

Thank you for responding fast! I made the change, but still getting just the insert.

debug

matboy82 avatar Dec 08 '23 22:12 matboy82

Thank you for responding fast! I made the change, but still getting just the insert.

debug

Can you send me the GitHub repo so we can investigate it further?

EchoEllet avatar Dec 09 '23 10:12 EchoEllet

Invite sent, thank you!

matboy82 avatar Dec 09 '23 16:12 matboy82