1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

new feature: auto detect snippet language

only try to detect after pasting and mode has not been set and default snippet language is "Auto Detect"
This commit is contained in:
HarlanLuo
2019-01-01 16:23:15 +08:00
parent 05da826c24
commit deb2cd0156
5 changed files with 104 additions and 7 deletions

View File

@@ -46,6 +46,8 @@ export function createSnippetNote (storage, folder, dispatch, location, params,
tags = params.tagname.split(' ')
}
const defaultLanguage = config.editor.snippetDefaultLanguage === 'Auto Detect' ? null : config.editor.snippetDefaultLanguage
return dataApi
.createNote(storage, {
type: 'SNIPPET_NOTE',
@@ -56,7 +58,7 @@ export function createSnippetNote (storage, folder, dispatch, location, params,
snippets: [
{
name: '',
mode: config.editor.snippetDefaultLanguage || 'text',
mode: defaultLanguage,
content: '',
linesHighlighted: []
}