Code Monkey home page Code Monkey logo

quill_html_editor's Introduction

Pub Version GitHub Pub Points Pub Popularity

Quill Html Editor

Quill Html Editor is a powerful HTML rich text editor designed for Android, iOS, and Web platforms. It leverages the capabilities of the QuillJs library, an open-source WYSIWYG editor, to provide a feature-rich editing experience for modern web applications.

Features

  • Highly customizable Editor and Toolbar widgets.
  • Supports the Delta format, allowing you to set and retrieve content using setDelta and getDelta methods.
  • Enables seamless copy-pasting of rich text from other files or webpages.
  • The detached Toolbar can be placed anywhere on the page to suit your requirements.
  • Provides the flexibility to add custom buttons to the toolbar.
  • Supports embedding of images, videos, and insertion of tables.
  • Allows setting and retrieving text in both HTML and Delta formats.
  • Supports integration with Google Fonts for a wide range of font options.

Demo

To experience the capabilities of the Quill Html Editor, you can visit our Demo Page. Explore the editor's functionalities and see how it can enhance your web editing experience.

Screenshots

1

1

Documentation

See the API documentation for details on the following topics:

Usage

Define a QuillEditorController to access the editor methods, pass the controller to QuillHtmlEditor Widget

  final QuillEditorController controller = QuillEditorController();
     QuillHtmlEditor(
        text: "<h1>Hello</h1>This is a quill html editor example 😊",
        hintText: 'Hint text goes here',
        controller: controller,
        isEnabled: true,
        minHeight: 300,
        textStyle: _editorTextStyle,
        hintTextStyle: _hintTextStyle,
        hintTextAlign: TextAlign.start,
        padding: const EdgeInsets.only(left: 10, top: 5),
        hintTextPadding: EdgeInsets.zero,
        backgroundColor: _backgroundColor,
        onFocusChanged: (hasFocus) => debugPrint('has focus $hasFocus'),
        onTextChanged: (text) => debugPrint('widget text change $text'),
        onEditorCreated: () => debugPrint('Editor has been loaded'),
        onEditingComplete: (s) => debugPrint('Editing completed $s'),
        onEditorResized: (height) =>
        debugPrint('Editor resized $height'),
        onSelectionChanged: (sel) =>
        debugPrint('${sel.index},${sel.length}'),
        loadingBuilder: (context) {
            return const Center(
            child: CircularProgressIndicator(
            strokeWidth: 0.4,
            ));},
      ),

Define ToolBar widget and pass the same controller created for QuillHtmlEditor

   ToolBar(
     toolBarColor: Colors.cyan.shade50,
     activeIconColor: Colors.green,
     padding: const EdgeInsets.all(8),
     iconSize: 20,
     controller: controller,
     customButtons: [
     InkWell(onTap: () {}, child: const Icon(Icons.favorite)),
     InkWell(onTap: () {}, child: const Icon(Icons.add_circle)),
     ],
   )

ToolBar Scroll Configuration

The ToolBar.scroll widget allows you to display the toolbar buttons in a single row or column, based on the specified direction parameter. By default, the direction is set to Axis.horizontal, which arranges the buttons in a single row.

To change the direction and display the buttons in a single column, you can provide the direction parameter as Axis.vertical. Here's an example:

    ToolBar.scroll(
         toolBarColor: _toolbarColor,
         controller: controller,
         direction: Axis.vertical,
    ),

In the above example, the ToolBar.scroll widget is used to display the toolbar buttons in a vertical arrangement.

Customizing Toolbar Buttons

The ToolBar widget allows you to customize the buttons that are displayed in the toolbar. By default, if the toolBarConfig parameter is not provided, all the toolbar buttons will be shown.

If you want to show only specific buttons, you can pass a list of ToolBarStyle types to the toolBarConfig parameter. For example:

final customToolBarList = [
  ToolBarStyle.bold,
  ToolBarStyle.italic,
  ToolBarStyle.align,
  ToolBarStyle.color,
];

    ToolBar(
      controller: controller,
      toolBarConfig: customToolBarList,
    ),

In the above example, only the "Bold," "Italic," "Align," and "Color" buttons will be displayed in the toolbar.

Additionally, you can add custom buttons to the toolbar by providing a list of custom widgets to the customButtons parameter. Here's an example:

final customButtons = [
  InkWell(onTap: () {}, child: const Icon(Icons.favorite)),
  InkWell(onTap: () {}, child: const Icon(Icons.add_circle)),
];

    ToolBar(
      controller: controller,
      customButtons: customButtons,
    ),

In the above example, custom buttons with heart and add circle icons are added to the toolbar.

Feel free to customize the toolbar configuration and add custom buttons according to your requirements to enhance the editing experience with the Quill Html Editor.

Custom Fonts in Quill Html Editor

You can pass custom fonts to the text style in the quill_html_editor package by following these steps:

Define your custom font family in your Flutter project. You can use Google Fonts. Let's assume you want to use the 'Roboto' font family.

final _editorTextStyle = const TextStyle(
  fontSize: 18,
  color: Colors.black,
  fontWeight: FontWeight.normal,
  fontFamily: 'Roboto',
);

By following these steps, you can pass custom font styles to the text within the QuillHtmlEditor widget. The fontFamily property of the TextStyle allows you to specify the desired font family, such as 'Roboto' in this example.

To get the html string from editor
  String? htmlText = await controller.getText();
To set the html string to editor
 await controller.setText(text);
To get the text in delta format
 await controller.getDelta();
To set the text in delta format
 controller.setDelta(deltaMap);
To insert the html string to editor
/// index is optional
/// If the index is not passed, the text will be inserted at the cursor position
await controller.insertText(text, index: 10);  
To clear the editor
  controller.clear();
