
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-ctrl-f
Advanced tools
A library that use React to realize the function of Ctrl + F in web version
import {
MatchText,
SearchProvider,
SearchContext,
SearchEventContext,
} from 'react-ctrl-f';
id is required, you need to set a unique IDignorecase is optional, default is true<MatchText id='match-text-id-1'>Hello world</MatchText>
const { searchValue, activeCount, totalCount } = useContext(SearchContext);
Three events are provided to update store
const { onSearchChange, onPrev, onNext } = useContext(SearchEventContext);
SearchProvider need to Wrap all SearchContext , SearchEventContext
and MatchText
properties
value is optional
value.fixedHeaderHeight is optional, type is numbervalue.onScroll is optional, custom onScroll functioncase:
import React from 'react';
import { MatchText, SearchProvider } from 'react-ctrl-f';
export default function App() {
const { searchValue, activeCount, totalCount } = useContext(SearchContext);
const { onSearchChange, onPrev, onNext } = useContext(SearchEventContext);
return (
<SearchProvider>
<div
style={{
position: 'fixed',
top: '0px',
left: '0px',
width: '100%',
border: '1px solid green',
}}
>
<input
style={{ width: 200, marginRight: '12px', height: '24px' }}
value={searchValue}
onChange={onSearchChange}
/>
<button
style={{ height: '28px' }}
title='Up'
onClick={() => onPrev(100)}
>
Prev
</button>
<span style={{ padding: '0px 12px' }}>
{activeCount}/{totalCount}
</span>
<button
style={{ height: '28px' }}
title='Down'
onClick={() => onNext(100)}
>
Next
</button>
</div>
<p>
<MatchText id='match-1'>
React components implement a render() method that takes input data
and returns what to display. This example uses an XML-like syntax
called JSX. Input data that is passed into the component can be
accessed by render() via this.props. JSX is optional and not
required to use React.
</MatchText>
</p>
</SearchProvider>
);
}
see example src/pages/Home.tsx and src/pages/Search.tsx
FAQs
Ctrl + f function realized by react
The npm package react-ctrl-f receives a total of 1,430 weekly downloads. As such, react-ctrl-f popularity was classified as popular.
We found that react-ctrl-f demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.