Skip to content

Commit

Permalink
fix: missing paste after permission dialog in iOS
Browse files Browse the repository at this point in the history
Fixes:
> When I do copy and paste http url, a system asks whether to "Allow a Paste from Safari". If I click Allow, nothing happens. However, subsequent pastes work.

This is a naive fix intended to demonstrate the issue for discussion, and it requires cleanup/refactor before landing.
  • Loading branch information
chrisirhc committed Jan 24, 2025
1 parent 2a03498 commit 540621c
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,19 @@ final _listTypes = [

extension EditorCopyPaste on EditorState {
Future<void> pasteSingleLineNode(Node insertedNode) async {
final selection = await deleteSelectionIfNeeded();
if (selection == null) {
return;
AppFlowyEditorLog.editor
.debug('EditorCopyPaste: initiate paste single line node');
var selection = await deleteSelectionIfNeeded();
var attempts = 0;
while (selection == null) {
await Future.delayed(Duration(milliseconds: 50));
selection = await deleteSelectionIfNeeded();
attempts++;
if (attempts > 10) {
AppFlowyEditorLog.editor
.debug('EditorCopyPaste: selection is empty, attempted $attempts times');
return;
}
}
final node = getNodeAtPath(selection.start.path);
final delta = node?.delta;
Expand Down

0 comments on commit 540621c

Please sign in to comment.