mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-07 05:04:58 +08:00
fix(keymaps): JSON => CSON during cibuild final phase
This commit is contained in:
parent
9a87392617
commit
5b0c82abb1
7 changed files with 15 additions and 9 deletions
|
@ -146,7 +146,7 @@ module.exports = (grunt) ->
|
|||
|
||||
csonConfig =
|
||||
options:
|
||||
rootObject: true
|
||||
rootObject: false
|
||||
cachePath: path.join(home, '.nylas', 'compile-cache', 'grunt-cson')
|
||||
|
||||
glob_to_multiple:
|
||||
|
@ -154,6 +154,7 @@ module.exports = (grunt) ->
|
|||
src: [
|
||||
'menus/*.cson'
|
||||
'keymaps/*.cson'
|
||||
'keymaps/templates/*.cson'
|
||||
'static/**/*.cson'
|
||||
]
|
||||
dest: appDir
|
||||
|
|
|
@ -36,7 +36,9 @@ class PreferencesKeymaps extends React.Component
|
|||
fs.readdir templatesDir, (err, files) =>
|
||||
return unless files and files instanceof Array
|
||||
templates = files.filter (filename) =>
|
||||
path.extname(filename) is '.cson'
|
||||
path.extname(filename) is '.cson' or path.extname(filename) is '.json'
|
||||
templates = templates.map (filename) =>
|
||||
path.parse(filename).name
|
||||
@setState(templates: templates)
|
||||
|
||||
_getStateFromKeymaps: =>
|
||||
|
@ -55,7 +57,7 @@ class PreferencesKeymaps extends React.Component
|
|||
value={@props.config.get('core.keymapTemplate')}
|
||||
onChange={ (event) => @props.config.set('core.keymapTemplate', event.target.value) }>
|
||||
{ @state.templates.map (template) =>
|
||||
<option key={template} value={template}>{path.basename(template, '.cson')}</option>
|
||||
<option key={template} value={template}>{template}</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -22,7 +22,7 @@ module.exports =
|
|||
type: 'string'
|
||||
keymapTemplate:
|
||||
type: 'string'
|
||||
default: 'Gmail.cson'
|
||||
default: 'Gmail'
|
||||
attachments:
|
||||
type: 'object'
|
||||
properties:
|
||||
|
|
|
@ -10,8 +10,8 @@ KeymapManager::onDidLoadBundledKeymaps = (callback) ->
|
|||
|
||||
KeymapManager::loadBundledKeymaps = ->
|
||||
# Load the base keymap and the base.platform keymap
|
||||
baseKeymap = path.join(@resourcePath, 'keymaps', 'base.cson')
|
||||
basePlatformKeymap = path.join(@resourcePath, 'keymaps', "base.#{process.platform}.cson")
|
||||
baseKeymap = fs.resolve(path.join(@resourcePath, 'keymaps'), 'base', ['cson', 'json'])
|
||||
basePlatformKeymap = fs.resolve(path.join(@resourcePath, 'keymaps'), "base-#{process.platform}", ['cson', 'json'])
|
||||
@loadKeymap(baseKeymap)
|
||||
@loadKeymap(basePlatformKeymap)
|
||||
|
||||
|
@ -22,9 +22,12 @@ KeymapManager::loadBundledKeymaps = ->
|
|||
@removeBindingsFromSource(templateKeymapPath) if templateKeymapPath
|
||||
templateFile = atom.config.get(templateConfigKey)
|
||||
if templateFile
|
||||
templateKeymapPath = path.join(@resourcePath, 'keymaps', 'templates', templateFile)
|
||||
@loadKeymap(templateKeymapPath)
|
||||
@emitter.emit('did-reload-keymap', {path: templateKeymapPath})
|
||||
templateKeymapPath = fs.resolve(path.join(@resourcePath, 'keymaps', 'templates'), templateFile, ['cson', 'json'])
|
||||
if fs.existsSync(templateKeymapPath)
|
||||
@loadKeymap(templateKeymapPath)
|
||||
@emitter.emit('did-reload-keymap', {path: templateKeymapPath})
|
||||
else
|
||||
console.warn("Could not find #{templateKeymapPath}")
|
||||
|
||||
atom.config.observe(templateConfigKey, reloadTemplateKeymap)
|
||||
reloadTemplateKeymap()
|
||||
|
|
Loading…
Add table
Reference in a new issue