To enable editor
  controller.enableEditor(true);
To disable editor
  controller.enableEditor(false);

Todo

  • CustomStyleButton - Let the user add own icons to toolbar styles
  • Custom Color - Let the user add more Colors to the Color Picker
  • Custom FontSize - Let the user add custom font sizes, instead of just Small, Normal, Large & Huge
  • AsyncImagePickerButton - To share picked file to user, to upload it asynchronously and inserts the returned link into the editor
  • More examples for each available apis

MIT License

Copyright (c) 2022 Pavan Kumar Nagulavancha

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

quill_html_editor's People

Contributors

anees4ever avatar cabbagelol avatar chaucm avatar liemvu avatar the-airbender avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

quill_html_editor's Issues

[BUG] Duplicate GlobalKeys detected in widget tree.

Describe the bug
I have a page with QuillHtmlEditor that can be navigated from multiple places, that means I can have this page opened multiple times in the stack.
The problem is when that happenes the following message will appear:

The following GlobalKeys were specified multiple times in the widget tree. This will lead to parts of the widget tree being truncated unexpectedly, because the second time a key is seen, the previous instance is moved to the new location. The keys were:

  • [GlobalKey#8f02b]
    [LabeledGlobalKey<QuillHtmlEditorState>#07cc0]

and QuillHtmlEditor does not have a key property to fix this problem

To Reproduce
Steps to reproduce the behavior
Let's assume that page A has the QuillHtmlEditor

  1. Navigate using Navigator.of(context).push from page A to B
  2. Navigate using Navigator.of(context).push from page B to A
  3. See the error

Expected behavior
Having key property in QuillHtmlEditor to fix this problem

Smartphone (please complete the following information):

  • Device: [e.g. Galaxy note 9]
  • OS: [e.g. android 10]

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 3.7.3, on Linux Mint 21.1 5.15.0-67-generic, locale
en_US.UTF-8)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[βœ“] Chrome - develop for the web
[βœ“] Linux toolchain - develop for Linux desktop
[βœ“] Android Studio (version 2022.1)
[βœ“] VS Code (version 1.76.1)
[βœ“] Connected device (3 available)
[βœ“] HTTP Host Availability
β€’ No issues found!

[BUG] Listening to text change on Android is not working

Describe the bug
On Android, the onTextChanged event of the QuillEditorController is never triggered. Same goes for the onTextChanged property of the QuillHtmlEditor widget. This makes it unusable for me in production systems because on Android, the placeholder never goes away and I can not use the text that's being entered. Using the newest version (2.1.7) of quill_html_editor.

Minimum reproducible example:

class TestWidget extends StatefulWidget {
  @override
  State<TestWidget> createState() => _TestWidgetState();
}

class _TestWidgetState extends State<TestWidget> {
  late final QuillEditorController _textEditingController;

  @override
  void initState() {
    _textEditingController = QuillEditorController();
    _textEditingController.onTextChanged((String text) {
      print(text);
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return QuillHtmlEditor(
      controller: _textEditingController,
      minHeight: 1,
    );
  }
}

I was able to reproduce this on a physical Google Pixel 4a and an Android emulator. On iOS everything seems fine.

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 3.7.3, on macOS 13.1 22C65 darwin-arm64, locale
    en-DE)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[βœ“] Xcode - develop for iOS and macOS (Xcode 14.2)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2021.3)
[βœ“] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
[βœ“] Connected device (5 available)
[βœ“] HTTP Host Availability

[BUG] Redo button shows errors & Missing iOS folder.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Open Example app inside package
  2. Create iOS folder
  3. Run app into a real device
  4. Type redo button a couple of times

Expected behavior
No errors shown

Error
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Result of JavaScript execution returned a nullvalue. UserunJavascriptwhen expecting a null return value. #0 WebKitWebViewController.runJavaScriptReturningResult (package:webview_flutter_wkwebview/src/webkit_webview_controller.dart:306:7) <asynchronous suspension> #1 WebViewXController.callJsMethod (package:quill_html_editor/src/widgets/webviewx/src/controller/impl/mobile.dart:124:20) <asynchronous suspension> #2 QuillHtmlEditorState._redo (package:quill_html_editor/src/quill_editor_wrapper.dart:366:12) <asynchronous suspension> #3 QuillEditorController.redo (package:quill_html_editor/src/quill_editor_wrapper.dart:1068:5) <asynchronous suspension> [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Result of JavaScript execution returned anullvalue. UserunJavascriptwhen expecting a null return value. #0 WebKitWebViewController.runJavaScriptReturningResult (package:webview_flutter_wkwebview/src/webkit_webview_controller.dart:306:7) <asynchronous suspension> #1 WebViewXController.callJsMethod (package:quill_html_editor/src/widgets/webviewx/src/controller/impl/mobile.dart:124:20) <asynchronous suspension> #2 QuillHtmlEditorState._redo (package:quill_html_editor/src/quill_editor_wrapper.dart:366:12) <asynchronous suspension> #3 QuillEditorController.redo (package:quill_html_editor/src/quill_editor_wrapper.dart:1068:5) <asynchronous suspension> [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Result of JavaScript execution returned anullvalue. UserunJavascriptwhen expecting a null return value. #0 WebKitWebViewController.runJavaScriptReturningResult (package:webview_flutter_wkwebview/src/webkit_webview_controller.dart:306:7) <asynchronous suspension> #1 WebViewXController.callJsMethod (package:quill_html_editor/src/widgets/webviewx/src/controller/impl/mobile.dart:124:20) <asynchronous suspension> #2 QuillHtmlEditorState._redo (package:quill_html_editor/src/quill_editor_wrapper.dart:366:12) <asynchronous suspension> #3 QuillEditorController.redo (package:quill_html_editor/src/quill_editor_wrapper.dart:1068:5) <asynchronous suspension>

Smartphone (please complete the following information):

  • Device: iPhone 14 pro
  • OS: iOS16.3.1

Flutter Doctor
Please run flutter doctor in the terminal and add the log here.

[βœ“] Flutter (Channel stable, 3.7.7, on macOS 13.1 22C65 darwin-arm64, locale en-MX) [βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.1) [βœ“] Xcode - develop for iOS and macOS (Xcode 14.2) [βœ“] Chrome - develop for the web [βœ“] Android Studio (version 2021.3) [βœ“] IntelliJ IDEA Community Edition (version 2022.3.2) [βœ“] VS Code (version 1.74.2) [βœ“] Connected device (3 available) [βœ“] HTTP Host Availability

Additional context
Missing ios folder

[BUG] [iOS] Quill Editor's Keyboard Theme Does Not Change As Expected

Describe the bug
When the app theme becomes the dark theme, the quill editor's keyboard still stays as the Light theme on iOS.

As you can see on the screenshot, although the theme is set as Dark Theme, Quill Editor's keyboard stays as Light theme:
Theme of iOS

YOU CAN TEST IT BY USING THIS CODE:

import 'package:flutter/material.dart';
import 'package:quill_html_editor/quill_html_editor.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MaterialApp(debugShowCheckedModeBanner: false, home: MyApp()));
}

