SOLFIND
Web Lens
Portal home

スペルチェッカー | Electron

https://www.electronjs.org/ja/docs/latest/tutorial/spellchecker • 59 KB fetched
Open original page


スペルチェッカー | Electron メインコンテンツへ飛ぶ Electron ドキュメント API ブログ ツール * Electron Forge * Electron Fiddle コミュニティ * ガバナンス * 事例紹介 * リソース リリース 日本語 * English * Deutsch * Español * Français * 日本語 * Português * Русский * 中文 検索 * はじめよう * Electron のプロセス * ベストプラクティス * サンプル * ダークモード * デバイスアクセス * アプリ内購入 * * キーボード ショート カット * ディープリンク * デスクトップランチャーアクション * * Menus * マルチスレッド * ネイティブなファイルのドラッグ&ドロップ * ナビゲーション履歴 * 通知 * オフスクリーンレンダリング * オンライン/オフライン イベントの検出 * プログレスバー * 最近使用したドキュメント * * * BrowserWindow が表すファイル * * スペルチェッカー * ウェブ埋め込み * タスクバーのカスタマイズ * * ウインドウのカスタマイズ * 開発 * Native Node Modules * 配布方法 * テストとデバッグ * リファレンス * コントリビューション * * サンプル * スペルチェッカー 目次 スペルチェッカー v8 以降の Electron は Chromium のスペルチェッカーを内蔵しています。 WindowsとLinuxではHunspell辞書が搭載されており、macOSではネイティブのspellchecker APIが使用されています。 スペルチェッカーを有効にする方法は? ​ Electron v9 以降では、スペルチェッカーはデフォルトで有効になっています。 Electron 8 では、 webPreferences で有効にする必要があります。 const myWindow = new BrowserWindow ( { webPreferences : { spellcheck : true } } ) スペルチェッカーが使用する言語を設定する方法は? ​ macOS ではネイティブ API を使用しているため、スペルチェッカーが使用する言語を設定する方法はありません。 macOS では、デフォルトでネイティブのスペルチェッカーが自動的に使用されている言語を検出します。 Windows および Linux の場合、スペルチェッカーの言語を設定するために使用する Electron API がいくつかあります。 // アメリカ英語とフランス語のチェックする myWindow . webContents . session . setSpellCheckerLanguages ( [ 'en-US' , 'fr' ] ) // 利用できる言語コードの配列 const possibleLanguages = myWindow . webContents . session . availableSpellCheckerLanguages デフォルトで、spellchecker は現在の OS ロケールに一致する言語を有効にします。 スペルチェッカーの結果をコンテキストメニューに入れるには? ​ All the required information to generate a context menu is provided in the context-menu event on each webContents instance. この情報を使ってコンテキストメニューを作る簡単な方法を以下に示します。 const { Menu , MenuItem } = require ( 'electron' ) myWindow . webContents . on ( 'context-menu' , ( event , params ) => { const menu = new Menu ( ) // スペルの補完をそれぞれ追加します for ( const suggestion of params . dictionarySuggestions ) { menu . append ( new MenuItem ( { label : suggestion , click : ( ) => myWindow . webContents . replaceMisspelling ( suggestion ) } ) ) } // ユーザーがスペルミスの単語を辞書に登録できるようにします if ( params . misspelledWord ) { menu . append ( new MenuItem ( { label : 'Add to dictionary' , click : ( ) => myWindow . webContents . session . addWordToSpellCheckerDictionary ( params . misspelledWord ) } ) ) } menu . popup ( ) } ) スペルチェッカーは Google サービスを使用していますか? ​ スペルチェッカー自体はタイプした文字列をGoogleサービスへ送信しませんが、 hunspell 辞書ファイルがGoogle CDNからダウンロードされます。 この動作を避けたい場合は、辞書をダウンロードするための代替URLを指定することができます。 myWindow . webContents . session . setSpellCheckerDictionaryDownloadURL ( 'https://example.com/dictionaries/' ) Check out the docs for session.setSpellCheckerDictionaryDownloadURL for more information on where to get the dictionary files from and how you need to host them. このページを編集 前 BrowserWindow が表すファイル 次 ウェブ埋め込み * スペルチェッカーを有効にする方法は? * スペルチェッカーが使用する言語を設定する方法は? * スペルチェッカーの結果をコンテキストメニューに入れるには? * スペルチェッカーは Google サービスを使用していますか? ドキュメント * 始めましょう * API リファレンス チェックリスト * パフォーマンス * セキュリティ ツール * Electron Forge * Electron Fiddle コミュニティ * ガバナンス * リソース * Discord * Bluesky * X * Mastodon * Stack Overflow その他 * GitHub * Open Collective * Infrastructure Dashboard Copyright OpenJS Foundation and Electron contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation , please see our Trademark Policy and Trademark List . Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them. The OpenJS Foundation | Terms of Use | Privacy Policy | Bylaws | Code of Conduct | Trademark Policy | Trademark List | Cookie Policy Hosting and infrastructure graciously provided by

Links found on this page

  1. メインコンテンツへ飛ぶ [direct]
  2. Electron [direct]
  3. ドキュメント [direct]
  4. API [direct]
  5. ブログ [direct]
  6. Electron Forge [direct]
  7. Electron Fiddle [direct]
  8. ガバナンス [direct]
  9. 事例紹介 [direct]
  10. リソース [direct]
  11. リリース [direct]
  12. English [direct]
  13. Deutsch [direct]
  14. Español [direct]
  15. Français [direct]
  16. Português [direct]
  17. Русский [direct]
  18. 中文 [direct]
  19. Electron のプロセス [direct]
  20. ベストプラクティス [direct]
  21. サンプル [direct]
  22. ダークモード [direct]
  23. デバイスアクセス [direct]
  24. アプリ内購入 [direct]
  25. キーボード ショート カット [direct]
  26. ディープリンク [direct]
  27. デスクトップランチャーアクション [direct]
  28. Menus [direct]
  29. マルチスレッド [direct]
  30. ネイティブなファイルのドラッグ&ドロップ [direct]
  31. ナビゲーション履歴 [direct]
  32. 通知 [direct]
  33. オフスクリーンレンダリング [direct]
  34. オンライン/オフライン イベントの検出 [direct]
  35. プログレスバー [direct]
  36. 最近使用したドキュメント [direct]
  37. BrowserWindow が表すファイル [direct]
  38. ウェブ埋め込み [direct]
  39. タスクバーのカスタマイズ [direct]
  40. ウインドウのカスタマイズ [direct]
  41. 開発 [direct]
  42. Native Node Modules [direct]
  43. 配布方法 [direct]
  44. テストとデバッグ [direct]
  45. リファレンス [direct]
  46. コントリビューション [direct]
  47. context-menu [direct]
  48. session.setSpellCheckerDictionaryDownloadURL [direct]
  49. このページを編集 [direct]
  50. セキュリティ [direct]
  51. Discord [direct]
  52. Bluesky [direct]
  53. X [direct]
  54. Mastodon [direct]
  55. Stack Overflow [direct]
  56. GitHub [direct]
  57. Open Collective [direct]
  58. Infrastructure Dashboard [direct]
  59. OpenJS Foundation [direct]
  60. Trademark Policy [direct]
  61. Trademark List [direct]
  62. Terms of Use [direct]
  63. Privacy Policy [direct]
  64. Bylaws [direct]
  65. Code of Conduct [direct]
  66. Cookie Policy [direct]