chore: drop support for quill_html_converter package

pull/1997/head
Ellet 9 months ago
parent 1409f07668
commit 9ed385db79
  1. 3
      .github/workflows/main.yml
  2. 4
      .github/workflows/publish.yml
  3. 5
      README.md
  4. 8
      example/lib/screens/quill/quill_screen.dart
  5. 3
      example/pubspec.yaml
  6. 30
      quill_html_converter/.gitignore
  7. 10
      quill_html_converter/.metadata
  8. 2352
      quill_html_converter/CHANGELOG.md
  9. 21
      quill_html_converter/LICENSE
  10. 41
      quill_html_converter/README.md
  11. 36
      quill_html_converter/analysis_options.yaml
  12. 131
      quill_html_converter/lib/quill_html_converter.dart
  13. 38
      quill_html_converter/pubspec.yaml
  14. 3
      quill_html_converter/pubspec_overrides.yaml.disabled
  15. 47
      quill_html_converter/test/quill_html_converter_test.dart
  16. 3
      quill_pdf_converter/lib/quill_pdf_converter.dart
  17. 4
      quill_pdf_converter/pubspec_overrides.yaml.disabled
  18. 6
      scripts/disable_local_dev.sh
  19. 6
      scripts/enable_local_dev.sh
  20. 1
      scripts/pub_get.sh
  21. 1
      scripts/update_package_version.dart

@ -39,9 +39,6 @@ jobs:
- name: 📦 Install flutter_quill_test dependencies
run: flutter pub get -C flutter_quill_test
- name: 📦 Install quill_html_converter dependencies
run: flutter pub get -C quill_html_converter
- name: 📦 Install quill_pdf_converter dependencies
run: flutter pub get -C quill_pdf_converter

@ -107,10 +107,6 @@ jobs:
- name: 📤 Publish flutter_quill_test
run: flutter pub publish --force
working-directory: ./flutter_quill_test/
- name: 📤 Publish quill_html_converter
run: flutter pub publish --force
working-directory: ./quill_html_converter/
- name: 📤 Publish quill_pdf_converter
run: flutter pub publish --force

