Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@invisible/electron-find
Advanced tools
English | 简体中文
Find all matches for the text in electron app
$ npm install electron-find --save
# import module
import { remote, ipcRenderer } from 'electron'
import { FindInPage } from 'electron-find'
# create instance of FindInPage with default config
let findInPage = new FindInPage(remote.getCurrentWebContents())
findInPage.openFindWindow()
# use preload option, the find interface will be loaded when create instance
let findInPage = new FindInPage(remote.getCurrentWebContents(), {
preload: true
})
findInPage.openFindWindow()
# config parentElement of find interface, default is document.body
let findInPage = new FindInPage(remote.getCurrentWebContents(), {
parentElement: document.querySelector('#id')
})
findInPage.openFindWindow()
# config duration of find interface moving, default is 300 (ms)
let findInPage = new FindInPage(remote.getCurrentWebContents(), {
duration: 200
})
findInPage.openFindWindow()
# config offset relative to parentElement
let findInPage = new FindInPage(remote.getCurrentWebContents(), {
offsetTop: 20,
offsetRight: 30
})
findInPage.openFindWindow()
# config UI of find interface
let findInPage = new FindInPage(remote.getCurrentWebContents(), {
boxBgColor: '#333',
boxShadowColor: '#000',
inputColor: '#aaa',
inputBgColor: '#222',
inputFocusColor: '#555',
textColor: '#aaa',
textHoverBgColor: '#555',
caseSelectedColor: '#555'
})
findInPage.openFindWindow()
# there is a simply demo for reference
npm install
npm run dev
# there is another example with webview
npm install
npm run dev:webview
keys | function |
---|---|
Enter | find next |
Shift + Enter | find back |
Esc | close |
Besides, you can also register global shortcut to open the find window, just like the demo.
new FindInPage(webContents, [options])
webContents
Object(required) - The webContents of renderer processoptions
Object(optional)
preload
Boolean - Whether load the find interface when create instance. Default is false
.parentElement
Object - Specify parent dom of the find interface. Default is document.body
.duration
Number - Specify moving time when the find window open or close. Default is 300
(ms).offsetTop
Number - Specify offset relative to the top of parentElement. Default is 5
.offsetRight
Number - Specify offset relative to the right of parentElement. Default is 5
.boxBgColor
String - Specify background color of the find interface. Default is "#ffffff"
.boxShadowColor
String - Specify shadow color of the find interface. Default is "#909399"
.inputColor
String - Specify text color of the input form. Default is "#606266".inputBgColor
String - Specify background color of the input form. Default is "#f0f0f0"
.inputFocusColor
String - Specify border color of the input form when focusing. Default is "#c5ade0"
.textColor
String - Specify color of the text in find interface. Default is "#606266"
.textHoverBgColor
String - Specify background color of text in find interface when hovering. Default is "#eaeaea"
.caseSelectedColor
String - Specify border color of the matchCase button when selected. Default is "#c5ade0"
.Objects created with new FindInPage have the following instance methods:
findInPage.openFindWindow()
Open the find window when it is closed. Focus input form when the find window has opened.
findInPage.closeFindWindow()
Close the find window when it has opened.
findInPage.destroy()
Close the find window, and release memory.
FAQs
Find all matches for the text in electron app
We found that @invisible/electron-find demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.