mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: The click area of the linked text is too large.
This commit is contained in:
parent
42866e1057
commit
e567158cee
frontend/app_flowy/packages/appflowy_editor
example/lib
lib/src/render
@ -46,9 +46,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
body: Container(
|
||||
alignment: Alignment.topCenter,
|
||||
child: _buildEditor(context),
|
||||
body: Center(
|
||||
child: Container(
|
||||
width: 780,
|
||||
alignment: Alignment.topCenter,
|
||||
child: _buildEditor(context),
|
||||
),
|
||||
),
|
||||
floatingActionButton: _buildExpandableFab(),
|
||||
);
|
||||
|
@ -32,29 +32,26 @@ class EditorNodeWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.red.withOpacity(0.1),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: node.children
|
||||
.map(
|
||||
(child) =>
|
||||
editorState.service.renderPluginService.buildPluginWidget(
|
||||
child is TextNode
|
||||
? NodeWidgetContext<TextNode>(
|
||||
context: context,
|
||||
node: child,
|
||||
editorState: editorState,
|
||||
)
|
||||
: NodeWidgetContext<Node>(
|
||||
context: context,
|
||||
node: child,
|
||||
editorState: editorState,
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: node.children
|
||||
.map(
|
||||
(child) =>
|
||||
editorState.service.renderPluginService.buildPluginWidget(
|
||||
child is TextNode
|
||||
? NodeWidgetContext<TextNode>(
|
||||
context: context,
|
||||
node: child,
|
||||
editorState: editorState,
|
||||
)
|
||||
: NodeWidgetContext<Node>(
|
||||
context: context,
|
||||
node: child,
|
||||
editorState: editorState,
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ class _BulletedListTextNodeWidgetState extends State<BulletedListTextNodeWidget>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: defaultMaxTextNodeWidth,
|
||||
return Container(
|
||||
constraints: BoxConstraints(maxWidth: defaultMaxTextNodeWidth),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: defaultLinePadding),
|
||||
child: Row(
|
||||
@ -70,14 +70,14 @@ class _BulletedListTextNodeWidgetState extends State<BulletedListTextNodeWidget>
|
||||
padding: EdgeInsets.only(right: _iconRightPadding),
|
||||
name: 'point',
|
||||
),
|
||||
Expanded(
|
||||
Flexible(
|
||||
child: FlowyRichText(
|
||||
key: _richTextKey,
|
||||
placeholderText: 'List',
|
||||
textNode: widget.textNode,
|
||||
editorState: widget.editorState,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -86,7 +86,7 @@ class _CheckboxNodeWidgetState extends State<CheckboxNodeWidget>
|
||||
..commit();
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
Flexible(
|
||||
child: FlowyRichText(
|
||||
key: _richTextKey,
|
||||
placeholderText: 'To-do',
|
||||
|
@ -194,7 +194,9 @@ class _FlowyRichTextState extends State<FlowyRichText> with Selectable {
|
||||
return RichText(
|
||||
key: _textKey,
|
||||
textHeightBehavior: const TextHeightBehavior(
|
||||
applyHeightToFirstAscent: false, applyHeightToLastDescent: false),
|
||||
applyHeightToFirstAscent: false,
|
||||
applyHeightToLastDescent: false,
|
||||
),
|
||||
text: widget.textSpanDecorator != null
|
||||
? widget.textSpanDecorator!(textSpan)
|
||||
: textSpan,
|
||||
|
@ -63,8 +63,8 @@ class _HeadingTextNodeWidgetState extends State<HeadingTextNodeWidget>
|
||||
top: _topPadding,
|
||||
bottom: defaultLinePadding,
|
||||
),
|
||||
child: SizedBox(
|
||||
width: defaultMaxTextNodeWidth,
|
||||
child: Container(
|
||||
constraints: BoxConstraints(maxWidth: defaultMaxTextNodeWidth),
|
||||
child: FlowyRichText(
|
||||
key: _richTextKey,
|
||||
placeholderText: 'Heading',
|
||||
|
@ -70,7 +70,7 @@ class _NumberListTextNodeWidgetState extends State<NumberListTextNodeWidget>
|
||||
padding: EdgeInsets.only(right: _iconRightPadding),
|
||||
number: widget.textNode.attributes.number,
|
||||
),
|
||||
Expanded(
|
||||
Flexible(
|
||||
child: FlowyRichText(
|
||||
key: _richTextKey,
|
||||
placeholderText: 'List',
|
||||
|
@ -69,7 +69,7 @@ class _QuotedTextNodeWidgetState extends State<QuotedTextNodeWidget>
|
||||
padding: EdgeInsets.only(right: _iconRightPadding),
|
||||
name: 'quote',
|
||||
),
|
||||
Expanded(
|
||||
Flexible(
|
||||
child: FlowyRichText(
|
||||
key: _richTextKey,
|
||||
placeholderText: 'Quote',
|
||||
|
@ -52,8 +52,8 @@ class _RichTextNodeWidgetState extends State<RichTextNodeWidget>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: defaultMaxTextNodeWidth,
|
||||
return Container(
|
||||
constraints: BoxConstraints(maxWidth: defaultMaxTextNodeWidth),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: defaultLinePadding),
|
||||
child: FlowyRichText(
|
||||
|
@ -238,6 +238,12 @@ void showLinkMenu(
|
||||
}
|
||||
|
||||
void _dismissLinkMenu() {
|
||||
// workaround: SelectionService has been released after hot reload.
|
||||
final isSelectionDisposed =
|
||||
_editorState?.service.selectionServiceKey.currentState == null;
|
||||
if (isSelectionDisposed) {
|
||||
return;
|
||||
}
|
||||
if (_editorState?.service.selectionService.currentSelection.value == null) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user