Merge branch 'master' of https://github.com/Alspb/flutter-quill into export_link_functions

pull/2008/head
Alspb 9 months ago
commit 4d0c583597
  1. 16
      CHANGELOG.md
  2. 2
      CHANGELOG_DATA.json
  3. 16
      dart_quill_delta/CHANGELOG.md
  4. 2
      dart_quill_delta/pubspec.yaml
  5. 16
      flutter_quill_extensions/CHANGELOG.md
  6. 70
      flutter_quill_extensions/README.md
  7. 2
      flutter_quill_extensions/pubspec.yaml
  8. 16
      flutter_quill_test/CHANGELOG.md
  9. 2
      flutter_quill_test/pubspec.yaml
  10. 11
      lib/src/models/config/editor/editor_configurations.dart
  11. 3
      lib/src/models/config/raw_editor/raw_editor_configurations.dart
  12. 2
      lib/src/widgets/editor/editor.dart
  13. 6
      lib/src/widgets/raw_editor/raw_editor_state.dart
  14. 4
      pubspec.yaml
  15. 3
      test/utils/delta_x_test.dart

@ -4,6 +4,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 9.5.17
* Feat(config): added option to disable automatic list conversion by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2011
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v9.5.16...v9.5.17
## 9.5.16
* chore: drop support for HTML, PDF, and Markdown converting functions by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/1997
* docs(readme): update the extensions package to document the Rich Text Paste feature on web by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2001
* Fix(test): delta_x tests fail by wrong expected Delta for video embed by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2010
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v9.5.15...v9.5.16
## 9.5.15 ## 9.5.15
* Update delta_from_html to fix nested lists issues and more by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2000 * Update delta_from_html to fix nested lists issues and more by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2000

File diff suppressed because one or more lines are too long

@ -4,6 +4,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 9.5.17
* Feat(config): added option to disable automatic list conversion by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2011
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v9.5.16...v9.5.17
## 9.5.16
* chore: drop support for HTML, PDF, and Markdown converting functions by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/1997
* docs(readme): update the extensions package to document the Rich Text Paste feature on web by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2001
* Fix(test): delta_x tests fail by wrong expected Delta for video embed by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2010
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v9.5.15...v9.5.16
## 9.5.15 ## 9.5.15
* Update delta_from_html to fix nested lists issues and more by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2000 * Update delta_from_html to fix nested lists issues and more by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2000

@ -1,6 +1,6 @@
name: dart_quill_delta name: dart_quill_delta
description: A port of quill-js-delta from typescript to dart description: A port of quill-js-delta from typescript to dart
version: 9.5.15 version: 9.5.17
homepage: https://github.com/singerdmx/flutter-quill/tree/master/dart_quill_delta/ homepage: https://github.com/singerdmx/flutter-quill/tree/master/dart_quill_delta/
repository: https://github.com/singerdmx/flutter-quill/tree/master/dart_quill_delta/ repository: https://github.com/singerdmx/flutter-quill/tree/master/dart_quill_delta/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/

@ -4,6 +4,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 9.5.17
* Feat(config): added option to disable automatic list conversion by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2011
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v9.5.16...v9.5.17
## 9.5.16
* chore: drop support for HTML, PDF, and Markdown converting functions by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/1997
* docs(readme): update the extensions package to document the Rich Text Paste feature on web by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2001
* Fix(test): delta_x tests fail by wrong expected Delta for video embed by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2010
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v9.5.15...v9.5.16
## 9.5.15 ## 9.5.15
* Update delta_from_html to fix nested lists issues and more by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2000 * Update delta_from_html to fix nested lists issues and more by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2000

