Rich text editor for Flutter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
4.9 KiB

Merge master into dev (#258) * Update issue templates * Updating checkbox to handle tap (#186) * updating checkbox to handle tap * updating checkbox to handle long press and using UniqueKey() to avoid weird side effects * removed useless doc Co-authored-by: Kevin Despoulains <kevin.despoulains@scriptandgo.com> * Simple viewer (#187) * 2021-04-25 * 2021-04-26 * Fix simple viewer compilation error * Upgrade version - checkbox supports tapping * 171: support for non-scrollable text editor (#188) Co-authored-by: Gyuri Majercsik <gyuri@fluttech.com> * custom rules & optionally auto add newline for image embeds (#205) * Adding missing overrides to make package work with Flutter 2.2.0 (#226) * Improve SOC of raw editor (#227) Improve separation of concerns for RawEditor by moving the code for the text input client to a separate class, furthermore add more comments. * Upgrade version * Improve SOC of raw editor (#228) Improve separation of concerns for `RawEditor` by moving the code for the keyboard to a separate class, furthermore add more comments. The PR does not change the functionality of the code. * Improve further SOC of raw editor This improves separation of concerns for the RawEditor by moving the code for the text selection delegate to a separate class, furthermore add more comments. The PR does not change the functionality of the code. * Hide implementation files (#233) * Fixes for flutter web (#234) * Fix for Attribute object comparison * Fix for "Unexpected null value" error on web Clipboard is now supported on web, via a permission request through the browser Co-authored-by: George Johnson <george@indiespring.com> * Dispose ValueNotifier of cursor controller * Remove getter for final operator A getter for a final variable makes no sense, because the variable cannot be reassigned. It is better to remove the unnecessary getter and make the variable public. * Add comments to cursor class * Remove null exception when a disposed controller is set * Disallow lines longer than 80 characters * Don't create a lambda when a tear-off will do * Move ResponsiveWidgets to example folder This widget has nothing to do with the library and is only used in the example, so it is moved to the example. * Fix null exception * Remove exception when widget is not mounted * Fix exception when rect is not a number * Fix paste (#236) closes #235. * Fix exception * Add const types for image and divider embeds This allows to reference the type. * Fix relative path * Add new logo * Fix buttons which ignore toolbariconsize Closes #189. * Upgrade to 1.3.1 * Fix incorrect double to int cast, and guard against optional parent (#239) * use ceil instead of floor to make sure won't cause overflow * Fix example project Podfile (#241) * Show arrow indicator on toolbar (#245) * Add color parameter to Toolbar and ImageButton In addition, change these widgets to stateless widgets, since these widgets do not have a state and thus stateful is superfluous. * Fix paste bug * Remove extraneous toolbar dividers in certain configuration Closes #193. * Upgrade version to 1.3.2 * Format code * Bump file_picker to 3.0.2+2 With version 3.0.2 `name` of the file_picker library becomes non-nullable, so a warning was issued for users who had already used version 3.0.2, as we still assumed that `name` is nullable. Increasing the version and removing the exclamation mark removes the warning. * Fix a bug that Embed could be together with Text (#249) * Fix #242 (#254) * Upgrade to 1.3.3 * Format code * bugfix:The return type 'bool' isn't a 'KeyEventResult' Co-authored-by: Xin Yao <singerdmx@gmail.com> Co-authored-by: kevinDespoulains <46108869+kevinDespoulains@users.noreply.github.com> Co-authored-by: Kevin Despoulains <kevin.despoulains@scriptandgo.com> Co-authored-by: em6m6e <50019687+em6m6e@users.noreply.github.com> Co-authored-by: Gyuri Majercsik <majercsik.gyuri@gmail.com> Co-authored-by: Gyuri Majercsik <gyuri@fluttech.com> Co-authored-by: hyouuu <hyouuu@gmail.com> Co-authored-by: Till Friebe <friebetill@gmail.com> Co-authored-by: George <george.a.johnson@btopenworld.com> Co-authored-by: George Johnson <george@indiespring.com> Co-authored-by: Ben Chung <1330575+yzxben@users.noreply.github.com> Co-authored-by: lucasbstn <64323294+lucasbstn@users.noreply.github.com>
4 years ago
<p align="center">
<img src="https://user-images.githubusercontent.com/10923085/119221946-2de89000-baf2-11eb-8285-68168a78c658.png" width="600px">
</p>
<h1 align="center">A rich text editor for Flutter</h1>
[![MIT License][license-badge]][license-link]
[![PRs Welcome][prs-badge]][prs-link]
[![Watch on GitHub][github-watch-badge]][github-watch-link]
[![Star on GitHub][github-star-badge]][github-star-link]
[![Watch on GitHub][github-forks-badge]][github-forks-link]
[license-badge]: https://img.shields.io/github/license/singerdmx/flutter-quill.svg?style=for-the-badge
[license-link]: https://github.com/singerdmx/flutter-quill/blob/master/LICENSE
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
[prs-link]: https://github.com/singerdmx/flutter-quill/issues
[github-watch-badge]: https://img.shields.io/github/watchers/singerdmx/flutter-quill.svg?style=for-the-badge&logo=github&logoColor=ffffff
[github-watch-link]: https://github.com/singerdmx/flutter-quill/watchers
[github-star-badge]: https://img.shields.io/github/stars/singerdmx/flutter-quill.svg?style=for-the-badge&logo=github&logoColor=ffffff
[github-star-link]: https://github.com/singerdmx/flutter-quill/stargazers
[github-forks-badge]: https://img.shields.io/github/forks/singerdmx/flutter-quill.svg?style=for-the-badge&logo=github&logoColor=ffffff
[github-forks-link]: https://github.com/singerdmx/flutter-quill/network/members
FlutterQuill is a rich text editor and a [Quill] component for [Flutter].
5 years ago
4 years ago
This library is a WYSIWYG editor built for the modern mobile platform, with web compatibility under development. You can join our [Slack Group] for discussion.
4 years ago
4 years ago
Demo App: https://bulletjournal.us/home/index.html
Pub: https://pub.dev/packages/flutter_quill
4 years ago
Merge master into dev (#258) * Update issue templates * Updating checkbox to handle tap (#186) * updating checkbox to handle tap * updating checkbox to handle long press and using UniqueKey() to avoid weird side effects * removed useless doc Co-authored-by: Kevin Despoulains <kevin.despoulains@scriptandgo.com> * Simple viewer (#187) * 2021-04-25 * 2021-04-26 * Fix simple viewer compilation error * Upgrade version - checkbox supports tapping * 171: support for non-scrollable text editor (#188) Co-authored-by: Gyuri Majercsik <gyuri@fluttech.com> * custom rules & optionally auto add newline for image embeds (#205) * Adding missing overrides to make package work with Flutter 2.2.0 (#226) * Improve SOC of raw editor (#227) Improve separation of concerns for RawEditor by moving the code for the text input client to a separate class, furthermore add more comments. * Upgrade version * Improve SOC of raw editor (#228) Improve separation of concerns for `RawEditor` by moving the code for the keyboard to a separate class, furthermore add more comments. The PR does not change the functionality of the code. * Improve further SOC of raw editor This improves separation of concerns for the RawEditor by moving the code for the text selection delegate to a separate class, furthermore add more comments. The PR does not change the functionality of the code. * Hide implementation files (#233) * Fixes for flutter web (#234) * Fix for Attribute object comparison * Fix for "Unexpected null value" error on web Clipboard is now supported on web, via a permission request through the browser Co-authored-by: George Johnson <george@indiespring.com> * Dispose ValueNotifier of cursor controller * Remove getter for final operator A getter for a final variable makes no sense, because the variable cannot be reassigned. It is better to remove the unnecessary getter and make the variable public. * Add comments to cursor class * Remove null exception when a disposed controller is set * Disallow lines longer than 80 characters * Don't create a lambda when a tear-off will do * Move ResponsiveWidgets to example folder This widget has nothing to do with the library and is only used in the example, so it is moved to the example. * Fix null exception * Remove exception when widget is not mounted * Fix exception when rect is not a number * Fix paste (#236) closes #235. * Fix exception * Add const types for image and divider embeds This allows to reference the type. * Fix relative path * Add new logo * Fix buttons which ignore toolbariconsize Closes #189. * Upgrade to 1.3.1 * Fix incorrect double to int cast, and guard against optional parent (#239) * use ceil instead of floor to make sure won't cause overflow * Fix example project Podfile (#241) * Show arrow indicator on toolbar (#245) * Add color parameter to Toolbar and ImageButton In addition, change these widgets to stateless widgets, since these widgets do not have a state and thus stateful is superfluous. * Fix paste bug * Remove extraneous toolbar dividers in certain configuration Closes #193. * Upgrade version to 1.3.2 * Format code * Bump file_picker to 3.0.2+2 With version 3.0.2 `name` of the file_picker library becomes non-nullable, so a warning was issued for users who had already used version 3.0.2, as we still assumed that `name` is nullable. Increasing the version and removing the exclamation mark removes the warning. * Fix a bug that Embed could be together with Text (#249) * Fix #242 (#254) * Upgrade to 1.3.3 * Format code * bugfix:The return type 'bool' isn't a 'KeyEventResult' Co-authored-by: Xin Yao <singerdmx@gmail.com> Co-authored-by: kevinDespoulains <46108869+kevinDespoulains@users.noreply.github.com> Co-authored-by: Kevin Despoulains <kevin.despoulains@scriptandgo.com> Co-authored-by: em6m6e <50019687+em6m6e@users.noreply.github.com> Co-authored-by: Gyuri Majercsik <majercsik.gyuri@gmail.com> Co-authored-by: Gyuri Majercsik <gyuri@fluttech.com> Co-authored-by: hyouuu <hyouuu@gmail.com> Co-authored-by: Till Friebe <friebetill@gmail.com> Co-authored-by: George <george.a.johnson@btopenworld.com> Co-authored-by: George Johnson <george@indiespring.com> Co-authored-by: Ben Chung <1330575+yzxben@users.noreply.github.com> Co-authored-by: lucasbstn <64323294+lucasbstn@users.noreply.github.com>
4 years ago
## Usage
4 years ago
See the `example` directory for a minimal example of how to use FlutterQuill. You typically just need to instantiate a controller:
```
QuillController _controller = QuillController.basic();
```
and then embed the toolbar and the editor, within your app. For example:
```dart
Column(
children: [
4 years ago
QuillToolbar.basic(controller: _controller),
4 years ago
Expanded(
child: Container(
child: QuillEditor.basic(
controller: _controller,
readOnly: false, // true for view only mode
),
),
)
],
)
```
4 years ago
Check out [Sample Page] for advanced usage.
4 years ago
## Input / Output
4 years ago
This library uses [Quill] as an internal data format.
4 years ago
* Use `_controller.document.toDelta()` to extract the deltas.
* Use `_controller.document.toPlainText()` to extract plain text.
FlutterQuill provides some JSON serialisation support, so that you can save and open documents. To save a document as JSON, do something like the following:
```
var json = jsonEncode(_controller.document.toDelta().toJson());
```
You can then write this to storage.
To open a FlutterQuill editor with an existing JSON representation that you've previously stored, you can do something like this:
```
var myJSON = jsonDecode(incomingJSONText);
_controller = QuillController(
document: Document.fromJson(myJSON),
selection: TextSelection.collapsed(offset: 0));
```
## Configuration
4 years ago
The `QuillToolbar` class lets you customise which formatting options are available.
4 years ago
[Sample Page] provides sample code for advanced usage and configuration.
4 years ago
## Web
4 years ago
4 years ago
For web development, use `flutter config --enable-web` for flutter and use [ReactQuill] for React.
4 years ago
It is required to provide EmbedBuilder, e.g. [defaultEmbedBuilderWeb](https://github.com/singerdmx/flutter-quill/blob/master/example/lib/universal_ui/universal_ui.dart#L28).
4 years ago
## Migrate Zefyr Data
Check out [code](https://github.com/jwehrle/zefyr_quill_convert) and [doc](https://docs.google.com/document/d/1FUSrpbarHnilb7uDN5J5DDahaI0v1RMXBjj4fFSpSuY/edit?usp=sharing).
Merge master into dev (#258) * Update issue templates * Updating checkbox to handle tap (#186) * updating checkbox to handle tap * updating checkbox to handle long press and using UniqueKey() to avoid weird side effects * removed useless doc Co-authored-by: Kevin Despoulains <kevin.despoulains@scriptandgo.com> * Simple viewer (#187) * 2021-04-25 * 2021-04-26 * Fix simple viewer compilation error * Upgrade version - checkbox supports tapping * 171: support for non-scrollable text editor (#188) Co-authored-by: Gyuri Majercsik <gyuri@fluttech.com> * custom rules & optionally auto add newline for image embeds (#205) * Adding missing overrides to make package work with Flutter 2.2.0 (#226) * Improve SOC of raw editor (#227) Improve separation of concerns for RawEditor by moving the code for the text input client to a separate class, furthermore add more comments. * Upgrade version * Improve SOC of raw editor (#228) Improve separation of concerns for `RawEditor` by moving the code for the keyboard to a separate class, furthermore add more comments. The PR does not change the functionality of the code. * Improve further SOC of raw editor This improves separation of concerns for the RawEditor by moving the code for the text selection delegate to a separate class, furthermore add more comments. The PR does not change the functionality of the code. * Hide implementation files (#233) * Fixes for flutter web (#234) * Fix for Attribute object comparison * Fix for "Unexpected null value" error on web Clipboard is now supported on web, via a permission request through the browser Co-authored-by: George Johnson <george@indiespring.com> * Dispose ValueNotifier of cursor controller * Remove getter for final operator A getter for a final variable makes no sense, because the variable cannot be reassigned. It is better to remove the unnecessary getter and make the variable public. * Add comments to cursor class * Remove null exception when a disposed controller is set * Disallow lines longer than 80 characters * Don't create a lambda when a tear-off will do * Move ResponsiveWidgets to example folder This widget has nothing to do with the library and is only used in the example, so it is moved to the example. * Fix null exception * Remove exception when widget is not mounted * Fix exception when rect is not a number * Fix paste (#236) closes #235. * Fix exception * Add const types for image and divider embeds This allows to reference the type. * Fix relative path * Add new logo * Fix buttons which ignore toolbariconsize Closes #189. * Upgrade to 1.3.1 * Fix incorrect double to int cast, and guard against optional parent (#239) * use ceil instead of floor to make sure won't cause overflow * Fix example project Podfile (#241) * Show arrow indicator on toolbar (#245) * Add color parameter to Toolbar and ImageButton In addition, change these widgets to stateless widgets, since these widgets do not have a state and thus stateful is superfluous. * Fix paste bug * Remove extraneous toolbar dividers in certain configuration Closes #193. * Upgrade version to 1.3.2 * Format code * Bump file_picker to 3.0.2+2 With version 3.0.2 `name` of the file_picker library becomes non-nullable, so a warning was issued for users who had already used version 3.0.2, as we still assumed that `name` is nullable. Increasing the version and removing the exclamation mark removes the warning. * Fix a bug that Embed could be together with Text (#249) * Fix #242 (#254) * Upgrade to 1.3.3 * Format code * bugfix:The return type 'bool' isn't a 'KeyEventResult' Co-authored-by: Xin Yao <singerdmx@gmail.com> Co-authored-by: kevinDespoulains <46108869+kevinDespoulains@users.noreply.github.com> Co-authored-by: Kevin Despoulains <kevin.despoulains@scriptandgo.com> Co-authored-by: em6m6e <50019687+em6m6e@users.noreply.github.com> Co-authored-by: Gyuri Majercsik <majercsik.gyuri@gmail.com> Co-authored-by: Gyuri Majercsik <gyuri@fluttech.com> Co-authored-by: hyouuu <hyouuu@gmail.com> Co-authored-by: Till Friebe <friebetill@gmail.com> Co-authored-by: George <george.a.johnson@btopenworld.com> Co-authored-by: George Johnson <george@indiespring.com> Co-authored-by: Ben Chung <1330575+yzxben@users.noreply.github.com> Co-authored-by: lucasbstn <64323294+lucasbstn@users.noreply.github.com>
4 years ago
---
<p float="left">
<img width="400" alt="1" src="https://user-images.githubusercontent.com/122956/103142422-9bb19c80-46b7-11eb-83e4-dd0538a9236e.png">
<img width="400" alt="1" src="https://user-images.githubusercontent.com/122956/103142455-0531ab00-46b8-11eb-89f8-26a77de9227f.png">
</p>
<p float="left">
<img width="400" alt="1" src="https://user-images.githubusercontent.com/122956/102963021-f28f5a00-449c-11eb-8f5f-6e9dd60844c4.png">
<img width="400" alt="1" src="https://user-images.githubusercontent.com/122956/102977404-c9c88e00-44b7-11eb-9423-b68f3b30b0e0.png">
</p>
## Sponsors
<a href="https://bulletjournal.us/home/index.html">
<img src=
"https://user-images.githubusercontent.com/122956/72955931-ccc07900-3d52-11ea-89b1-d468a6e2aa2b.png"
width="150px" height="150px"></a>
4 years ago
[Quill]: https://quilljs.com/docs/formats
Merge master into dev (#258) * Update issue templates * Updating checkbox to handle tap (#186) * updating checkbox to handle tap * updating checkbox to handle long press and using UniqueKey() to avoid weird side effects * removed useless doc Co-authored-by: Kevin Despoulains <kevin.despoulains@scriptandgo.com> * Simple viewer (#187) * 2021-04-25 * 2021-04-26 * Fix simple viewer compilation error * Upgrade version - checkbox supports tapping * 171: support for non-scrollable text editor (#188) Co-authored-by: Gyuri Majercsik <gyuri@fluttech.com> * custom rules & optionally auto add newline for image embeds (#205) * Adding missing overrides to make package work with Flutter 2.2.0 (#226) * Improve SOC of raw editor (#227) Improve separation of concerns for RawEditor by moving the code for the text input client to a separate class, furthermore add more comments. * Upgrade version * Improve SOC of raw editor (#228) Improve separation of concerns for `RawEditor` by moving the code for the keyboard to a separate class, furthermore add more comments. The PR does not change the functionality of the code. * Improve further SOC of raw editor This improves separation of concerns for the RawEditor by moving the code for the text selection delegate to a separate class, furthermore add more comments. The PR does not change the functionality of the code. * Hide implementation files (#233) * Fixes for flutter web (#234) * Fix for Attribute object comparison * Fix for "Unexpected null value" error on web Clipboard is now supported on web, via a permission request through the browser Co-authored-by: George Johnson <george@indiespring.com> * Dispose ValueNotifier of cursor controller * Remove getter for final operator A getter for a final variable makes no sense, because the variable cannot be reassigned. It is better to remove the unnecessary getter and make the variable public. * Add comments to cursor class * Remove null exception when a disposed controller is set * Disallow lines longer than 80 characters * Don't create a lambda when a tear-off will do * Move ResponsiveWidgets to example folder This widget has nothing to do with the library and is only used in the example, so it is moved to the example. * Fix null exception * Remove exception when widget is not mounted * Fix exception when rect is not a number * Fix paste (#236) closes #235. * Fix exception * Add const types for image and divider embeds This allows to reference the type. * Fix relative path * Add new logo * Fix buttons which ignore toolbariconsize Closes #189. * Upgrade to 1.3.1 * Fix incorrect double to int cast, and guard against optional parent (#239) * use ceil instead of floor to make sure won't cause overflow * Fix example project Podfile (#241) * Show arrow indicator on toolbar (#245) * Add color parameter to Toolbar and ImageButton In addition, change these widgets to stateless widgets, since these widgets do not have a state and thus stateful is superfluous. * Fix paste bug * Remove extraneous toolbar dividers in certain configuration Closes #193. * Upgrade version to 1.3.2 * Format code * Bump file_picker to 3.0.2+2 With version 3.0.2 `name` of the file_picker library becomes non-nullable, so a warning was issued for users who had already used version 3.0.2, as we still assumed that `name` is nullable. Increasing the version and removing the exclamation mark removes the warning. * Fix a bug that Embed could be together with Text (#249) * Fix #242 (#254) * Upgrade to 1.3.3 * Format code * bugfix:The return type 'bool' isn't a 'KeyEventResult' Co-authored-by: Xin Yao <singerdmx@gmail.com> Co-authored-by: kevinDespoulains <46108869+kevinDespoulains@users.noreply.github.com> Co-authored-by: Kevin Despoulains <kevin.despoulains@scriptandgo.com> Co-authored-by: em6m6e <50019687+em6m6e@users.noreply.github.com> Co-authored-by: Gyuri Majercsik <majercsik.gyuri@gmail.com> Co-authored-by: Gyuri Majercsik <gyuri@fluttech.com> Co-authored-by: hyouuu <hyouuu@gmail.com> Co-authored-by: Till Friebe <friebetill@gmail.com> Co-authored-by: George <george.a.johnson@btopenworld.com> Co-authored-by: George Johnson <george@indiespring.com> Co-authored-by: Ben Chung <1330575+yzxben@users.noreply.github.com> Co-authored-by: lucasbstn <64323294+lucasbstn@users.noreply.github.com>
4 years ago
[Flutter]: https://github.com/flutter/flutter
[FlutterQuill]: https://pub.dev/packages/flutter_quill
[ReactQuill]: https://github.com/zenoamaro/react-quill
4 years ago
[Slack Group]: https://join.slack.com/t/bulletjournal1024/shared_invite/zt-fys7t9hi-ITVU5PGDen1rNRyCjdcQ2g
4 years ago
[Sample Page]: https://github.com/singerdmx/flutter-quill/blob/master/example/lib/pages/home_page.dart