mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-12-26 06:36:44 +00:00
fix: pasting a link on iOS results in incorrect behavior (#7326)
This commit is contained in:
parent
8b1a03713b
commit
17ae05a623
@ -111,6 +111,7 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage>
|
||||
}
|
||||
|
||||
EditorStyleCustomizer get styleCustomizer => widget.styleCustomizer;
|
||||
|
||||
DocumentBloc get documentBloc => context.read<DocumentBloc>();
|
||||
|
||||
late final EditorScrollController editorScrollController;
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user