-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add support for breakline and divider (#690)
* add support for breakline * add test for br tag parse * fix test failure case. * feat: add html support
- Loading branch information
Showing
6 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
lib/src/plugins/html/encoder/parser/divider_node_parser.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:appflowy_editor/appflowy_editor.dart'; | ||
import 'package:html/dom.dart' as dom; | ||
|
||
class HTMLDividerNodeParser extends HTMLNodeParser { | ||
const HTMLDividerNodeParser(); | ||
|
||
@override | ||
String get id => DividerBlockKeys.type; | ||
|
||
@override | ||
String transformNodeToHTMLString( | ||
Node node, { | ||
required List<HTMLNodeParser> encodeParsers, | ||
}) { | ||
return toHTMLString( | ||
transformNodeToDomNodes(node, encodeParsers: encodeParsers), | ||
); | ||
} | ||
|
||
@override | ||
List<dom.Node> transformNodeToDomNodes( | ||
Node node, { | ||
required List<HTMLNodeParser> encodeParsers, | ||
}) { | ||
return [dom.Element.tag(HTMLTags.divider)]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters