chore: drop the support for DeltaX.fromHtml and DeltaX.fromMarkdown and will be only used internally

pull/1997/head
Ellet 9 months ago
parent 7b692ce4ee
commit cc22e00d6f
  1. 12
      lib/src/models/documents/delta_x.dart
  2. 6
      lib/src/models/documents/document.dart
  3. 2
      lib/src/widgets/quill/quill_controller.dart
  4. 2
      test/utils/delta_x_test.dart

@ -14,6 +14,12 @@ class DeltaX {
/// This api is **experimental** and designed to be used **internally** and shouldn't
/// used for **production applications**.
@experimental
@Deprecated(
'''
The experimental support for Markdown conversion has been dropped and will be removed in future releases,
consider using alternatives such as https://pub.dev/packages/markdown_quill
''',
)
static Delta fromMarkdown(String markdownText) {
final mdDocument = md.Document(encodeHtml: false);
final mdToDelta = MarkdownToDelta(markdownDocument: mdDocument);
@ -22,6 +28,12 @@ class DeltaX {
/// Convert the HTML Raw string to [Delta]
@experimental
@Deprecated(
'''
The experimental support for HTML conversion has been dropped and will be removed in future releases,
consider using alternatives such as https://pub.dev/packages/flutter_quill_delta_from_html
''',
)
static Delta fromHtml(String htmlText, {List<CustomHtmlPart>? customBlocks}) {
final htmlToDelta = HtmlToDelta(customBlocks: customBlocks);
return htmlToDelta.convert(htmlText);

@ -480,6 +480,12 @@ class Document {
/// Convert the HTML Raw string to [Document]
@experimental
@Deprecated(
'''
The experimental support for HTML conversion has been dropped and will be removed in future releases,
consider using alternatives such as https://pub.dev/packages/flutter_quill_delta_from_html
''',
)
static Document fromHtml(String html) {
return Document.fromDelta(DeltaX.fromHtml(html));
}

@ -583,6 +583,7 @@ class QuillController extends ChangeNotifier {
final htmlText = await getHTML();
if (htmlText != null) {
final htmlBody = html_parser.parse(htmlText).body?.outerHtml;
// ignore: deprecated_member_use_from_same_package
final deltaFromClipboard = DeltaX.fromHtml(htmlBody ?? htmlText);
_pasteUsingDelta(deltaFromClipboard);
@ -608,6 +609,7 @@ class QuillController extends ChangeNotifier {
final markdownText = await getMarkdown();
if (markdownText != null) {
// ignore: deprecated_member_use_from_same_package
final deltaFromClipboard = DeltaX.fromMarkdown(markdownText);
_pasteUsingDelta(deltaFromClipboard);

@ -1,3 +1,5 @@
// ignore_for_file: deprecated_member_use_from_same_package
import 'package:flutter_quill/quill_delta.dart';
import 'package:flutter_quill/src/models/documents/delta_x.dart';
import 'package:test/test.dart';

Loading…
Cancel
Save