sciencefair-land / sciencefair

The futuristic, fabulous and free desktop app for working with scientific literature :microscope: :book:
https://sciencefair-app.com
MIT License
604 stars 52 forks source link

[Reader] Search in article #61

Open phcerdan opened 7 years ago

phcerdan commented 7 years ago

Hey, I guess the amazing Lens reader rely on the browser search functionalities? How do we search from the electron app?

blahah commented 7 years ago

hmm good point - there is no browser find equivalent interface built into electron - we'll have to add it directly to our lens reader window, perhaps using one of these:

blahah commented 7 years ago

@CAYdenberg if we use electron-in-page-search, this would be achieved from inside the reader view as opposed to Lens. This has the benefit of also supporting other readers that we might want in the future (scholarlyHTML, ePub, etc.), and that it can be maintained outside Lens, and that we can apply it to other parts of the app if that becomes appropriate.

See the docs linked above, but it should work something like this on the reader webview:

const frame = html`<webview id="reader" class="${style.frame}"></webview>`

// frame customisation stuff

const readersearch = searchInPage(frame)

// register a keyboard shortcut for cmd[OR]ctrl+f
function onCmdOrCtrlF () {
  readersearch.openSearchWindow()
}

We have not yet set up the app-wide shortcut registering mechanism - but if you're interested in implementing this I can make that a priority.

blahah commented 7 years ago

@CAYdenberg haha I wrote this before I saw your PR #130 - looks like you took matters into your own hands which is awesome :D