@ -19,6 +19,7 @@ Check [Flutter Quill](https://github.com/singerdmx/flutter-quill) for details of
- [📦 Embed Blocks](#-embed-blocks) - [📦 Embed Blocks](#-embed-blocks)
- [🔍 Element properties](#-element-properties) - [🔍 Element properties](#-element-properties)
- [🔧 Custom Element properties](#-custom-element-properties) - [🔧 Custom Element properties](#-custom-element-properties)
- [📝 Rich Text Paste Feature](#-rich-text-paste-feature)
- [🖼 Image Assets](#-image-assets) - [🖼 Image Assets](#-image-assets)
- [🎯 Drag and drop feature](#-drag-and-drop-feature) - [🎯 Drag and drop feature](#-drag-and-drop-feature)
- [💡 Features](#-features) - [💡 Features](#-features)
@ -72,8 +73,8 @@ The package uses the following plugins:
Android, iOS, and macOS, we must inform you that you can't pick photos using the camera on a desktop so make sure to Android, iOS, and macOS, we must inform you that you can't pick photos using the camera on a desktop so make sure to
handle that if you plan on adding support for the desktop, this may change in the future, and for more info follow handle that if you plan on adding support for the desktop, this may change in the future, and for more info follow
this [link](https://pub.dev/packages/image_picker#windows-macos-and-linux) this [link](https://pub.dev/packages/image_picker#windows-macos-and-linux)
5. [`super_clipboard`](https://pub.dev/packages/super_clipboard) which needs some setup on Android only, is used to 5. [`super_clipboard`](https://pub.dev/packages/super_clipboard) which needs some setup on Android only, it's used to
support copying images and pasting them into the editor then you must set up it, open the page in pub.dev, and read support copying images and pasting them into editor, it's also required to support rich text pasting feature on non-web platforms, open the page in pub.dev and read
the `README.md` or click on this [link](https://pub.dev/packages/super_clipboard#android-support) to get the the `README.md` or click on this [link](https://pub.dev/packages/super_clipboard#android-support) to get the
instructions. instructions.
@ -96,24 +97,9 @@ The minSdkVersion is `23` as `super_clipboard` requires it
## 🚀 Usage ## 🚀 Usage
Start using the package in 3 steps: Be sure to follow the [Installation](#installation) section.
1. Be sure to follow the [Installation](#installation) section. Set the `embedBuilders` and `embedToolbar` params in configurations of `QuillEditor` and `QuillToolbar`.
2. This package already includes `super_clipboard` and will be used internally in this package, to use it
in `flutter_quill`, call this function before using any of the widgets or functionalities
```dart
FlutterQuillExtensions.useSuperClipboardPlugin();
```
`super_clipboard` is a comprehensive plugin that provides many clipboard features for reading and writing rich text,
images and other formats.
Executing this function will allow `flutter_quill` to use modern rich text features to paste HTML and Markdown,
support for GIF files, and other formats.
3. Set the `embedBuilders` and `embedToolbar` params in configurations of `QuillEditor` and `QuillToolbar` with the
values provided by this repository.
**Quill Toolbar**: **Quill Toolbar**:
```dart ```dart
@ -124,7 +110,7 @@ Start using the package in 3 steps:
), ),
``` ```
**Quill Editor** **Quill Editor**:
```dart ```dart
Expanded( Expanded(
child: QuillEditor.basic( child: QuillEditor.basic(
@ -182,6 +168,50 @@ Define flutterAlignment` as follows:
This works for all platforms except Web This works for all platforms except Web
### 📝 Rich Text Paste Feature
The Rich Text Pasting feature requires native code to access
the `Clipboard` data as HTML, the plugin `super_clipboard` is required on all platforms except Web.
This package already includes `super_clipboard` and will be used internally in this package, to use it
in `flutter_quill`, call this function before using any of the widgets or functionalities:
```dart
FlutterQuillExtensions.useSuperClipboardPlugin();
```
`super_clipboard` is a comprehensive plugin that provides many clipboard features for reading and writing rich text,
images and other formats.
Executing this function will allow `flutter_quill` to use modern rich text features to paste HTML and Markdown,
support for GIF files, and other formats.
> [!IMPORTANT]
> On web platforms, you can only get the HTML from `Clipboard` on the
> `paste` event, `super_clipboard`, or any plugin is not required.
> The paste feature will not work using the standard paste hotkey logic.
> As such, you will be unable to use the **Rich Text Paste Feature** on a button or in the web app itself.
> So you might want to either display a dialog when pressing the paste button that explains the limitation and shows the hotkey they need to press in order to paste or develop an extension for the browser that bypasses this limitation similarly to **Google Docs** and provide a link to install the browser extension.
> See [Issue #1998](https://github.com/singerdmx/flutter-quill/issues/1998) for more details.
To register the `paste` event:
```dart
import 'package:web/web.dart';
EventStreamProviders.pasteEvent.forTarget(web.document).listen((e) {
final html = e.clipboardData?.getData('text/html');
// Convert the HTML to Delta and paste it into the editor
});
```
Don't forget to cancel the `StreamSubscription` when no longer needed.
> [!NOTE]
> We're still planning on how this should be implemented in
> [Issue #1998](https://github.com/singerdmx/flutter-quill/issues/1998).
### 🖼 Image Assets ### 🖼 Image Assets
If you want to use image assets in the Quill Editor, you need to make sure your assets folder is `assets` otherwise: If you want to use image assets in the Quill Editor, you need to make sure your assets folder is `assets` otherwise:

@ -1,6 +1,6 @@
name: flutter_quill_extensions name: flutter_quill_extensions
description: Embed extensions for flutter_quill including image, video, formula and etc. description: Embed extensions for flutter_quill including image, video, formula and etc.
version: 9.5.15 version: 9.5.17
homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/ homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/
repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/ repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/

@ -4,6 +4,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 9.5.17
* Feat(config): added option to disable automatic list conversion by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2011
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v9.5.16...v9.5.17
## 9.5.16
* chore: drop support for HTML, PDF, and Markdown converting functions by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/1997
* docs(readme): update the extensions package to document the Rich Text Paste feature on web by @EchoEllet in https://github.com/singerdmx/flutter-quill/pull/2001
* Fix(test): delta_x tests fail by wrong expected Delta for video embed by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2010
**Full Changelog**: https://github.com/singerdmx/flutter-quill/compare/v9.5.15...v9.5.16
## 9.5.15 ## 9.5.15
* Update delta_from_html to fix nested lists issues and more by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2000 * Update delta_from_html to fix nested lists issues and more by @CatHood0 in https://github.com/singerdmx/flutter-quill/pull/2000

@ -1,6 +1,6 @@
name: flutter_quill_test name: flutter_quill_test
description: Test utilities for flutter_quill which includes methods to simplify interacting with the editor in test cases. description: Test utilities for flutter_quill which includes methods to simplify interacting with the editor in test cases.
version: 9.5.15 version: 9.5.17
homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/ homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/
repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/ repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/

@ -53,6 +53,7 @@ class QuillEditorConfigurations extends Equatable {
this.onSingleLongTapStart, this.onSingleLongTapStart,
this.onSingleLongTapMoveUpdate, this.onSingleLongTapMoveUpdate,
this.onSingleLongTapEnd, this.onSingleLongTapEnd,
this.enableMarkdownStyleConversion = true,
this.embedBuilders, this.embedBuilders,
this.unknownEmbedBuilder, this.unknownEmbedBuilder,
this.linkActionPickerDelegate = defaultLinkActionPickerDelegate, this.linkActionPickerDelegate = defaultLinkActionPickerDelegate,
@ -127,6 +128,13 @@ class QuillEditorConfigurations extends Equatable {
final bool scrollable; final bool scrollable;
final double scrollBottomInset; final double scrollBottomInset;
/// Configuration to enable or disable automatic Markdown style conversions.
///
/// This setting controls the behavior of input. Specifically, when enabled,
/// entering '1.' followed by a space or '-' followed by a space
/// will automatically convert the input into a Markdown list format.
final bool enableMarkdownStyleConversion;
/// Additional space around the content of this editor. /// Additional space around the content of this editor.
/// by default will be [EdgeInsets.zero] /// by default will be [EdgeInsets.zero]
final EdgeInsetsGeometry padding; final EdgeInsetsGeometry padding;
@ -385,6 +393,7 @@ class QuillEditorConfigurations extends Equatable {
bool? checkBoxReadOnly, bool? checkBoxReadOnly,
bool? disableClipboard, bool? disableClipboard,
bool? scrollable, bool? scrollable,
bool? enableMarkdownStyleConversion,
double? scrollBottomInset, double? scrollBottomInset,
EdgeInsetsGeometry? padding, EdgeInsetsGeometry? padding,
bool? autoFocus, bool? autoFocus,
@ -439,6 +448,8 @@ class QuillEditorConfigurations extends Equatable {
scrollable: scrollable ?? this.scrollable, scrollable: scrollable ?? this.scrollable,
scrollBottomInset: scrollBottomInset ?? this.scrollBottomInset, scrollBottomInset: scrollBottomInset ?? this.scrollBottomInset,
padding: padding ?? this.padding, padding: padding ?? this.padding,
enableMarkdownStyleConversion:
enableMarkdownStyleConversion ?? this.enableMarkdownStyleConversion,
autoFocus: autoFocus ?? this.autoFocus, autoFocus: autoFocus ?? this.autoFocus,
isOnTapOutsideEnabled: isOnTapOutsideEnabled:
isOnTapOutsideEnabled ?? this.isOnTapOutsideEnabled, isOnTapOutsideEnabled ?? this.isOnTapOutsideEnabled,

@ -67,6 +67,7 @@ class QuillRawEditorConfigurations extends Equatable {
this.customActions, this.customActions,
this.expands = false, this.expands = false,
this.isOnTapOutsideEnabled = true, this.isOnTapOutsideEnabled = true,
this.enableMarkdownStyleConversion = true,
this.onTapOutside, this.onTapOutside,
this.keyboardAppearance, this.keyboardAppearance,
this.enableInteractiveSelection = true, this.enableInteractiveSelection = true,
@ -100,6 +101,8 @@ class QuillRawEditorConfigurations extends Equatable {
/// Additional space around the editor contents. /// Additional space around the editor contents.
final EdgeInsetsGeometry padding; final EdgeInsetsGeometry padding;
final bool enableMarkdownStyleConversion;
/// Whether the text can be changed. /// Whether the text can be changed.
/// ///
/// When this is set to true, the text cannot be modified /// When this is set to true, the text cannot be modified

@ -236,6 +236,8 @@ class QuillEditorState extends State<QuillEditor>
focusNode: widget.focusNode, focusNode: widget.focusNode,
scrollController: widget.scrollController, scrollController: widget.scrollController,
scrollable: configurations.scrollable, scrollable: configurations.scrollable,
enableMarkdownStyleConversion:
configurations.enableMarkdownStyleConversion,
scrollBottomInset: configurations.scrollBottomInset, scrollBottomInset: configurations.scrollBottomInset,
padding: configurations.padding, padding: configurations.padding,
readOnly: configurations.readOnly, readOnly: configurations.readOnly,

@ -785,10 +785,12 @@ class QuillRawEditorState extends EditorState
const olKeyPhrase = '1.'; const olKeyPhrase = '1.';
const ulKeyPhrase = '-'; const ulKeyPhrase = '-';
final enableMdConversion =
widget.configurations.enableMarkdownStyleConversion;
if (text.value == olKeyPhrase) { if (text.value == olKeyPhrase && enableMdConversion) {
_updateSelectionForKeyPhrase(olKeyPhrase, Attribute.ol); _updateSelectionForKeyPhrase(olKeyPhrase, Attribute.ol);
} else if (text.value == ulKeyPhrase) { } else if (text.value == ulKeyPhrase && enableMdConversion) {
_updateSelectionForKeyPhrase(ulKeyPhrase, Attribute.ul); _updateSelectionForKeyPhrase(ulKeyPhrase, Attribute.ul);
} else { } else {
return KeyEventResult.ignored; return KeyEventResult.ignored;

@ -1,6 +1,6 @@
name: flutter_quill name: flutter_quill
description: A rich text editor built for the modern Android, iOS, web and desktop platforms. It is the WYSIWYG editor and a Quill component for Flutter. description: A rich text editor built for the modern Android, iOS, web and desktop platforms. It is the WYSIWYG editor and a Quill component for Flutter.
version: 9.5.15 version: 9.5.17
homepage: https://1o24bbs.com/c/bulletjournal/108/ homepage: https://1o24bbs.com/c/bulletjournal/108/
repository: https://github.com/singerdmx/flutter-quill/ repository: https://github.com/singerdmx/flutter-quill/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/
@ -54,7 +54,7 @@ dependencies:
flutter_colorpicker: ^1.1.0 flutter_colorpicker: ^1.1.0
# For converting HTML to Quill delta # For converting HTML to Quill delta
flutter_quill_delta_from_html: ^1.3.0 flutter_quill_delta_from_html: ^1.3.1
markdown: ^7.2.1 markdown: ^7.2.1
charcode: ^1.3.1 charcode: ^1.3.1

@ -32,14 +32,13 @@ void main() {
]); ]);
final expectedDeltaVideo = Delta.fromOperations([ final expectedDeltaVideo = Delta.fromOperations([
Operation.insert('\n'),
Operation.insert({'video': 'https://www.youtube.com/embed/dQw4w9WgXcQ'}), Operation.insert({'video': 'https://www.youtube.com/embed/dQw4w9WgXcQ'}),
Operation.insert('\n'), Operation.insert('\n'),
]); ]);
final expectedDeltaLinkAndVideoLink = Delta.fromOperations([ final expectedDeltaLinkAndVideoLink = Delta.fromOperations([
Operation.insert('fdsfsd', {'link': 'https://www.macrumors.com/'}), Operation.insert('fdsfsd', {'link': 'https://www.macrumors.com/'}),
Operation.insert('\n\n'), Operation.insert('\n'),
Operation.insert({'video': 'https://www.youtube.com/embed/dQw4w9WgXcQ'}), Operation.insert({'video': 'https://www.youtube.com/embed/dQw4w9WgXcQ'}),
Operation.insert('\n'), Operation.insert('\n'),
]); ]);

Loading…
Cancel
Save