Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

feat: lineThrough and underline can coexist

Lucas.Xu06d11a91d14b
diff --git a/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/rich_text_style.dart b/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/rich_text_style.dart
index cc4f6038ac..29677cdce9 100644
--- a/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/rich_text_style.dart
+++ b/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/rich_text_style.dart
@@ -204,12 +204,15 @@ class RichTextStyle {
// underline or strikethrough
TextDecoration get textDecoration {
+ var decorations = [TextDecoration.none];
if (attributes.underline || attributes.href != null) {
- return TextDecoration.underline;
- } else if (attributes.strikethrough) {
- return TextDecoration.lineThrough;
+ decorations.add(TextDecoration.underline);
+ // TextDecoration.underline;
}
- return TextDecoration.none;
+ if (attributes.strikethrough) {
+ decorations.add(TextDecoration.lineThrough);
+ }
+ return TextDecoration.combine(decorations);
}
// font
diff --git a/frontend/app_flowy/packages/flowy_editor/lib/service/default_text_operations/format_rich_text_style.dart b/frontend/app_flowy/packages/flowy_editor/lib/service/default_text_operations/format_rich_text_style.dart
index 46c7d3278f..ce6d733d73 100644
--- a/frontend/app_flowy/packages/flowy_editor/lib/service/default_text_operations/format_rich_text_style.dart
+++ b/frontend/app_flowy/packages/flowy_editor/lib/service/default_text_operations/format_rich_text_style.dart
@@ -97,11 +97,6 @@ bool formatRichTextPartialStyle(EditorState editorState, String styleKey) {
Attributes attributes = {
styleKey: value,
};
- if (styleKey == StyleKey.underline && value) {
- attributes[StyleKey.strikethrough] = null;
- } else if (styleKey == StyleKey.strikethrough && value) {
- attributes[StyleKey.underline] = null;
- }
return formatRichTextStyle(editorState, attributes);
}