Skip to content

Commit

Permalink
5
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellet committed Dec 7, 2023
1 parent 64ea5ef commit 5fcda94
Show file tree
Hide file tree
Showing 57 changed files with 1,185 additions and 117 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.

## 9.0.0-dev-7
* Fix a bug in chaning the background/font color of ol/ul list
* Better support for pasting HTML contents from external websites to the editor
* The experimental support of converting the HTML from `quill_html_converter` is now built-in in the `flutter_quill` and removed from there (Breaking change for `quill_html_converter`)
* Flutter Quill Extensions:
* Fix link bug in the video url
* Fix patterns
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,13 @@ To see how to use the extension package, please take a look at the [README](./fl
Having your document stored in Quill Delta format is sometimes not enough. Often you'll need to convert
it to other formats such as HTML to publish it, or send an email.

**Note**: This package support converting from HTML back to Quill delta but it's experimental and used internally when pasting Html content from the cliboard to the Quill Editor

You have two options:

1. Using [quill_html_converter](./packages/quill_html_converter/) to convert to/from HTML, the package can convert the Quill delta to HTML well
(it uses [vsc_quill_delta_to_html](https://pub.dev/packages/vsc_quill_delta_to_html)) but the converting from HTML back to Quill delta is experimental
2. Another option is to use
1. Using [quill_html_converter](./packages/quill_html_converter/) to convert to HTML, the package can convert the Quill delta to HTML well
(it uses [vsc_quill_delta_to_html](https://pub.dev/packages/vsc_quill_delta_to_html)), it just a handy extension to do it more quickly
1. Another option is to use
[vsc_quill_delta_to_html](https://pub.dev/packages/vsc_quill_delta_to_html) to convert your document
to HTML.
This package has full support for all Quill operations—including images, videos, formulas,
Expand Down
11 changes: 5 additions & 6 deletions doc/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ This is a todo list page that added recently and will be updated soon.
- Extract the shared properties between `QuillRawEditorConfigurations` and `QuillEditorConfigurations`
- The todo in the this [commit](https://github.com/singerdmx/flutter-quill/commit/79597ea6425357795c0663588ac079665241f23a) needs to be checked
- use `maybeOf` and of instead `ofNotNull` in the providers to follow flutter offical convenstion, completly rework the providers and update the build context extensions
- Add line through to the text when the check point checked is true
- Change the color of the numbers and dots in ol/ul to match the ones in the item list
- Fix the bugs of the font family and font size
- Try to update Quill Html Converter

### Bugs

Expand All @@ -39,12 +43,7 @@ Please go to the [issues](https://github.com/singerdmx/flutter-quill/issues)
## Flutter Quill Extensions

### Features
- Add support for copying images to the Clipboard

### Improvemenets

Please check the todos, this list will be updated soon.

### Bugs

Please check the todos, this list will be updated soon.
### Bugs
31 changes: 21 additions & 10 deletions example/lib/presentation/quill/quill_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill_extensions/flutter_quill_extensions.dart'
show FlutterQuillEmbeds, QuillSharedExtensionsConfigurations;

import 'package:quill_html_converter/quill_html_converter.dart';
import 'package:share_plus/share_plus.dart' show Share;

Expand Down Expand Up @@ -46,6 +45,18 @@ class _QuillScreenState extends State<QuillScreen> {
_controller.document = widget.args.document;
}

// Future<void> _init() async {
// final reader = await ClipboardReader.readClipboard();
// if (reader.canProvide(Formats.htmlText)) {
// final html = await reader.readValue(Formats.htmlText);
// if (html == null) {
// return;
// }
// final delta = DeltaHtmlExt.fromHtml(html);
// _controller.document = Document.fromDelta(delta);
// }
// }

@override
void dispose() {
_controller.dispose();
Expand All @@ -65,7 +76,7 @@ class _QuillScreenState extends State<QuillScreen> {
onPressed: () {
final html = _controller.document.toDelta().toHtml();
_controller.document =
Document.fromDelta(DeltaHtmlExt.fromHtml(html));
Document.fromDelta(QuillController.fromHtml(html));
},
icon: const Icon(Icons.html),
),
Expand Down Expand Up @@ -119,14 +130,14 @@ class _QuillScreenState extends State<QuillScreen> {
codeBlock: QuillEditorCodeBlockElementOptions(
enableLineNumbers: true,
),
orderedList: QuillEditorOrderedListElementOptions(
backgroundColor: Colors.amber,
fontColor: Colors.black,
),
unorderedList: QuillEditorUnOrderedListElementOptions(
backgroundColor: Colors.green,
fontColor: Colors.red,
),
// orderedList: QuillEditorOrderedListElementOptions(
// backgroundColor: Colors.amber,
// fontColor: Colors.black,
// ),
// unorderedList: QuillEditorUnOrderedListElementOptions(
// backgroundColor: Colors.green,
// fontColor: Colors.red,
// ),
),
),
scrollController: _editorScrollController,
Expand Down
1 change: 1 addition & 0 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ dependencies:
file_picker: ^6.1.1
# For sharing text
share_plus: ^7.2.1
super_clipboard: ^0.7.3

dependency_overrides:
flutter_quill:
Expand Down
2 changes: 2 additions & 0 deletions flutter_quill_extensions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.

## 9.0.0-dev-7
* Fix a bug in chaning the background/font color of ol/ul list
* Better support for pasting HTML contents from external websites to the editor
* The experimental support of converting the HTML from `quill_html_converter` is now built-in in the `flutter_quill` and removed from there (Breaking change for `quill_html_converter`)
* Flutter Quill Extensions:
* Fix link bug in the video url
* Fix patterns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/widgets.dart' show BuildContext;
import 'package:flutter_quill/flutter_quill.dart';
import 'package:meta/meta.dart' show immutable;

import '../../../extensions/controller.dart';
import '../../../extensions/controller_ext.dart';
import '../../../services/image_picker/s_image_picker.dart';

/// When request picking an image, for example when the image button toolbar
Expand Down
2 changes: 1 addition & 1 deletion flutter_quill_extensions/lib/embeds/video/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/widgets.dart' show BuildContext;
import 'package:flutter_quill/flutter_quill.dart';
import 'package:meta/meta.dart' show immutable;

import '../../extensions/controller.dart';
import '../../extensions/controller_ext.dart';
import '../../services/image_picker/s_image_picker.dart';

/// When request picking an video, for example when the video button toolbar
Expand Down
2 changes: 1 addition & 1 deletion flutter_quill_extensions/lib/flutter_quill_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export 'embeds/video/editor/video_embed.dart';
export 'embeds/video/editor/video_web_embed.dart';
export 'embeds/video/toolbar/video_button.dart';
export 'embeds/video/video.dart';
export 'extensions/controller.dart';
export 'extensions/controller_ext.dart';
export 'models/config/editor/image/image.dart';
export 'models/config/editor/image/image_web.dart';
export 'models/config/editor/video/video.dart';
Expand Down
2 changes: 2 additions & 0 deletions flutter_quill_test/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.

## 9.0.0-dev-7
* Fix a bug in chaning the background/font color of ol/ul list
* Better support for pasting HTML contents from external websites to the editor
* The experimental support of converting the HTML from `quill_html_converter` is now built-in in the `flutter_quill` and removed from there (Breaking change for `quill_html_converter`)
* Flutter Quill Extensions:
* Fix link bug in the video url
* Fix patterns
Expand Down
4 changes: 2 additions & 2 deletions lib/flutter_quill.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export 'src/models/themes/quill_dialog_theme.dart';
export 'src/models/themes/quill_icon_theme.dart';
export 'src/utils/embeds.dart';
export 'src/widgets/editor/editor.dart';
export 'src/widgets/others/controller.dart';
export 'src/widgets/quill/quill_controller.dart';
export 'src/widgets/others/cursor.dart';
export 'src/widgets/others/default_styles.dart';
export 'src/widgets/others/embeds.dart';
export 'src/widgets/quill/embeds.dart';
export 'src/widgets/others/link.dart'
show LinkActionPickerDelegate, LinkMenuAction;
export 'src/widgets/raw_editor/raw_editor.dart';
Expand Down
5 changes: 5 additions & 0 deletions lib/markdown_quill.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
library quill_markdown;

export 'src/packages/quill_markdown/delta_to_markdown.dart';
export 'src/packages/quill_markdown/embeddable_table_syntax.dart';
export 'src/packages/quill_markdown/markdown_to_delta.dart';
4 changes: 2 additions & 2 deletions lib/src/models/config/editor/editor_configurations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import 'package:flutter/widgets.dart';
import 'package:meta/meta.dart' show experimental;

import '../../../widgets/editor/editor_builder.dart';
import '../../../widgets/others/controller.dart';
import '../../../widgets/quill/quill_controller.dart';
import '../../../widgets/others/default_styles.dart';
import '../../../widgets/others/delegate.dart';
import '../../../widgets/others/embeds.dart';
import '../../../widgets/quill/embeds.dart';
import '../../../widgets/others/link.dart';
import '../../../widgets/raw_editor/raw_editor.dart';
import '../../themes/quill_dialog_theme.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import 'package:flutter/widgets.dart'
Widget;
import 'package:meta/meta.dart' show immutable;

import '../../../widgets/others/controller.dart';
import '../../../widgets/quill/quill_controller.dart';
import '../../../widgets/others/cursor.dart';
import '../../../widgets/others/default_styles.dart';
import '../../../widgets/others/delegate.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/widgets.dart' show Color;

import '../../../../widgets/others/controller.dart';
import '../../../../widgets/quill/quill_controller.dart';
import '../../quill_shared_configurations.dart' show QuillSharedConfigurations;
import 'base_configurations.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'
import 'package:flutter/widgets.dart'
show Color, EdgeInsets, EdgeInsetsGeometry, TextOverflow, TextStyle;

import '../../../../widgets/others/controller.dart';
import '../../../../widgets/quill/quill_controller.dart';
import '../../../documents/attribute.dart';
import '../../../themes/quill_icon_theme.dart';
import '../../quill_configurations.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:flutter/foundation.dart' show immutable;
import 'package:flutter/widgets.dart'
show Axis, Widget, WrapAlignment, WrapCrossAlignment;

import '../../../widgets/others/controller.dart';
import '../../../widgets/others/embeds.dart';
import '../../../widgets/quill/quill_controller.dart';
import '../../../widgets/quill/embeds.dart';
import '../../themes/quill_dialog_theme.dart';
import '../../themes/quill_icon_theme.dart';
import 'buttons/base_configurations.dart';
Expand Down
3 changes: 2 additions & 1 deletion lib/src/models/documents/document.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:async';

import '../../widgets/others/embeds.dart';
import '../../widgets/quill/embeds.dart';
import '../quill_delta.dart';
import '../rules/rule.dart';
import '../structs/doc_change.dart';
Expand Down Expand Up @@ -402,6 +402,7 @@ class Document {
throw ArgumentError.value(doc, 'Document Delta cannot be empty.');
}

// print(doc.last.data.runtimeType);
assert((doc.last.data as String).endsWith('\n'));

var offset = 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/documents/nodes/container.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:collection';

import '../../../widgets/others/embeds.dart';
import '../../../widgets/quill/embeds.dart';
import '../style.dart';
import 'leaf.dart';
import 'line.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/documents/nodes/leaf.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:math' as math;

import '../../../widgets/others/embeds.dart';
import '../../../widgets/quill/embeds.dart';
import '../../quill_delta.dart';
import '../style.dart';
import 'embeddable.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/documents/nodes/line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:math' as math;

import 'package:collection/collection.dart';

import '../../../widgets/others/embeds.dart';
import '../../../widgets/quill/embeds.dart';
import '../../quill_delta.dart';
import '../../structs/offset_value.dart';
import '../attribute.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/documents/nodes/node.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:collection';

import '../../../widgets/others/embeds.dart';
import '../../../widgets/quill/embeds.dart';
import '../../quill_delta.dart';
import '../attribute.dart';
import '../style.dart';
Expand Down
11 changes: 11 additions & 0 deletions lib/src/packages/quill_markdown/custom_quill_attributes.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:flutter_quill/flutter_quill.dart';

/// Custom attribute to save the language of codeblock
class CodeBlockLanguageAttribute extends Attribute<String?> {
/// @nodoc
const CodeBlockLanguageAttribute(String? value)
: super(attrKey, AttributeScope.ignore, value);

/// attribute key
static const attrKey = 'x-md-codeblock-lang';
}
Loading

0 comments on commit 5fcda94

Please sign in to comment.