mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 10:36:22 +08:00
refactor: find in page (#7086)
- refactor rxjs data flow - use canvas text to mitigate searchable search box input text issue
This commit is contained in:
@@ -5,7 +5,11 @@ import { useCallback, useEffect } from 'react';
|
||||
export function useRegisterFindInPageCommands() {
|
||||
const findInPage = useService(FindInPageService).findInPage;
|
||||
const toggleVisible = useCallback(() => {
|
||||
findInPage.toggleVisible();
|
||||
// get the selected text in page
|
||||
const selection = window.getSelection();
|
||||
const selectedText = selection?.toString();
|
||||
|
||||
findInPage.toggleVisible(selectedText);
|
||||
}, [findInPage]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user