Fix web transcript cross-message selection
This commit is contained in:
@@ -5,11 +5,12 @@ import 'package:flutter/material.dart';
|
||||
import 'chat_link_launcher.dart';
|
||||
import 'chat_link_spans.dart';
|
||||
import 'chat_links.dart';
|
||||
import 'chat_transcript_selection.dart';
|
||||
|
||||
/// Plain selectable text with its bare links made tappable: the operator's
|
||||
/// own message keeps every character exactly as typed (no markdown), and only
|
||||
/// `http(s)://`/`www.` runs outside `` `code` `` become links. Text without a
|
||||
/// link stays a plain [SelectableText].
|
||||
/// link stays a plain [SelectableText] outside a shared transcript document.
|
||||
class ChatLinkText extends StatefulWidget {
|
||||
const ChatLinkText(this.text, {super.key});
|
||||
|
||||
@@ -40,7 +41,11 @@ class _ChatLinkTextState extends State<ChatLinkText> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final text = widget.text;
|
||||
if (_found.isEmpty) return SelectableText(text);
|
||||
if (_found.isEmpty) {
|
||||
return ChatTranscriptSelectionScope.maybeOf(context) == null
|
||||
? SelectableText(text)
|
||||
: Text(text);
|
||||
}
|
||||
final spans = <InlineSpan>[];
|
||||
var at = 0;
|
||||
for (final link in _found) {
|
||||
|
||||
Reference in New Issue
Block a user