-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: html encode parser added #314
Conversation
Codecov Report
@@ Coverage Diff @@
## main #314 +/- ##
==========================================
+ Coverage 73.02% 75.64% +2.61%
==========================================
Files 236 247 +11
Lines 9477 9703 +226
==========================================
+ Hits 6921 7340 +419
+ Misses 2556 2363 -193
|
@alihassan143 Should I merge previous the PR first or these two are unrelated? |
@LucasXu0 this pr is different and other pr is different |
@you can first merged this pr other pr just need to be rebase and resolve conflicts |
@LucasXu0 first merge this pr than merge copy paste pr |
expect( | ||
result[4].attributes.toString(), | ||
'''{style: font-weight: bold; font-style: italic}''', | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the href is missing here.
80cdeab
to
bc8eb55
Compare
@LucasXu0 |
@alihassan143 Please move this code to a new function. Before // rich editor for webs do this so handling that case for
// href <a href="https://www.google.com" rel="noopener noreferrer" target="_blank"><strong><em><u>demo</u></em></strong></a>
if (attributes[AppFlowyRichTextKeys.href] != null) {
final element = dom.Element.tag(HTMLTags.anchor)
..attributes['href'] = attributes[AppFlowyRichTextKeys.href];
dom.Element? newElement;
dom.Element? appendElement;
attributes.forEach((key, value) {
if (key != AppFlowyRichTextKeys.href) {
if (newElement == null) {
newElement = convertSingleAttributeTextInsertToDomNode(
text,
{key: value},
);
} else {
appendElement ??= convertSingleAttributeTextInsertToDomNode(
"",
{key: value},
);
if (appendElement != null) {
appendElement = appendElement!..append(newElement!);
} else {
appendElement = convertSingleAttributeTextInsertToDomNode(
"",
{key: value},
);
}
}
}
});
if (appendElement != null) {
element.append(appendElement!);
} else if (newElement != null && appendElement == null) {
element.append(newElement!);
}
return element;
} After dom.Element convertMultipleAttributeTextInsertToDomNode(
String text,
Attributes attributes,
) {
// handle the href logic
final element = new_function_name(textInsert);
if (element != null) {
return element;
}
final span = dom.Element.tag(HTMLTags.span);
final cssString = convertAttributesToCssStyle(attributes);
if (cssString.isNotEmpty) {
span.attributes['style'] = cssString;
}
span.append(dom.Text(text));
return span;
} |
#313