const Color quillWidgetsBackColor = Color.fromARGB(255, 122, 160, 194);
const Color buttonColors = Color.fromARGB(255, 40, 98, 150);
const double buttonHeights = 50;
const Color iconColors = Colors.white;
const TextStyle textStyle = TextStyle(color: Colors.white, fontSize: 18);

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final QuillEditorController controller = QuillEditorController();

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark(), //-----------------------------> MODIFY HERE TO CHANGE THE THEME
      themeMode: ThemeMode.dark,
      home: Scaffold(
        resizeToAvoidBottomInset: true,
        bottomNavigationBar: AdvancedQuillToolbar(quillEditorController: controller),
        body: Container(
          padding: const EdgeInsets.all(20),
          height: MediaQuery.of(context).size.height,
          child: ListView(
            children: [
              AdvancedQuillEditor(quillEditorController: controller),
              const SizedBox(height: 16),
              const TextField(
                decoration: InputDecoration(
                  hintText: 'This is the hint text of the text field',
                  enabledBorder: OutlineInputBorder(
                    borderSide: BorderSide(width: 3, color: buttonColors),
                  ),
                  focusedBorder: OutlineInputBorder(
                    borderSide: BorderSide(width: 3, color: buttonColors),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

@immutable
class AdvancedQuillToolbar extends StatelessWidget {
  const AdvancedQuillToolbar({
    super.key,
    required this.quillEditorController,
  });

  final QuillEditorController quillEditorController;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: MediaQuery.of(context).viewInsets,
      child: ToolBar(
        controller: quillEditorController,
        padding: const EdgeInsets.all(5),
        toolBarColor: quillWidgetsBackColor,
        activeIconColor: iconColors,
        iconColor: iconColors,
      ),
    );
  }
}

@immutable
class AdvancedQuillEditor extends StatelessWidget {
  const AdvancedQuillEditor({
    super.key,
    required this.quillEditorController,
  });

  final QuillEditorController quillEditorController;

  @override
  Widget build(BuildContext context) {
    return QuillHtmlEditor(
      controller: quillEditorController,
      backgroundColor: quillWidgetsBackColor,
      minHeight: 1,
      hintTextAlign: TextAlign.start,
      hintText: 'This is the hint text of the quill editor',
      textStyle: textStyle,
      hintTextStyle: textStyle,
      padding: const EdgeInsets.all(5),
      hintTextPadding: const EdgeInsets.all(5),
    );
  }
}

Smartphone (please complete the following information):

  • Device: iPhone 14 Pro Max (iOS 16.2)

Flutter Doctor
Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 3.7.9, on macOS 13.0 22A380 darwin-arm64, locale en-TR)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[βœ“] Xcode - develop for iOS and macOS (Xcode 14.2)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2022.1)
[βœ“] IntelliJ IDEA Community Edition (version 2022.2.2)
[βœ“] VS Code (version 1.77.0)
[βœ“] Connected device (3 available)
[βœ“] HTTP Host Availability

β€’ No issues found!

[FEATURE]

Great assistance with this bundle, to start with.
I have one request: please include a function that prevents keyboard input when editing rather than typing. It will be really beneficial.
Said that the keyboard was closed when in editing mode.
And one more thing: Can we add a custom toolbar option for text selection that returns both html and plain text?

2.0.7 not building with null safety

I get the following error when trying to build the latest version:

Error: Method 'insert' cannot be called on 'OverlayState?' because it is potentially null.

FIX:

el_tooltip.dart line 150:

  if (_overlayEntryHidden != null) {
     overlayStateHidden?.insert(_overlayEntryHidden!); // need the ? operator here
   }

[FEATURE] Horizontally Scrollable Toolbar Support

I tried to force Toolbar to have only one line and all the elements in the Toolbar can be scrolled left and right direction in one line.

I tried something like this:

        SingleChildScrollView(
          physics: const AlwaysScrollableScrollPhysics(
            parent: BouncingScrollPhysics(),
          ),
          scrollDirection: Axis.horizontal,
          child: ToolBar(
            direction: Axis.horizontal,
            ........

It seems the toolbar has infinite width.

That's why after scrolling a while, the Toolbar looks like an empty space.

I would really appreciate it if you could add this as a feature.πŸ˜„

Other than that, I really love your work❀️ . Keep it up!πŸ”₯

onChange Event

Hey @the-airbender,

Sorry if this is a silly question, but I can't find any events that I can listen to, to let me know when the html has changed. There's no onchange for the QuillHtmlEditor control, and there's no listeners on the controller. I couldn't see it in the examples either.

Change text color editor

It would be nice if we could set the color of the text inside the editor in order to support dark mode. I added an example of how it could work (second screenshot)

2023-02-05T16:40:49,690130662+06:30
2023-02-05T16:42:09,313597129+06:30

Thanks for your consideration @the-airbender

[BUG] Working with focus is not possible

Describe the bug
I have a QuillHtmlEditor widget and want the send button to change its color when the focus of the editor changes.

I have tried it in two ways:

  • Using the onFocusChanged argument of the widget and thus reacting on it to change
  • Using the hasFocus method which is defined on the controller

Both of the variants don't seem to work.

  • onFocusChanged is triggered when the editor is created and instantly gives true although the editor is not focused.
  • hasFocus returns 0 initially and then always null

In the second variant I used it like this:

FutureBuilder<int>(
  future: _textEditingController.hasFocus(),
  builder: (BuildContext context, AsyncSnapshot<int> snapshot) {
    return Icon(
      Icons.send,
      color: snapshot.data == null ? Colors.black45: Theme.of(context).primaryColor,
    );
  },
);

I was able to reproduce this on a physical iPhone X and an Android emulator. Haven't tried with a physical Android device.

It's also possible that I misinterpret the intended way to work with focus in this package.

Maybe it should be possible to work with a FocusNode, Flutter's built-in mechanism for these kinds of issues.

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 3.7.3, on macOS 13.1 22C65 darwin-arm64, locale
    en-DE)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[βœ“] Xcode - develop for iOS and macOS (Xcode 14.2)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2021.3)
[βœ“] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
[βœ“] Connected device (5 available)
[βœ“] HTTP Host Availability

[BUG] Output of getText cuts off part of the string if it's too long

if you set the initial Text with a long html string and then proceed to call getText, the output always cuts off part of the string

Steps to reproduce the behavior:

  1. set initial value with a long html string
  2. Call getText to get the html string output
    The expected output should be the full html string

platform: Android

Access to 'editor current height' info [FEATURE]

Is your feature request related to a problem? Please describe.
In order to dynamically set the height of the html editor (and widgets surrounding them), it would be great to have access to the current height of the html text. I see that this info is available in the text variable, but I can't really access it.
2023-03-15T08:57:15,955392281+06:30

Describe the solution you'd like
I would like to use the text variable onTextChange, and then use setState to update the height of the widgets. Something like this.

A clear and concise description of what you want to happen.
2023-03-15T09:16:43,715820152+06:30
2023-03-15T09:16:31,476992969+06:30

Describe alternatives you've considered
I have tried to split the current text variable to see if I can access the 'editor current height' portion, but I am unable to (maybe I am doing something wrong).

Additional context
Thanks for considering.

[BUG] Native HTML background is showing when keyboard appears.

On iOS, a white background is shown behind the editor when the keyboard opens.
See video

RPReplay_Final1676298126.MP4

Reproduction code:

    return Scaffold(
      backgroundColor: Colors.red,
      appBar: AppBar(
        title: const Text('Compose'),
      ),
      body: Stack(
        children: [
          ListView(
            children: [
              QuillHtmlEditor(
                hintText: 'New message',
                controller: controller,
                height: 400,
                defaultFontSize: 14,
                isEnabled: true,
                backgroundColor: Colors.red,
              ),
            ],
          ),
        ],
      ),
    );

[BUG] getText() returns empty string if QuillEditor contains only <img> or <iframe> tags

If the Quill editor has only image tags or iframe tags, getText() method returns an empty string.
I'd like the get ALL the HTML contents in the QuillEditorController at once.

STEPS TO PRODUCE THE BEHAVIOR:

  1. Click on 'insert img' button
  2. Then, click on 'print html text value on console' button.
  3. You will see that getText() returns empty string, even though there is an image in the editor.
  4. Click on 'insert iframe' button
  5. Then, click on 'print html text value on console' button.
  6. You will see that getText() returns empty string, even though there is an image and video link in the editor.

CODE (YOU CAN COPY PASTE THIS CODE TO TEST IT):

import 'package:flutter/material.dart';
import 'package:quill_html_editor/quill_html_editor.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MaterialApp(debugShowCheckedModeBanner: false, home: MyApp()));
}

const Color quillWidgetsBackColor = Color.fromARGB(255, 122, 160, 194);
const Color buttonColors = Color.fromARGB(255, 40, 98, 150);
const Color backgroundColor = Color.fromARGB(255, 38, 65, 88);
const double buttonHeights = 50;
const Color iconColors = Colors.white;
const TextStyle textStyle = TextStyle(color: Colors.white, fontSize: 18);

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final QuillEditorController controller = QuillEditorController();

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        resizeToAvoidBottomInset: true,
        bottomNavigationBar: AdvancedQuillToolbar(quillEditorController: controller),
        body: Container(
          padding: const EdgeInsets.all(20),
          color: backgroundColor,
          height: MediaQuery.of(context).size.height,
          child: ListView(
            children: [
              AdvancedQuillEditor(quillEditorController: controller),
              const SizedBox(height: 16),
              _insertImageButton(),
              const SizedBox(height: 16),
              _insertVideoLinkButton(),
              const SizedBox(height: 16),
              _printHtmlEditorTextInConsole(),
            ],
          ),
        ),
      ),
    );
  }

  Widget _insertImageButton() {
    return Container(
      height: buttonHeights,
      color: buttonColors,
      child: TextButton(
        child: const Text('insert img', style: textStyle),
        onPressed: () async => await controller.insertText(
          '<img src="https://www.w3schools.com/images/w3schools_green.jpg" alt="W3Schools.com">',
        ),
      ),
    );
  }

  Widget _insertVideoLinkButton() {
    return Container(
      height: buttonHeights,
      color: buttonColors,
      child: TextButton(
        child: const Text('insert iframe', style: textStyle),
        onPressed: () async => await controller.insertText(
          '<iframe src="https://www.youtube.com/embed/JCDfh5bs1xc" width="100%" height="315"</iframe>',
        ),
      ),
    );
  }

  Widget _printHtmlEditorTextInConsole() {
    return Container(
      height: buttonHeights,
      color: buttonColors,
      child: TextButton(
        child: const Text('print html text value on console', style: textStyle),
        onPressed: () async => debugPrint(await controller.getText()),
      ),
    );
  }
}

