dartlangeditorflutterflutter-appsflutter-examplesflutter-packageflutter-widgetquillquill-deltaquilljsreactquillrich-textrich-text-editorwysiwygwysiwyg-editor
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.
51 lines
1.6 KiB
51 lines
1.6 KiB
10 months ago
|
import 'package:flutter_quill_delta_from_html/flutter_quill_delta_from_html.dart';
|
||
1 year ago
|
import 'package:markdown/markdown.dart' as md;
|
||
|
import 'package:meta/meta.dart';
|
||
9 months ago
|
import '../../markdown_quill.dart';
|
||
|
import '../../quill_delta.dart';
|
||
1 year ago
|
|
||
|
@immutable
|
||
10 months ago
|
@experimental
|
||
1 year ago
|
class DeltaX {
|
||
10 months ago
|
const DeltaX._();
|
||
|
|
||
|
/// Convert Markdown text to [Delta]
|
||
|
///
|
||
|
/// This api is **experimental** and designed to be used **internally** and shouldn't
|
||
|
/// used for **production applications**.
|
||
|
@experimental
|
||
9 months ago
|
@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
|
||
|
''',
|
||
|
)
|
||
10 months ago
|
static Delta fromMarkdown(String markdownText) {
|
||
10 months ago
|
final mdDocument = md.Document(encodeHtml: false);
|
||
10 months ago
|
final mdToDelta = MarkdownToDelta(markdownDocument: mdDocument);
|
||
10 months ago
|
return mdToDelta.convert(markdownText);
|
||
|
}
|
||
|
|
||
1 year ago
|
/// Convert the HTML Raw string to [Delta]
|
||
|
@experimental
|
||
9 months ago
|
@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, {
|
||
|
@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
|
||
|
''',
|
||
|
)
|
||
|
List<CustomHtmlPart>? customBlocks,
|
||
|
}) {
|
||
10 months ago
|
final htmlToDelta = HtmlToDelta(customBlocks: customBlocks);
|
||
|
return htmlToDelta.convert(htmlText);
|
||
1 year ago
|
}
|
||
|
}
|