Search code examples
node.jsmacoselectronquicklook

Using QLPreviewPanel with Electron


We are looking into migrating our Objc Application to an Electron one, since the native one is just a WebWrapper around a website already.

We are missing one important feature: the ability to use QuickLook to preview files.

We managed to wrap qlmanage (Quick Look Server debug and management tool) in a npm module (based on this older code) but this is not the same as using QLPreviewPanel.

qlmanage launches an app in the Dock, and can spawn multiple instances of it, unlike QLpreviewPanel.

enter image description here

  • Does anyone managed to use Quicklook properly with Electron?
  • Is it possible to create a npm module in C++ using the Foundation Framework from Apple, and then requiring this module from Electron?

Any insight would be greatly appreciated.


Solution

  • We ended up adding this feature directly in Electron.

    This will be released soon on the BrowserWindow api, with the following method signature:

    previewFile(path [,displayname])

    This way everyone gets to use it!