@immutable
class AdvancedQuillToolbar extends StatelessWidget {
  const AdvancedQuillToolbar({
    super.key,
    required this.quillEditorController,
  });

  final QuillEditorController quillEditorController;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: MediaQuery.of(context).viewInsets,
      child: ToolBar(
        controller: quillEditorController,
        padding: const EdgeInsets.all(5),
        toolBarColor: quillWidgetsBackColor,
        activeIconColor: iconColors,
        iconColor: iconColors,
      ),
    );
  }
}

@immutable
class AdvancedQuillEditor extends StatelessWidget {
  const AdvancedQuillEditor({
    super.key,
    required this.quillEditorController,
  });

  final QuillEditorController quillEditorController;

  @override
  Widget build(BuildContext context) {
    return QuillHtmlEditor(
      controller: quillEditorController,
      backgroundColor: quillWidgetsBackColor,
      minHeight: 1,
      hintTextAlign: TextAlign.start,
      hintText: 'This is the hint text of the quill editor',
      textStyle: textStyle,
      hintTextStyle: textStyle,
      padding: const EdgeInsets.all(5),
    );
  }
}

EXPECTED BEHAVIOR:
getText() should have brought all the html content in the QuillEditor.

DEVICES:
iPhone 14 Pro Max (iOS 16.2)
4.7 WXGA (Android API 32)

