feat: enable builtin spellchecker (#20692)
* chore: add code required to use chromes spellchecker * chore: fix linting * chore: manifests needs buildflags now * chore: add dictionarySuggestions to the context menu event when the spellchecker is active * chore: enable by default for windows builds * chore: add patch to remove incognito usage in the spellchecker * chore: add dependencies on spellcheck common and flags * chore: conditionally include spell check panel impl * chore: fix deps for spellcheck feature flags * chore: add patch for electron resources * chore: add dependency on //components/language/core/browser * chore: patches to make hunspell work on windows * build: collect hunspell dictionaries into a zip file and publish * chore: clean up patches * chore: add docs and set spell checker url method * chore: fix error handling * chore: fix hash logic * build: update hunspell filename generator * fix: default spellchecker list to the current system locale if we can * docs: document the language getter * chore: patch IDS_ resources for linux builds * feat: add spellcheck webpref flag to disable the builtin spellchecker * chore: fix docs typo * chore: clean up spellchecker impl as per feedback * remove unneeded deps
This commit is contained in:
parent
23ca7e3733
commit
6bcf67e051
34 changed files with 560 additions and 10 deletions
35
script/gen-hunspell-filenames.js
Normal file
35
script/gen-hunspell-filenames.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const check = process.argv.includes('--check')
|
||||
|
||||
const dictsPath = path.resolve(__dirname, '..', '..', 'third_party', 'hunspell_dictionaries')
|
||||
const gclientPath = 'third_party/hunspell_dictionaries'
|
||||
|
||||
const allFiles = fs.readdirSync(dictsPath)
|
||||
|
||||
const dictionaries = allFiles
|
||||
.filter(file => path.extname(file) === '.bdic')
|
||||
|
||||
const licenses = allFiles
|
||||
.filter(file => file.startsWith('LICENSE') || file.startsWith('COPYING'))
|
||||
|
||||
const content = `hunspell_dictionaries = [
|
||||
${dictionaries.map(f => `"//${path.posix.join(gclientPath, f)}"`).join(',\n ')},
|
||||
]
|
||||
|
||||
hunspell_licenses = [
|
||||
${licenses.map(f => `"//${path.posix.join(gclientPath, f)}"`).join(',\n ')},
|
||||
]
|
||||
`
|
||||
|
||||
const filenamesPath = path.resolve(__dirname, '..', 'filenames.hunspell.gni')
|
||||
|
||||
if (check) {
|
||||
const currentContent = fs.readFileSync(filenamesPath, 'utf8')
|
||||
if (currentContent !== content) {
|
||||
throw new Error('hunspell filenames need to be regenerated, latest generation does not match current file. Please run node gen-hunspell-filenames.js')
|
||||
}
|
||||
} else {
|
||||
fs.writeFileSync(filenamesPath, content)
|
||||
}
|
|
@ -29,6 +29,7 @@ addAllFiles(path.resolve(__dirname, '../patches'))
|
|||
|
||||
// Create Hash
|
||||
const hasher = crypto.createHash('SHA256')
|
||||
hasher.update(`HASH_VERSION:${HASH_VERSION}`)
|
||||
for (const file of filesToHash) {
|
||||
hasher.update(fs.readFileSync(file))
|
||||
}
|
||||
|
|
|
@ -130,6 +130,7 @@ function assetsForVersion (version, validatingRelease) {
|
|||
`electron-${version}-win32-arm64.zip`,
|
||||
`electron-api.json`,
|
||||
`electron.d.ts`,
|
||||
`hunspell_dictionaries.zip`,
|
||||
`ffmpeg-${version}-darwin-x64.zip`,
|
||||
`ffmpeg-${version}-linux-arm64.zip`,
|
||||
`ffmpeg-${version}-linux-armv7l.zip`,
|
||||
|
|
|
@ -106,6 +106,11 @@ def main():
|
|||
shutil.copy2(os.path.join(OUT_DIR, 'mksnapshot.zip'), mksnapshot_zip)
|
||||
upload_electron(release, mksnapshot_zip, args)
|
||||
|
||||
if PLATFORM == 'linux' and get_target_arch() == 'x64':
|
||||
# Upload the hunspell dictionaries only from the linux x64 build
|
||||
hunspell_dictionaries_zip = os.path.join(OUT_DIR, 'hunspell_dictionaries.zip')
|
||||
upload_electron(release, hunspell_dictionaries_zip, args)
|
||||
|
||||
if not tag_exists and not args.upload_to_s3:
|
||||
# Upload symbols to symbol server.
|
||||
run_python_upload_script('upload-symbols.py')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue