index.js 978 B

12345678910111213141516171819202122232425
  1. // [adill] This is not context aware and, as such, won't load in newer Electron versions
  2. // We can and should strip `discord_spellcheck` down to CLD only once all channels are on Electron 9
  3. function getLegacySpellchecker() {
  4. const Spellchecker = require('spellchecker').Spellchecker;
  5. const instance = new Spellchecker();
  6. return {
  7. setDictionary: instance.setDictionary.bind(instance),
  8. getAvailableDictionaries: instance.getAvailableDictionaries.bind(instance),
  9. isMisspelled: instance.isMisspelled.bind(instance),
  10. getCorrectionsForMisspelling: instance.getCorrectionsForMisspelling.bind(instance),
  11. };
  12. }
  13. // [adill] This is not context aware and, as such, won't load in newer Electron versions
  14. // We can and should strip `discord_spellcheck` down to CLD only once all channels are on Electron 9
  15. function getKeyboardLayout() {
  16. return require('keyboard-layout');
  17. }
  18. module.exports = {
  19. cld: require('cld'),
  20. getLegacySpellchecker,
  21. getKeyboardLayout,
  22. };