FLUTTER DOCTOR:
Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 3.7.8, on macOS 13.0 22A380 darwin-arm64, locale en-TR)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[βœ“] Xcode - develop for iOS and macOS (Xcode 14.2)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2022.1)
[βœ“] IntelliJ IDEA Community Edition (version 2022.2.2)
[βœ“] VS Code (version 1.76.2)
[βœ“] Connected device (3 available)
[βœ“] HTTP Host Availability

β€’ No issues found!

Editor autofocus property

Would it be possible to include an autofocus property?

My use case is to allow users to edit snippets of text and it would be more intuituve if the keyboard appeared immediately.

I'm just starting to use this plugin and loving it - so much better that the alternatives.

Thanks for your time putitng this together!

Method 'insert' cannot be called on 'OverlayState?' because it is potentially null.

Hi @the-airbender

I am using version 2.05 and I am getting the below error:

../../../../../.pub-cache/hosted/pub.dartlang.org/quill_html_editor-2.0.5/lib/src/widgets/el_tooltip/el_tooltip.dart:144:24: Error: Method 'insert' cannot be called on 'OverlayState?' because it is potentially null.
 - 'OverlayState' is from 'package:flutter/src/widgets/overlay.dart' ('../../../../flutter/packages/flutter/lib/src/widgets/overlay.dart').
Try calling using ?. instead.
    overlayStateHidden.insert(_overlayEntryHidden!);
                       ^^^^^^

I am wondering though why no one else has this error, but the the code is clear:

void _loadHiddenOverlay(_) {
    OverlayState? overlayStateHidden = Overlay.of(context); // the OverlayState is nullable
    _overlayEntryHidden = OverlayEntry(
      builder: (context) {
        WidgetsBinding.instance
            .addPostFrameCallback((_) => _getHiddenOverlaySize(context));
        return Opacity(
          opacity: 0,
          child: Center(
            child: Bubble(
              key: _widgetKey,
              triggerBox: _triggerBox,
              padding: widget.padding,
              child: widget.content,
            ),
          ),
        );
      },
    );
    overlayStateHidden.insert(_overlayEntryHidden!); // and her is called without `.?`
  }

Or I miss something?

Thanks

[BUG] Text capitalization for new sentences not working on iOS

Describe the bug

When pressing return in the editor, the keyboard should return to uppercase mode as a new sentence is about to start. This works nicely on Android, but not on iOS.

To Reproduce
Steps to reproduce the behavior:

  1. Run editor on iPhone.
  2. Type some content followed by a new line / return.

Expected behavior
The keyboard should switch to caps as we're starting a new sentence.

Smartphone (please complete the following information):

  • Device: [e.g. iPhone SE and 14]
  • OS: [e.g. iOS 15.x-16.x]

Flutter Doctor
`
Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 3.3.9, on macOS 13.0.1 22A400 darwin-arm, locale en-GB)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[βœ“] Xcode - develop for iOS and macOS (Xcode 14.1)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2022.1)
[βœ“] IntelliJ IDEA Ultimate Edition (version 2022.1)
[βœ“] VS Code (version 1.76.0)
[βœ“] Connected device (4 available)
! Device emulator-5554 is offline.
[βœ“] HTTP Host Availability

β€’ No issues found!
`

[BUG] Black screen the first time the widget is rendered

Describe the bug
Every first time that you want to show quill_html_editor there's a black screen instead of editor, this visual bug is showed only the first time.

To Reproduce
Steps to reproduce the behavior:

  1. Run example app
  2. After the page is created, review the first frames of the widget.

Expected behavior
The widget should be shown as expected with no black colors.

Screenshots
With custom Wrap Alignment

