Skip to content

Latest commit

 

History

History
63 lines (46 loc) · 1.12 KB

File metadata and controls

63 lines (46 loc) · 1.12 KB

Electron Examples

From the Electron Docs

Drag and Drop

https://www.electronjs.org/docs/latest/tutorial/native-file-drag-drop

Progress Bar

windows.mainWindow.setProgressBar(c)

Recent Documents

app.addRecentDocument(path)

app.clearRecentDocuments()

File Associations

app.setAsDefaultProtocolClient(protocol[, path, args])

Spell Check

webPreferences: {
	spellcheck: true
}

Spell check context menu

myWindow.webContents.on('context-menu', (event, params) => {
  const menu = new Menu()

  // Add each spelling suggestion
  for (const suggestion of params.dictionarySuggestions) {
    menu.append(new MenuItem({
      label: suggestion,
      click: () => myWindow.webContents.replaceMisspelling(suggestion)
    }))
  }

  // Allow users to add the misspelled word to the dictionary
  if (params.misspelledWord) {
    menu.append(
      new MenuItem({
        label: 'Add to dictionary',
        click: () => myWindow.webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)
      })
    )
  }

  menu.popup()
})