|
@@ -17,6 +17,7 @@ const String tagList = "li";
|
|
const String tagParagraph = "p";
|
|
const String tagParagraph = "p";
|
|
const String tagImage = "img";
|
|
const String tagImage = "img";
|
|
const String tagAnchor = "a";
|
|
const String tagAnchor = "a";
|
|
|
|
+const String tagItalic = "i";
|
|
const String tagBold = "b";
|
|
const String tagBold = "b";
|
|
const String tagUnderline = "u";
|
|
const String tagUnderline = "u";
|
|
const String tagStrong = "strong";
|
|
const String tagStrong = "strong";
|
|
@@ -56,7 +57,8 @@ class HTMLToNodesConverter {
|
|
child.localName == tagSpan ||
|
|
child.localName == tagSpan ||
|
|
child.localName == tagCode ||
|
|
child.localName == tagCode ||
|
|
child.localName == tagStrong ||
|
|
child.localName == tagStrong ||
|
|
- child.localName == tagUnderline) {
|
|
|
|
|
|
+ child.localName == tagUnderline ||
|
|
|
|
+ child.localName == tagItalic) {
|
|
_handleRichTextElement(delta, child);
|
|
_handleRichTextElement(delta, child);
|
|
} else if (child.localName == tagBold) {
|
|
} else if (child.localName == tagBold) {
|
|
// Google docs wraps the the content inside the `<b></b>` tag.
|
|
// Google docs wraps the the content inside the `<b></b>` tag.
|
|
@@ -207,6 +209,8 @@ class HTMLToNodesConverter {
|
|
delta.insert(element.text, {"bold": true});
|
|
delta.insert(element.text, {"bold": true});
|
|
} else if (element.localName == tagUnderline) {
|
|
} else if (element.localName == tagUnderline) {
|
|
delta.insert(element.text, {"underline": true});
|
|
delta.insert(element.text, {"underline": true});
|
|
|
|
+ } else if (element.localName == tagItalic) {
|
|
|
|
+ delta.insert(element.text, {"italic": true});
|
|
} else {
|
|
} else {
|
|
delta.insert(element.text);
|
|
delta.insert(element.text);
|
|
}
|
|
}
|
|
@@ -463,6 +467,11 @@ class NodesToHTMLConverter {
|
|
final strong = html.Element.tag(tagUnderline);
|
|
final strong = html.Element.tag(tagUnderline);
|
|
strong.append(html.Text(op.content));
|
|
strong.append(html.Text(op.content));
|
|
childNodes.add(strong);
|
|
childNodes.add(strong);
|
|
|
|
+ } else if (attributes.length == 1 &&
|
|
|
|
+ attributes[StyleKey.italic] == true) {
|
|
|
|
+ final strong = html.Element.tag(tagItalic);
|
|
|
|
+ strong.append(html.Text(op.content));
|
|
|
|
+ childNodes.add(strong);
|
|
} else {
|
|
} else {
|
|
final span = html.Element.tag(tagSpan);
|
|
final span = html.Element.tag(tagSpan);
|
|
final cssString = _attributesToCssStyle(attributes);
|
|
final cssString = _attributesToCssStyle(attributes);
|