Smartphone (please complete the following information):

  • Device: iPhone 14 pro
  • OS: iOS16.3.1

Flutter Doctor
[βœ“] Flutter (Channel stable, 3.7.7, on macOS 13.1 22C65 darwin-arm64, locale en-MX) [βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.1) [βœ“] Xcode - develop for iOS and macOS (Xcode 14.2) [βœ“] Chrome - develop for the web [βœ“] Android Studio (version 2021.3) [βœ“] IntelliJ IDEA Community Edition (version 2022.3.2) [βœ“] VS Code (version 1.74.2) [βœ“] Connected device (3 available) [βœ“] HTTP Host Availability

[BUG] Multiple widgets used the same GlobalKey

I simply put two editors in a scaffold and the error appears. For reproduction I created a skeleton of my app screen.

By the way, a lot of messages saying 'updateAcquireFence: Did not find frame.' appear in the terminal.

To Reproduce

import 'package:flutter/material.dart';
import '../screens/dashboard.dart';
import 'package:quill_html_editor/quill_html_editor.dart';

class Test extends StatefulWidget {
  const Test({Key? key}) : super(key: key);

  @override
  State<Test> createState() => _TestState();
}

class _TestState extends State<Test> {
  final _cNewComment = QuillEditorController(),
      _cDescription = QuillEditorController();

  @override
  void dispose() {
    _cNewComment.dispose();
    _cDescription.dispose();

    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: ListView(
        children: [
          ElevatedButton(
            onPressed: () {
              Navigator.push(
                context,
                MaterialPageRoute(builder: (context) => Dashboard()),
              );
            },
            child: const Text('back'),
          ),
          ToolBar(
            controller: _cDescription,
          ),
          QuillHtmlEditor(
            controller: _cDescription,
            minHeight: 200,
          ),
          ToolBar(
            controller: _cNewComment,
          ),
          QuillHtmlEditor(
            controller: _cNewComment,
            minHeight: 200,
          ),
        ],
      ),
    );
  }
}

Desktop:

  • OS: iOS

Smartphone:

  • Device: MI 10T Lite
  • OS: Android 12

Flutter Doctor
[βœ“] Flutter (Channel stable, 3.7.8, on macOS 13.2.1 22D68 darwin-arm64, locale en-DE)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[βœ“] Xcode - develop for iOS and macOS (Xcode 14.2)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2022.1)
[βœ“] VS Code (version 1.76.0)
[βœ“] Connected device (3 available)
[βœ“] HTTP Host Availability

β€’ No issues found!

[BUG] Mobile Web - Clicking on toolbar icon does not toggle highlight color, and keyboard loses focus

Describe the bug
When using this package on mobile web. (i.e. flutter web site, accessed on mobile web). If I click on a toolbar icon, the icon doesn't immediately turn to the activecolor, I have to start typing and then it will toggle to the correct state.

Also, if I click on the toolbar icon, it will cause my keyboard to go away.

To Reproduce
Steps to reproduce the behavior:

  1. Go to demo website using Chrome or Safari on ios
  2. Click on bold toolbar icon

Expected behavior
When a toolbar icon is clicked, it should immediately toggle active color.

WhatsApp.Video.2023-03-19.at.23.11.11.mp4

Inserting Images

Hi, thank you for working on this. It is amazing to finally have a simple HTML editor. Can you tell me if it is possible to insert images?

[BUG] Setting the background color to transparent results in black background

Describe the bug
When I set the property backgroundColor property of QuillHtmlEditor to Colors.transparent, because I might want it to have the background color of the underlying Widget, it displays the editor with a black background color instead of a transparent one.

I was able to reproduce this on:

  • iPhone with iOS 16.2
  • iOS Simulator
  • Android simulator

When I rendered the content of the _getQuillPage() function into a local HTML file without the Flutter variables and callbacks, it is displayed with a transparent background which leads me to the conclusion that it's either caused by webviewx or webview_flutter.

Screenshots

Screenshot 2023-03-09 at 14 15 29

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 3.7.3, on macOS 13.1 22C65 darwin-arm64, locale
    en-DE)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[βœ“] Xcode - develop for iOS and macOS (Xcode 14.2)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2021.3)
[βœ“] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
[βœ“] Connected device (5 available)
[βœ“] HTTP Host Availability

β€’ No issues found!

Additional context
In general, it might be a good idea to switch to flutter_inappwebview as flutterx is not maintained anymore and we will not expect any fixes, I guess.

Callback to know if the editor is focus or not

Hello :)

I would like to toggle the Toolbar when the user clicks on the QuillHtmlEditor.
Currently, the only way I see of getting the focus is using controller.hasFocus. I would like to have a callback directly on the QuillHtmlEditor or to listen to the controller state to change my UI depending on the editor's focus.

Thanks for your editor :)

Pasting text into the editor throws a javascript error, and prevents onchange from firing

Hey @the-airbender ,

When I use copy/paste in the quill editor, the paste causes the following error to throw. This stops your onChange event from firing, so pasted changes are not saved.

TypeError: Cannot read properties of null (reading 'index') about:srcdoc 137:39 <fn> https://cdn.quilljs.com/1.3.6/quill.js 8598:27 emit https://cdn.quilljs.com/1.3.6/quill.js 1893:99 emit https://cdn.quilljs.com/1.3.6/quill.js 1624:36 modify https://cdn.quilljs.com/1.3.6/quill.js 1513:21 updateContents https://cdn.quilljs.com/1.3.6/quill.js 8922:22 <fn>

[FEATURE] Implement QuillEditorController.getDelta

Is your feature request related to a problem? Please describe.
The webview causes a little bit of lag, which is a problem for when I want it to be read-only. For example when one of multiple tab_bar views.

