fix: remove text span overlay on mobile

This commit is contained in:
Morn 2025-04-10 10:35:48 +08:00
parent 05b0160b80
commit 9e24d0d192
6 changed files with 12 additions and 7 deletions

View file

@ -373,7 +373,6 @@ void main() {
isMetaPressed: Platform.isMacOS,
);
await tester.simulateKeyEvent(LogicalKeyboardKey.delete);
await tester.ime.insertText(unavailableLink);
await tester.enterText(find.byType(TextFormField), unavailableLink);
await tester.tapButton(find.text(LocaleKeys.button_replace.tr()));
final node = tester.editor.getNodeAtPath([0]);

View file

@ -13,6 +13,7 @@ import 'document_with_multi_image_block_test.dart'
as document_with_multi_image_block_test;
import 'document_with_simple_table_test.dart'
as document_with_simple_table_test;
import 'document_link_preview_test.dart' as document_link_preview_test;
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
@ -28,4 +29,5 @@ void main() {
document_find_menu_test.main();
document_toolbar_test.main();
document_with_simple_table_test.main();
document_link_preview_test.main();
}

View file

@ -181,7 +181,7 @@ class LinkEmbedBlockComponentState extends State<LinkEmbedBlockComponent>
borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),
child: FlowyNetworkImage(
url: linkInfo.imageUrl ?? '',
width: double.infinity,
width: MediaQuery.of(context).size.width,
),
),
),

View file

@ -116,9 +116,11 @@ class LinkInfo {
}
class LinkInfoCache {
final _linkInfoPrefix = 'link_info';
Future<LinkInfo?> get(String url) async {
final option = await getIt<KeyValueStorage>().getWithFormat<LinkInfo?>(
url,
_linkInfoPrefix + url,
(value) => LinkInfo.fromJson(jsonDecode(value)),
);
return option;
@ -126,7 +128,7 @@ class LinkInfoCache {
Future<void> set(String url, LinkInfo data) async {
await getIt<KeyValueStorage>().set(
url,
_linkInfoPrefix + url,
jsonEncode(data.toJson()),
);
}

View file

@ -58,6 +58,9 @@ class _HighlightColorPickerWidgetState
@override
Widget build(BuildContext context) {
if (editorState.selection == null) {
return const SizedBox.shrink();
}
final selectionRectList = editorState.selectionRects();
final top =
selectionRectList.isEmpty ? 0.0 : selectionRectList.first.height;

View file

@ -591,10 +591,9 @@ class EditorStyleCustomizer {
Node node,
SelectableMixin delegate,
) {
if (UniversalPlatform.isMobile) return [];
final delta = node.delta;
if (delta == null) {
return [];
}
if (delta == null) return [];
final widgets = <Widget>[];
final textInserts = delta.whereType<TextInsert>();
int index = 0;