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.

fix: the text enterd after link doesn't need to be linked

Lucas.Xuba5c1804ce95
diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/operation/transaction_builder.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/operation/transaction_builder.dart
index 4f6de6e9b0..12c13bf2e5 100644
--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/operation/transaction_builder.dart
+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/operation/transaction_builder.dart
@@ -116,11 +116,17 @@ class TransactionBuilder {
/// Optionally, you may specify formatting attributes that are applied to the inserted string.
/// By default, the formatting attributes before the insert position will be used.
insertText(TextNode node, int index, String content,
- [Attributes? attributes]) {
+ {Attributes? attributes, Attributes? removedAttributes}) {
var newAttributes = attributes;
if (index != 0 && attributes == null) {
newAttributes =
node.delta.slice(max(index - 1, 0), index).first.attributes;
+ if (newAttributes != null) {
+ newAttributes = Attributes.from(newAttributes);
+ if (removedAttributes != null) {
+ newAttributes.addAll(removedAttributes);
+ }
+ }
}
textEdit(
node,
diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/quoted_text.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/quoted_text.dart
index 3391729779..78c6653904 100644
--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/quoted_text.dart
+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/quoted_text.dart
@@ -56,36 +56,31 @@ class _QuotedTextNodeWidgetState extends State<QuotedTextNodeWidget>
@override
Widget build(BuildContext context) {
return SizedBox(
- width: defaultMaxTextNodeWidth,
- child: Padding(
- padding: EdgeInsets.only(bottom: defaultLinePadding),
- child: IntrinsicHeight(
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- FlowySvg(
- key: iconKey,
- width: _iconWidth,
- padding: EdgeInsets.only(right: _iconRightPadding),
- name: 'quote',
+ width: defaultMaxTextNodeWidth,
+ child: Padding(
+ padding: EdgeInsets.only(bottom: defaultLinePadding),
+ child: IntrinsicHeight(
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ FlowySvg(
+ key: iconKey,
+ width: _iconWidth,
+ padding: EdgeInsets.only(right: _iconRightPadding),
+ name: 'quote',
+ ),
+ Expanded(
+ child: FlowyRichText(
+ key: _richTextKey,
+ placeholderText: 'Quote',
+ textNode: widget.textNode,
+ editorState: widget.editorState,
),
- Expanded(
- child: FlowyRichText(
- key: _richTextKey,
- placeholderText: 'Quote',
- textNode: widget.textNode,
- editorState: widget.editorState,
- ),
- ),
- ],
- ),
+ ),
+ ],
),
- ));
- }
-
- double get _quoteHeight {
- final lines =
- widget.textNode.toRawString().characters.where((c) => c == '\n').length;
- return (lines + 1) * _iconWidth;
+ ),
+ ),
+ );
}
}
diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/input_service.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/input_service.dart
index a92fae1b95..96f0777544 100644
--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/input_service.dart
+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/input_service.dart
@@ -1,4 +1,5 @@
import 'package:appflowy_editor/src/infra/log.dart';
+import 'package:appflowy_editor/src/render/rich_text/rich_text_style.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -149,6 +150,9 @@ class _AppFlowyInputState extends State<AppFlowyInput>
textNode,
delta.insertionOffset,
delta.textInserted,
+ removedAttributes: {
+ StyleKey.href: null,
+ },
)
..commit();
} else {