I see that delta is the underlying data format for quill.js, so if this package could export it using the controller, that would make it compatible with other packages like flutter_quill, and I can use their non-webview solution for rendering quill deltas.

Describe the solution you'd like
implement getDelta method to QuillEditorController that would convert the html string to Delta format.

Describe alternatives you've considered
I tried finding a way on my own to convert html to delta but can't find anything.

Pngs of Toolbar not working

Firstly, amazing job on the library. I have been looking for a quill editor which has support for flutter web. Integrating it was smooth as well. I, however ran into this issue. While integrating the default toolbar, it is looking for the PNG images of certain icons at a path where the images are not present and hence, it breaks the UI, here is a screenshot

image

Solution to this could be loading images over network instead of a local folder. Alternatively, giving functionality to add custom images/icon for buttons might help users override these icons themselves.

Do let me know your thoughts on this. Thanks

[FEATURE] Add Wrap Alignment inside Toolbar

By Default, when we have a row of actions, Wrap alignment is always in: WrapAlignment.start,
With hardcoded Wrap Alignment

By creating this parameter to be user editable gives the freedom to be dynamic with any design.
With custom Wrap Alignment

Can you add some examples for the custom buttons

My current task to solve is:
I would like to add some Text at the cursor position when a custom button is pressed.

I'm not sure if this is possible.

By having some examples of for instance:
Get the selected Text or output some text at the cursor this could help others with this question as well.

Control over padding and font

Hey @the-airbender

Just a feature request that will be easy when you have time...being able to control padding and textstyle in the editor.

You can see when I put it in my form, it doesn't match my other fields very well. The padding is way bigger, and font is smaller than my other form fields... Thank you!!

image

[BUG] cursor won't go down.

when you type on the editor on android and press enter the cursor wont go down.. unless you add space after a word then press enter the cursor will go down.
example

wrote something[PRESSENTERHERE] <------ The cursor won't go down.

wrote something [PRESSENTERHERE] <-------- The cursor go down as excepted.

auto align

Hello, I want it to go to the left when the text is in English, and automatically to the right if the text is persian

[BUG] There is always a padding when displaying content inside the editor (Hint text padding)

Describe the bug
It doesn't matter which HTML content I render, it can even be a plain text, the editor always displays a padding of 8 pixels around the content. Needless to say, I didn't fiddle with the padding parameter of QuillHtmlEditor which makes it default to EdgeInsets.zero.
My assumptions is that it's due to user agent style of the browser within the WebView, which often sets a margin of 8 px to the body tag but I could be wrong.

I checked this both on Android and iOS simulator and on a real iPhone (X with iOS 16.2)

Screenshots

Screenshot 2023-03-09 at 14 19 32

Flutter Doctor

Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 3.7.3, on macOS 13.1 22C65 darwin-arm64, locale en-DE)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[βœ“] Xcode - develop for iOS and macOS (Xcode 14.2)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2021.3)
[βœ“] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
[βœ“] Connected device (5 available)
[βœ“] HTTP Host Availability

Additional context
If the user agent style is really responsible for this, we should have the possibility to style HTML tags by providing a style map to the quill editor widget.

[FEATURE] Can we bundle the quill package into Flutter package?

Hello. First of all: thanks a lot for creating the only rich text editor for Flutter that actually works with HTML input and output. Although this is "just" mostly a WebView component that renders the JS plugin, this is of incredible value!!

The problem:

Right now, the quill JS lib is being fetched via CDN by the following lines

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/quill/2.0.0-dev.4/quill.snow.min.css" />
  <!-- Include the Quill library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/quill/2.0.0-dev.4/quill.min.js"></script>

This creates several issues:

  • Without internet connection, the package won't display anything
  • Everytime the QuillHtmlEditor widget ist being rendered, it will cause network traffic (only about 80 kb, but still)
  • During rendering, there is a short delay which would accumulate if there were several QuillHtmlEditors being displayed on a page. This is actually not that unlikely if I used the editor to only display HTML exactly like the editor

Would it be possible to bundle the minified JS and CSS along with the package and inject it as an inline JS and CSS where now the external URL is being referenced?

[BUG] Toolbar.color, Toolbar.size and Toolbar.background Properties Have Overflow Problem

When the toolbar is set as the bottomNavigationBar of the scaffold, the Toolbar.color, Toolbar.size and Toolbar.background properties overflow the screen.

Simulator Screen Shot - iPhone 14 Pro Max - 2023-04-03 at 20 24 49

Simulator Screen Shot - iPhone 14 Pro Max - 2023-04-03 at 20 24 25

Simulator Screen Shot - iPhone 14 Pro Max - 2023-04-03 at 20 24 19

You can test it by using this code:

import 'package:flutter/material.dart';
import 'package:quill_html_editor/quill_html_editor.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MaterialApp(debugShowCheckedModeBanner: false, home: MyApp()));
}

const Color quillWidgetsBackColor = Color.fromARGB(255, 122, 160, 194);
const Color buttonColors = Color.fromARGB(255, 40, 98, 150);
const double buttonHeights = 50;
const Color iconColors = Colors.white;
const TextStyle textStyle = TextStyle(color: Colors.white, fontSize: 18);

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final QuillEditorController controller = QuillEditorController();

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.dark(),
      themeMode: ThemeMode.light,
      home: Scaffold(
        resizeToAvoidBottomInset: true,
        bottomNavigationBar: AdvancedQuillToolbar(quillEditorController: controller),
        body: Container(
          padding: const EdgeInsets.all(20),
          height: MediaQuery.of(context).size.height,
          child: ListView(
            children: [
              AdvancedQuillEditor(quillEditorController: controller),
            ],
          ),
        ),
      ),
    );
  }
}

