fix: pasting a link on iOS results in incorrect behavior (#7326)

This commit is contained in:
Morn 2025-02-07 14:49:50 +08:00 committed by GitHub
parent 8b1a03713b
commit 17ae05a623
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 1 deletions

View File

@ -111,6 +111,7 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage>
}
EditorStyleCustomizer get styleCustomizer => widget.styleCustomizer;
DocumentBloc get documentBloc => context.read<DocumentBloc>();
late final EditorScrollController editorScrollController;

View File

@ -132,6 +132,7 @@ class ClipboardService {
final html = await reader.readValue(Formats.htmlText);
final inAppJson = await reader.readValue(inAppJsonFormat);
final tableJson = await reader.readValue(tableJsonFormat);
final uri = await reader.readValue(Formats.uri);
(String, Uint8List?)? image;
if (reader.canProvide(Formats.png)) {
image = ('png', await reader.readFile(Formats.png));
@ -144,7 +145,7 @@ class ClipboardService {
}
return ClipboardServiceData(
plainText: plainText,
plainText: plainText ?? uri?.uri.toString(),
html: html,
image: image,
inAppJson: inAppJson,

View File

@ -144,6 +144,13 @@ Future<void> doPaste(EditorState editorState) async {
}
if (plainText != null && plainText.isNotEmpty) {
final currentSelection = editorState.selection;
if (currentSelection == null) {
await editorState.updateSelectionWithReason(
selection,
reason: SelectionUpdateReason.uiEvent,
);
}
await editorState.pasteText(plainText);
return Log.info('Pasted plain text');
}