mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: the text enterd after link doesn't need to be linked
This commit is contained in:
parent
2c37bf806e
commit
ba5c1804ce
@ -116,11 +116,17 @@ class TransactionBuilder {
|
|||||||
/// Optionally, you may specify formatting attributes that are applied to the inserted string.
|
/// 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.
|
/// By default, the formatting attributes before the insert position will be used.
|
||||||
insertText(TextNode node, int index, String content,
|
insertText(TextNode node, int index, String content,
|
||||||
[Attributes? attributes]) {
|
{Attributes? attributes, Attributes? removedAttributes}) {
|
||||||
var newAttributes = attributes;
|
var newAttributes = attributes;
|
||||||
if (index != 0 && attributes == null) {
|
if (index != 0 && attributes == null) {
|
||||||
newAttributes =
|
newAttributes =
|
||||||
node.delta.slice(max(index - 1, 0), index).first.attributes;
|
node.delta.slice(max(index - 1, 0), index).first.attributes;
|
||||||
|
if (newAttributes != null) {
|
||||||
|
newAttributes = Attributes.from(newAttributes);
|
||||||
|
if (removedAttributes != null) {
|
||||||
|
newAttributes.addAll(removedAttributes);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
textEdit(
|
textEdit(
|
||||||
node,
|
node,
|
||||||
|
@ -56,36 +56,31 @@ class _QuotedTextNodeWidgetState extends State<QuotedTextNodeWidget>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: defaultMaxTextNodeWidth,
|
width: defaultMaxTextNodeWidth,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(bottom: defaultLinePadding),
|
padding: EdgeInsets.only(bottom: defaultLinePadding),
|
||||||
child: IntrinsicHeight(
|
child: IntrinsicHeight(
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
FlowySvg(
|
FlowySvg(
|
||||||
key: iconKey,
|
key: iconKey,
|
||||||
width: _iconWidth,
|
width: _iconWidth,
|
||||||
padding: EdgeInsets.only(right: _iconRightPadding),
|
padding: EdgeInsets.only(right: _iconRightPadding),
|
||||||
name: 'quote',
|
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:appflowy_editor/src/infra/log.dart';
|
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/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
@ -149,6 +150,9 @@ class _AppFlowyInputState extends State<AppFlowyInput>
|
|||||||
textNode,
|
textNode,
|
||||||
delta.insertionOffset,
|
delta.insertionOffset,
|
||||||
delta.textInserted,
|
delta.textInserted,
|
||||||
|
removedAttributes: {
|
||||||
|
StyleKey.href: null,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
..commit();
|
..commit();
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user