@immutable
class AdvancedQuillToolbar extends StatelessWidget {
  const AdvancedQuillToolbar({
    super.key,
    required this.quillEditorController,
  });

  final QuillEditorController quillEditorController;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: MediaQuery.of(context).viewInsets,
      child: ToolBar(
        controller: quillEditorController,
        padding: const EdgeInsets.all(5),
        toolBarColor: quillWidgetsBackColor,
        activeIconColor: iconColors,
        iconColor: iconColors,
        toolBarConfig: const [
          ToolBarStyle.color,
          ToolBarStyle.size,
          ToolBarStyle.background,
        ],
      ),
    );
  }
}

@immutable
class AdvancedQuillEditor extends StatelessWidget {
  const AdvancedQuillEditor({
    super.key,
    required this.quillEditorController,
  });

  final QuillEditorController quillEditorController;

  @override
  Widget build(BuildContext context) {
    return QuillHtmlEditor(
      controller: quillEditorController,
      backgroundColor: quillWidgetsBackColor,
      minHeight: 1,
      hintTextAlign: TextAlign.start,
      hintText: 'This is the hint text of the quill editor',
      textStyle: textStyle,
      hintTextStyle: textStyle,
      padding: const EdgeInsets.all(5),
      hintTextPadding: const EdgeInsets.all(5),
    );
  }
}

Smartphone:

  • iPhone 14 Pro Max (iOS 16.2)
  • Pixel 6 Pro (Android API 33)

Flutter Doctor
Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 3.7.9, on macOS 13.0 22A380 darwin-arm64, locale en-TR)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[βœ“] Xcode - develop for iOS and macOS (Xcode 14.2)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2022.1)
[βœ“] IntelliJ IDEA Community Edition (version 2022.2.2)
[βœ“] VS Code (version 1.77.0)
[βœ“] Connected device (3 available)
[βœ“] HTTP Host Availability

β€’ No issues found!

[FEATURE] Using TTF icons instead of PNG files

Hey, I saw that the library is using PNG files for icons, I think we can save some space by adding them as a icons.ttf file.

And then we can use them as IconData:
IconData h1 = IconData(0xe380, fontFamily: _kIconFam);

[BUG] Text print prints even when onTextChange is uncommented

Describe the bug
Even when I uncomment the print onTextChanged, it still echo's in the dart debugger

To Reproduce
comment onTextChanged and look at the debugger on typing

Expected behavior
No echo

Screenshots
2023-03-15T08:57:15,955392281+06:30
2023-03-15T08:58:32,740066750+06:30
2023-03-15T09:03:20,842339891+06:30

Desktop (please complete the following information):

  • Arch Linux / Sway / Chromium

is it possible to get plain text instead of html text?

Thank you for the wonderful package.
As you might know, text editor on mobile browser has several issues.
But this one has not!

I am looking for a method to get plain text instead of html text.

When I type this:

This is a quill html editor example!

This is what I got by onTextChanged callback:

<p>This is a quill html editor example!</p>

What I need is the plain or raw text that I typed. Is it possible to get plain text?
I want to get the exact text that I type. For example, If I type <h2>this one allows inline html tag</h2>, I want to get the exact text which includes the html tag. So it will be <h2>this one allows inline html tag</h2>.

I really want this functionality. If not, any suggestion using this package?

Enhancement : Need method to replace the selected text

Hi @the-airbender,

I am having 2 problems with getSelectionRange....

  1. The return value is cast as dynamic but it returns a String of the range object, rather than a map, which is very difficult to parse, as you cannot even run json.decode on it due to not having quotation marks.
  2. the index is returned from getSelectionRange is based on the visible text, but ignores any html, so you can't use it, because getText includes html.

For example: if I use getText() which returns 12345, and then I select the number 2 in the editor, and call getSelectionRange, it returns an index of 1. It should return an index of 4 (ie include the html). Otherwise there is no way of being able to control where you inject text.

What I'm trying to achieve is to have a button that inserts a merge field eg '[first_name]' where the cursor is. I'm using the dart replaceRange function, but it's replacing the wrong section of text because the index is out.

Does this make sense? Thanks! Matt

[BUG] Toolbar Throws setState() called after dispose() Exception

When I make the toolbar visible/invisible according to its focus on the quill editor,
sometimes it throws an exception like this:

════════ Exception caught by gesture ═══════════════════════════════════════════
The following assertion was thrown while handling a gesture:
setState() called after dispose(): ToolBarState#cadfb(lifecycle state: defunct, not mounted)

THE EXCEPTION IS THROWN IN HERE:
Source code: tool_bar.dart
method: _getFontColorWidget
function call: setState()

SUGGESTION:
I think making the widget mounted check before calling setState would solve the problem:

if (mounted) {
  setState(() {  });
}

Also, making the mounted check everywhere in the source codes (both quill toolbar and quill editor codes) could prevent unexpected setState issues in the future.

HOW TO PRODUCE:

  1. Use the toolbar as bottomNavigationBar in Scaffold
  2. if the quill editor is focused, make the toolbar visible. Otherwise, make the toolbar invisible.
  3. After a few try later, you should see the exception

DEVICES:
iPhone 14 Pro Max (iOS 16.2)
Android WXGA API 32

FLUTTER DOCTOR:
Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 3.7.8, on macOS 13.0 22A380 darwin-arm64, locale en-TR)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[βœ“] Xcode - develop for iOS and macOS (Xcode 14.2)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2022.1)
[βœ“] IntelliJ IDEA Community Edition (version 2022.2.2)
[βœ“] VS Code (version 1.76.2)
[βœ“] Connected device (3 available)
[βœ“] HTTP Host Availability

Thank you in advance!

Long-term support project?

I'd like to integrate this library into our project, so would this project be supported for long term?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.