@ -276,8 +276,7 @@ in the database instead of other formats (e.g., HTML, Markdown, PDF, Microsoft W
The following packages can be used:
1. [`quill_html_converter`](./quill_html_converter/): To convert Delta HTML, it uses [vsc_quill_delta_to_html](https://pub.dev/packages/vsc_quill_delta_to_html), it's an extension to `Delta`.
2. [`vsc_quill_delta_to_html`](https://pub.dev/packages/vsc_quill_delta_to_html): To convert **Delta**
1. [`vsc_quill_delta_to_html`](https://pub.dev/packages/vsc_quill_delta_to_html): To convert **Delta**
to HTML.
This package has full support for all Quill operations—including images, videos, formulas,
tables, and mentions.
@ -285,7 +284,7 @@ The following packages can be used:
It is a complete Dart part of the popular and
mature [quill-delta-to-html](https://www.npmjs.com/package/quill-delta-to-html)
Typescript/JS package.
3. [`flutter_quill_delta_from_html`](https://pub.dev/packages/flutter_quill_delta_from_html): To Convert **HTML** to **Delta**.
2. [`flutter_quill_delta_from_html`](https://pub.dev/packages/flutter_quill_delta_from_html): To Convert **HTML** to **Delta**.
## 🌐 Translation

@ -7,7 +7,6 @@ import 'package:flutter_quill_extensions/flutter_quill_extensions.dart'
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart';
import 'package:quill_html_converter/quill_html_converter.dart';
import 'package:quill_pdf_converter/quill_pdf_converter.dart';
import 'package:share_plus/share_plus.dart' show Share;
@ -80,13 +79,6 @@ class _QuillScreenState extends State<QuillScreen> {
);
},
menuChildren: [
MenuItemButton(
onPressed: () {
final html = _controller.document.toDelta().toHtml();
_controller.document = Document.fromHtml(html);
},
child: const Text('Load with HTML'),
),
MenuItemButton(
onPressed: () async {
final pdfDocument = pw.Document();

@ -17,7 +17,6 @@ dependencies:
dart_quill_delta: ^9.3.4
flutter_quill_extensions: ^9.3.4
flutter_quill_test: ^9.3.4
quill_html_converter: ^9.3.4
quill_pdf_converter: ^9.3.4
# Dart Packages
path: ^1.8.3
@ -58,8 +57,6 @@ dependency_overrides:
path: ../dart_quill_delta
flutter_quill_test:
path: ../flutter_quill_test
quill_html_converter:
path: ../quill_html_converter
quill_pdf_converter:
path: ../quill_pdf_converter

@ -1,30 +0,0 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/

@ -1,10 +0,0 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "d211f42860350d914a5ad8102f9ec32764dc6d06"
channel: "stable"
project_type: package

File diff suppressed because it is too large Load Diff

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 Flutter Quill Team
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.

@ -1,41 +0,0 @@
# Flutter Quill HTML
A extension for [flutter_quill](https://pub.dev/packages/flutter_quill) package to add support for dealing with conversion to/from html
It uses [vsc_quill_delta_to_html](https://pub.dev/packages/vsc_quill_delta_to_html) package to convert the the delta to HTML
This library is **experimental** and the support might be dropped at anytime.
## Features
```markdown
- Easy to use
- Support Flutter Quill package
```
## Getting started
```yaml
dependencies:
quill_html_converter: ^<latest-version-here>
```
## Usage
First, you need to [setup](../README.md#usage) the `flutter_quill` first
Then you can simply convert to/from HTML
```dart
import 'package:quill_html_converter/quill_html_converter.dart';
// Convert Delta to HTML
final html = _controller.document.toDelta().toHtml();
// Load Delta document using HTML
_controller.document =
Document.fromDelta(Document.fromHtml(html));
```
## Additional information
This will be updated soon.

@ -1,36 +0,0 @@
include: package:flutter_lints/flutter.yaml
analyzer:
errors:
undefined_prefixed_name: ignore
unsafe_html: ignore
linter:
rules:
always_declare_return_types: true
always_put_required_named_parameters_first: true
annotate_overrides: true
avoid_empty_else: true
avoid_escaping_inner_quotes: true
avoid_print: true
avoid_redundant_argument_values: true
avoid_types_on_closure_parameters: true
avoid_void_async: true
cascade_invocations: true
directives_ordering: true
omit_local_variable_types: true
prefer_const_constructors: true
prefer_const_constructors_in_immutables: true
prefer_const_declarations: true
prefer_final_fields: true
prefer_final_in_for_each: true
prefer_final_locals: true
prefer_initializing_formals: true
prefer_int_literals: true
prefer_interpolation_to_compose_strings: true
prefer_relative_imports: true
prefer_single_quotes: true
sort_constructors_first: true
sort_unnamed_constructors_first: true
unnecessary_lambdas: true
unnecessary_parenthesis: true
unnecessary_string_interpolations: true

@ -1,131 +0,0 @@
library quill_html_converter;
import 'package:dart_quill_delta/dart_quill_delta.dart';
import 'package:vsc_quill_delta_to_html/vsc_quill_delta_to_html.dart'
as converter
show
ConverterOptions,
QuillDeltaToHtmlConverter,
OpAttributeSanitizerOptions,
OpConverterOptions,
InlineStyles,
InlineStyleType,
defaultInlineFonts;
typedef ConverterOptions = converter.ConverterOptions;
/// A extension for [Delta] which comes from `flutter_quill` to extends
/// the functionality of it to support converting the [Delta] to/from HTML
extension DeltaHtmlExt on Delta {
/// Convert the [Delta] instance to HTML Raw string
///
/// It will run using the following steps:
///
/// 1. Convert the [Delta] to json using [toJson]
/// 2. Cast the json map as `List<Map<String, dynamic>>`
/// 3. Pass it to the conventer `vsc_quill_delta_to_html` which is a package
/// that designed specifically for converting the quill delta to html
String toHtml({ConverterOptions? options}) {
final json = toJson();
final html = converter.QuillDeltaToHtmlConverter(
List.castFrom(json),
options ?? _defaultConverterOptions,
).convert();
return html;
}
}
/// Configuration options for converting Quill Delta to HTML.
/// This includes various settings for how different elements and styles should be handled.
final _defaultConverterOptions = ConverterOptions(
// Tag to be used for ordered lists
orderedListTag: 'ol',
// Tag to be used for bullet lists
bulletListTag: 'ul',
// Enable multi-line blockquote conversion
multiLineBlockquote: true,
// Enable multi-line header conversion
multiLineHeader: true,
// Enable multi-line code block conversion
multiLineCodeblock: true,
// Enable multi-line paragraph conversion
multiLineParagraph: true,
// Enable multi-line custom block conversion
multiLineCustomBlock: true,
// Options for sanitizing attributes
sanitizerOptions: converter.OpAttributeSanitizerOptions(
// Allow 8-digit hex colors in styles
allow8DigitHexColors: true,
),
// This handle specific styles and attributes
converterOptions: converter.OpConverterOptions(
customCssStyles: (op) {
// Validate if our attributes exist in [DeltaInsertOp]
// and return the necessary HTML style
// These lists of attributes, are passed as inline styles
//
// For example, if you have a delta like ->
// [ { "insert": "hello", "attributes": { "line-height": 1.5 }} ]
//
// Without the validation below to verify if exist line-height atribute in the Operation, it would be:
// <p>hello</p> -> isn't created the attribute
//
// But, with this validation an implementation of the style will be:
// <p><span style="line-height: 1.5px">hello</span></p>
if (op.attributes['line-height'] != null) {
return ['line-height: ${op.attributes['line-height']}px'];
}
if (op.isImage()) {
// Fit images within restricted parent width
final String? styles = op.attributes['style'];
final listStyles = styles?.split(';') ?? [];
return ['max-width: 100%', 'object-fit: contain', ...listStyles];
}
return null;
},
// Enable inline styles
inlineStylesFlag: true,
inlineStyles: converter.InlineStyles(
<String, converter.InlineStyleType>{
'font': converter.InlineStyleType(
fn: (value, _) =>
converter.defaultInlineFonts[value] ?? 'font-family: $value',
),
'size': converter.InlineStyleType(
fn: (value, _) {
// Default sizes
if (value == 'small') return 'font-size: 0.75em';
if (value == 'large') return 'font-size: 1.5em';
if (value == 'huge') return 'font-size: 2.5em';
// Accept any int or double type size
return 'font-size: ${value}px';
},
),
'indent': converter.InlineStyleType(
fn: (value, op) {
// Calculate indent size based on the value
final indentSize = (double.tryParse(value) ?? double.nan) * 3;
// Determine side for padding based on text direction
final side = op.attributes['direction'] == 'rtl' ? 'right' : 'left';
return 'padding-$side:${indentSize}em';
},
),
'list': converter.InlineStyleType(
map: <String, String>{
// Styles for checked and unchecked list items
'checked': "list-style-type:'\\2611';padding-left: 0.5em;",
'unchecked': "list-style-type:'\\2610';padding-left: 0.5em;",
},
),
},
),
),
);

@ -1,38 +0,0 @@
name: quill_html_converter
description: A extension for flutter_quill package to add support for dealing with conversion to/from html
version: 9.5.13
homepage: https://github.com/singerdmx/flutter-quill/tree/master/quill_html_converter/
repository: https://github.com/singerdmx/flutter-quill/tree/master/quill_html_converter/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/
documentation: https://github.com/singerdmx/flutter-quill/tree/master/quill_html_converter/
topics:
- ui
- widgets
- widget
- rich-text-editor
- quill
environment:
sdk: '>=3.1.5 <4.0.0'
flutter: ">=1.17.0"
dependencies:
flutter:
sdk: flutter
vsc_quill_delta_to_html: ^1.0.5
markdown: ^7.2.2
charcode: ^1.3.1
collection: ^1.18.0
dart_quill_delta: ^9.3.5
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0
test: ^1.24.9
flutter:
uses-material-design: true

@ -1,3 +0,0 @@
dependency_overrides:
dart_quill_delta:
path: ../dart_quill_delta

@ -1,47 +0,0 @@
import 'package:dart_quill_delta/dart_quill_delta.dart';
import 'package:quill_html_converter/quill_html_converter.dart';
import 'package:test/test.dart';
void main() {
group('Quill HTML Converter', () {
test('should parser delta heading to html', () {
const html = '<p><br/></p><h1><br/></h1>';
final quillDelta = [
{'insert': '\n'},
{
'attributes': {'header': 1},
'insert': 'Hello'
}
];
expect(Delta.fromJson(quillDelta).toHtml().trim(), html.trim());
});
test('should parse line-height attribute to html', () {
const html = '<p><span style="line-height: 1.5px">hello</span></p>';
final quillDelta = [
{
'insert': 'hello',
'attributes': {'line-height': 1.5}
},
{'insert': '\n'}
];
expect(Delta.fromJson(quillDelta).toHtml().trim(), html.trim());
});
test("should parse block image embed with it's attributes to html", () {
const html =
'<p><img style="max-width: 100%;object-fit: contain;width: 40vh; height:350px; margin: 20px;" src="https://img.freepik.com/foto-gratis/belleza-otonal-abstracta-patron-venas-hoja-multicolor-generado-ia_188544-9871.jpg"/></p>';
final quillDelta = [
{
'insert': {
'image':
'https://img.freepik.com/foto-gratis/belleza-otonal-abstracta-patron-venas-hoja-multicolor-generado-ia_188544-9871.jpg'
},
'attributes': {'style': 'width: 40vh; height:350px; margin: 20px;'}
},
{'insert': '\n'}
];
expect(Delta.fromJson(quillDelta).toHtml().trim(), html.trim());
});
});
}

@ -4,14 +4,13 @@ import 'package:dart_quill_delta/dart_quill_delta.dart';
import 'package:htmltopdfwidgets/htmltopdfwidgets.dart';
import 'package:meta/meta.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:quill_html_converter/quill_html_converter.dart';
/// Extension on [Delta] to add extra functions for converting to Pdf
extension DeltaPdfExt on Delta {
/// First convert to Html then to Pdf
@experimental
Future<List<pw.Widget>> toPdf() async {
final html = toHtml();
const html = '<html></html';
return HTMLToPdf().convert(
html,
fontFallback: [

@ -1,5 +1,3 @@
dependency_overrides:
dart_quill_delta:
path: ../dart_quill_delta
quill_html_converter:
path: ../quill_html_converter
path: ../dart_quill_delta

@ -21,10 +21,4 @@ rm flutter_quill_test/pubspec_overrides.yaml
echo ""
echo "Disable local development for all the other packages..."
rm quill_html_converter/pubspec_overrides.yaml
rm quill_pdf_converter/pubspec_overrides.yaml
echo ""
echo "Local development for all libraries has been disabled, please 'flutter pub get' for each one of them"

@ -21,10 +21,4 @@ cp flutter_quill_test/pubspec_overrides.yaml.disabled flutter_quill_test/pubspec
echo ""
echo "Enable local development for all the other packages..."
cp quill_html_converter/pubspec_overrides.yaml.disabled quill_html_converter/pubspec_overrides.yaml
cp quill_pdf_converter/pubspec_overrides.yaml.disabled quill_pdf_converter/pubspec_overrides.yaml
echo ""
echo "Local development for all libraries has been enabled, please 'flutter pub get' for each one of them"

@ -6,5 +6,4 @@ flutter pub get
(cd dart_quill_delta && flutter pub get)
(cd flutter_quill_extensions && flutter pub get)
(cd flutter_quill_test && flutter pub get)
(cd quill_html_converter && flutter pub get)
(cd quill_pdf_converter && flutter pub get)

@ -14,7 +14,6 @@ final _packages = [
'./dart_quill_delta',
'./flutter_quill_extensions',
'./flutter_quill_test',
'./quill_html_converter',
'./quill_pdf_converter',
];

Loading…
Cancel
Save