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