Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
ElectronJS findInPage encuentra el siguiente resultado y resáltalo

Tengo una aplicación de electrones (^ 19.0.1) que abre un sitio web a través de una URL en BrowserWindow. Necesito crear una funcionalidad de búsqueda de texto como la barra de búsqueda estándar de Chrome.

введите сюда описание изображения

En este momento, puedo buscar y marcar texto de búsqueda a través de webContents.findInPage , pero no pude saltar al siguiente resultado, ¿qué estoy haciendo mal?

Mi main.js:

 win.webContents.on('found-in-page', (event, result) => { console.log(result) }); ipcMain.on('search-text', (event, arg) => { let nextRes = arg.direction == 'next' ? true : false const requestId = win.webContents.findInPage(arg.searchText, { forward: true, findNext: nextRes, matchCase: false }); }); ipcMain.on('stop-search', (event, arg) => { win.webContents.stopFindInPage('clearSelection'); });

Mi precarga.js:

 const { contextBridge, ipcRenderer } = require('electron') contextBridge.exposeInMainWorld('electronAPI', { searchText: (searchText, direction) => ipcRenderer.send('search-text', { searchText, direction }), stopSearch: () => ipcRenderer.send('stop-search') }) function search(direction) { let searched = document.getElementById("searchInput").value.trim(); if(searched.length > 0){ window.electronAPI.searchText(searched,direction) } document.getElementById("searchInput").focus() }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!