mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-10-31 10:03:18 +00:00 
			
		
		
		
	fix: cannot paste text into the title of the doc (#6821)
* fix: cannot paste text into the title of the doc * test: add paste in title test
This commit is contained in:
		
							parent
							
								
									7e528cf260
								
							
						
					
					
						commit
						8a7cedd5b4
					
				| @ -347,5 +347,27 @@ void main() { | |||||||
| 
 | 
 | ||||||
|       await tester.pumpAndSettle(); |       await tester.pumpAndSettle(); | ||||||
|     }); |     }); | ||||||
|  | 
 | ||||||
|  |     testWidgets('paste text in title, check if the text is updated', | ||||||
|  |         (tester) async { | ||||||
|  |       await tester.initializeAppFlowy(); | ||||||
|  |       await tester.tapAnonymousSignInButton(); | ||||||
|  | 
 | ||||||
|  |       await tester.createNewPageWithNameUnderParent(); | ||||||
|  | 
 | ||||||
|  |       await Clipboard.setData(const ClipboardData(text: _testDocumentName)); | ||||||
|  | 
 | ||||||
|  |       final title = tester.editor.findDocumentTitle(''); | ||||||
|  |       await tester.tapButton(title); | ||||||
|  |       await tester.simulateKeyEvent( | ||||||
|  |         LogicalKeyboardKey.keyV, | ||||||
|  |         isMetaPressed: UniversalPlatform.isMacOS, | ||||||
|  |         isControlPressed: !UniversalPlatform.isMacOS, | ||||||
|  |       ); | ||||||
|  |       await tester.pumpAndSettle(); | ||||||
|  | 
 | ||||||
|  |       final newTitle = tester.editor.findDocumentTitle(_testDocumentName); | ||||||
|  |       expect(newTitle, findsOneWidget); | ||||||
|  |     }); | ||||||
|   }); |   }); | ||||||
| } | } | ||||||
|  | |||||||
| @ -30,6 +30,11 @@ final CommandShortcutEvent customPasteCommand = CommandShortcutEvent( | |||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| CommandShortcutEventHandler _pasteCommandHandler = (editorState) { | CommandShortcutEventHandler _pasteCommandHandler = (editorState) { | ||||||
|  |   final selection = editorState.selection; | ||||||
|  |   if (selection == null) { | ||||||
|  |     return KeyEventResult.ignored; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   doPaste(editorState).then((_) { |   doPaste(editorState).then((_) { | ||||||
|     final context = editorState.document.root.context; |     final context = editorState.document.root.context; | ||||||
|     if (context != null && context.mounted) { |     if (context != null && context.mounted) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Lucas
						Lucas