Flutter upgrade
This commit is contained in:
parent
c6d5cd1d67
commit
02dd22238e
|
|
@ -1,4 +1,3 @@
|
||||||
/*
|
|
||||||
// DELETE THIS FILE ONCE SUPER EDITOR IS UPDATED
|
// DELETE THIS FILE ONCE SUPER EDITOR IS UPDATED
|
||||||
// Note: using the standard function crashes with h1 tags
|
// Note: using the standard function crashes with h1 tags
|
||||||
|
|
||||||
|
|
@ -232,7 +231,7 @@ class _MarkdownToDocument implements md.NodeVisitor {
|
||||||
|
|
||||||
_content.add(
|
_content.add(
|
||||||
ParagraphNode(
|
ParagraphNode(
|
||||||
id: DocumentEditor.createNodeId(),
|
id: Editor.createNodeId(),
|
||||||
text: _parseInlineText(element),
|
text: _parseInlineText(element),
|
||||||
metadata: <String, dynamic>{
|
metadata: <String, dynamic>{
|
||||||
'blockType': headerAttribution,
|
'blockType': headerAttribution,
|
||||||
|
|
@ -244,7 +243,7 @@ class _MarkdownToDocument implements md.NodeVisitor {
|
||||||
void _addParagraph(AttributedText attributedText) {
|
void _addParagraph(AttributedText attributedText) {
|
||||||
_content.add(
|
_content.add(
|
||||||
ParagraphNode(
|
ParagraphNode(
|
||||||
id: DocumentEditor.createNodeId(),
|
id: Editor.createNodeId(),
|
||||||
text: attributedText,
|
text: attributedText,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
@ -253,7 +252,7 @@ class _MarkdownToDocument implements md.NodeVisitor {
|
||||||
void _addBlockquote(md.Element element) {
|
void _addBlockquote(md.Element element) {
|
||||||
_content.add(
|
_content.add(
|
||||||
ParagraphNode(
|
ParagraphNode(
|
||||||
id: DocumentEditor.createNodeId(),
|
id: Editor.createNodeId(),
|
||||||
text: _parseInlineText(element),
|
text: _parseInlineText(element),
|
||||||
metadata: <String, dynamic>{
|
metadata: <String, dynamic>{
|
||||||
'blockType': blockquoteAttribution,
|
'blockType': blockquoteAttribution,
|
||||||
|
|
@ -273,9 +272,9 @@ class _MarkdownToDocument implements md.NodeVisitor {
|
||||||
|
|
||||||
_content.add(
|
_content.add(
|
||||||
ParagraphNode(
|
ParagraphNode(
|
||||||
id: DocumentEditor.createNodeId(),
|
id: Editor.createNodeId(),
|
||||||
text: AttributedText(
|
text: AttributedText(
|
||||||
text: element.textContent,
|
element.textContent,
|
||||||
),
|
),
|
||||||
metadata: <String, dynamic>{
|
metadata: <String, dynamic>{
|
||||||
'blockType': codeAttribution,
|
'blockType': codeAttribution,
|
||||||
|
|
@ -290,7 +289,7 @@ class _MarkdownToDocument implements md.NodeVisitor {
|
||||||
}) {
|
}) {
|
||||||
_content.add(
|
_content.add(
|
||||||
ImageNode(
|
ImageNode(
|
||||||
id: DocumentEditor.createNodeId(),
|
id: Editor.createNodeId(),
|
||||||
imageUrl: imageUrl,
|
imageUrl: imageUrl,
|
||||||
altText: altText,
|
altText: altText,
|
||||||
),
|
),
|
||||||
|
|
@ -299,7 +298,7 @@ class _MarkdownToDocument implements md.NodeVisitor {
|
||||||
|
|
||||||
void _addHorizontalRule() {
|
void _addHorizontalRule() {
|
||||||
_content.add(HorizontalRuleNode(
|
_content.add(HorizontalRuleNode(
|
||||||
id: DocumentEditor.createNodeId(),
|
id: Editor.createNodeId(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -310,7 +309,7 @@ class _MarkdownToDocument implements md.NodeVisitor {
|
||||||
}) {
|
}) {
|
||||||
_content.add(
|
_content.add(
|
||||||
ListItemNode(
|
ListItemNode(
|
||||||
id: DocumentEditor.createNodeId(),
|
id: Editor.createNodeId(),
|
||||||
itemType: listItemType,
|
itemType: listItemType,
|
||||||
indent: indent,
|
indent: indent,
|
||||||
text: _parseInlineText(element),
|
text: _parseInlineText(element),
|
||||||
|
|
@ -382,8 +381,7 @@ class _InlineMarkdownToDocument implements md.NodeVisitor {
|
||||||
@override
|
@override
|
||||||
void visitText(md.Text text) {
|
void visitText(md.Text text) {
|
||||||
final attributedText = _textStack.removeLast();
|
final attributedText = _textStack.removeLast();
|
||||||
_textStack
|
_textStack.add(attributedText.copyAndAppend(AttributedText(text.text)));
|
||||||
.add(attributedText.copyAndAppend(AttributedText(text: text.text)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -396,24 +394,24 @@ class _InlineMarkdownToDocument implements md.NodeVisitor {
|
||||||
styledText.addAttribution(
|
styledText.addAttribution(
|
||||||
boldAttribution,
|
boldAttribution,
|
||||||
SpanRange(
|
SpanRange(
|
||||||
start: 0,
|
0,
|
||||||
end: styledText.text.length - 1,
|
styledText.text.length - 1,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else if (element.tag == 'em') {
|
} else if (element.tag == 'em') {
|
||||||
styledText.addAttribution(
|
styledText.addAttribution(
|
||||||
italicsAttribution,
|
italicsAttribution,
|
||||||
SpanRange(
|
SpanRange(
|
||||||
start: 0,
|
0,
|
||||||
end: styledText.text.length - 1,
|
styledText.text.length - 1,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else if (element.tag == 'a') {
|
} else if (element.tag == 'a') {
|
||||||
styledText.addAttribution(
|
styledText.addAttribution(
|
||||||
LinkAttribution(url: Uri.parse(element.attributes['href']!)),
|
LinkAttribution(url: Uri.parse(element.attributes['href']!)),
|
||||||
SpanRange(
|
SpanRange(
|
||||||
start: 0,
|
0,
|
||||||
end: styledText.text.length - 1,
|
styledText.text.length - 1,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -589,4 +587,3 @@ class _EmptyParagraphSyntax extends md.BlockSyntax {
|
||||||
return md.Element('p', []);
|
return md.Element('p', []);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
//import 'package:example/logging.dart';
|
//import 'package:example/logging.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:invoiceninja_flutter/utils/markdown.dart';
|
||||||
import 'package:super_editor/super_editor.dart';
|
import 'package:super_editor/super_editor.dart';
|
||||||
import 'package:super_editor_markdown/super_editor_markdown.dart';
|
//import 'package:super_editor_markdown/super_editor_markdown.dart';
|
||||||
|
|
||||||
import 'package:invoiceninja_flutter/utils/super_editor/toolbar.dart';
|
import 'package:invoiceninja_flutter/utils/super_editor/toolbar.dart';
|
||||||
//import '_toolbar.dart';
|
//import '_toolbar.dart';
|
||||||
|
|
@ -313,6 +314,7 @@ class _ExampleEditorState extends State<ExampleEditor> {
|
||||||
_buildMountedToolbar(),
|
_buildMountedToolbar(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
/*
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.bottomRight,
|
alignment: Alignment.bottomRight,
|
||||||
child: ListenableBuilder(
|
child: ListenableBuilder(
|
||||||
|
|
@ -329,6 +331,7 @@ class _ExampleEditorState extends State<ExampleEditor> {
|
||||||
child: _buildCornerFabs(),
|
child: _buildCornerFabs(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
*/
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue