-
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: added support for custom parser for markdown to document #403
feat: added support for custom parser for markdown to document #403
Conversation
@Mukund-Tandon Please format the code |
Ok,I am also writing test for it |
Codecov Report
@@ Coverage Diff @@
## main #403 +/- ##
==========================================
- Coverage 80.75% 80.60% -0.16%
==========================================
Files 252 254 +2
Lines 10258 10393 +135
==========================================
+ Hits 8284 8377 +93
- Misses 1974 2016 +42
|
for (final key in element.attributes.keys) { | ||
if (element.attributes[key] != null) { | ||
_attributes[key] = jsonDecode(element.attributes[key]!); | ||
} | ||
} |
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.
for (final key in element.attributes.keys) { | |
if (element.attributes[key] != null) { | |
_attributes[key] = jsonDecode(element.attributes[key]!); | |
} | |
} | |
element.attributes.forEach((key, value) { | |
_attributes[key] = jsonDecode(value); | |
}); |
@@ -72,6 +82,10 @@ class DeltaMarkdownDecoder extends Converter<String, Delta> | |||
_attributes.remove(BuiltInAttributeKey.href); | |||
} else if (element.tag == 'u') { | |||
_attributes.remove(BuiltInAttributeKey.underline); | |||
} else { | |||
for (var key in element.attributes.keys) { |
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.
for (var key in element.attributes.keys) { | |
for (final key in element.attributes.keys) { |
document | ||
.insert([i], [_convertLineToNode(lines[i], customInlineSyntaxes)]); |
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.
document | |
.insert([i], [_convertLineToNode(lines[i], customInlineSyntaxes)]); | |
document.insert( | |
[i], | |
[_convertLineToNode(lines[i], customInlineSyntaxes)], | |
); |
document | ||
.insert([i], [_convertLineToNode(lines[i], customInlineSyntaxes)]); |
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.
document | |
.insert([i], [_convertLineToNode(lines[i], customInlineSyntaxes)]); | |
document.insert( | |
[i], | |
[_convertLineToNode(lines[i], customInlineSyntaxes)], | |
); |
final decoder = | ||
DeltaMarkdownDecoder(customInlineSyntaxes: customInlineSyntaxes); | ||
for (final parser in customNodeParsers) { | ||
final Node? node = parser.transform(line); | ||
|
||
if (node != null) { | ||
return node; | ||
} | ||
} |
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.
final decoder = | |
DeltaMarkdownDecoder(customInlineSyntaxes: customInlineSyntaxes); | |
for (final parser in customNodeParsers) { | |
final Node? node = parser.transform(line); | |
if (node != null) { | |
return node; | |
} | |
} | |
final decoder = DeltaMarkdownDecoder( | |
customInlineSyntaxes: customInlineSyntaxes, | |
); | |
for (final parser in customNodeParsers) { | |
final node = parser.transform(line); | |
if (node != null) { | |
return node; | |
} | |
} |
@Mukund-Tandon I refactored some codes. The suggestions are just for your reference, don't commit them. |
Ok 👍 |
* main: (48 commits) chore: comment suggesting use of deprecated method (AppFlowy-IO#417) fix: replace matches on the same node (AppFlowy-IO#418) fix: rect of the divider block is incorrect (AppFlowy-IO#415) chore: bump version 1.2.4 (AppFlowy-IO#414) feat: migrate copy paste command from AppFlowy (AppFlowy-IO#413) feat: added support for custom parser for markdown to document (AppFlowy-IO#403) feat: improve CJK IME support feat: add support for context menu items to the editor fix: refactor _onSelectionChange method to update _showPlaceholder state more efficiently fix: typo (AppFlowy-IO#408) Fix selected nodes (AppFlowy-IO#407) fix: miss the nested node when copying (AppFlowy-IO#406) feat: skip whitespace between words while navigating with CTRL+ARROW keys (AppFlowy-IO#363) feat: double hyphen to em dash (AppFlowy-IO#395) fix: add variable to hold editor selection for colour menu (AppFlowy-IO#400) test: open link command refactor: show link command test refactor: show link menu command feat: open link command fix: placeholder on paragraph when selected (AppFlowy-IO#390) ...
…-state-update-node * fix/previous-node-text-direction-null: feat: default text direction property (AppFlowy-IO#402) fix: fixed the cursor not moving to next line after inserting divider (AppFlowy-IO#371) chore: update theme colors for editor feat: refactor floating toolbar positioning logic fix: update resizable image width calculation with minimum width constraint chore: comment suggesting use of deprecated method (AppFlowy-IO#417) fix: replace matches on the same node (AppFlowy-IO#418) fix: rect of the divider block is incorrect (AppFlowy-IO#415) chore: bump version 1.2.4 (AppFlowy-IO#414) feat: migrate copy paste command from AppFlowy (AppFlowy-IO#413) feat: added support for custom parser for markdown to document (AppFlowy-IO#403) feat: improve CJK IME support feat: add support for context menu items to the editor fix: refactor _onSelectionChange method to update _showPlaceholder state more efficiently fix: typo (AppFlowy-IO#408) Fix selected nodes (AppFlowy-IO#407) fix: miss the nested node when copying (AppFlowy-IO#406)
fixes: #401