Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion browser/main/Detail/SnippetNoteDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,11 +573,12 @@ class SnippetNoteDetail extends React.Component {
}

addSnippet () {
const { config } = this.props
const { note } = this.state

note.snippets = note.snippets.concat([{
name: '',
mode: 'Plain Text',
mode: config.editor.snippetDefaultLanguage || 'text',
content: ''
}])
const snippetIndex = note.snippets.length - 1
Expand Down
5 changes: 3 additions & 2 deletions browser/main/NewNoteButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ class NewNoteButton extends React.Component {
}

handleNewNoteButtonClick (e) {
const { location, dispatch } = this.props
const { location, dispatch, config } = this.props
const { storage, folder } = this.resolveTargetFolder()

modal.open(NewNoteModal, {
storage: storage.key,
folder: folder.key,
dispatch,
location
location,
config
})
}

Expand Down
4 changes: 2 additions & 2 deletions browser/main/modals/NewNoteModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class NewNoteModal extends React.Component {
handleSnippetNoteButtonClick (e) {
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_SNIPPET')
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_ALLNOTE')
const { storage, folder, dispatch, location } = this.props
const { storage, folder, dispatch, location, config } = this.props

dataApi
.createNote(storage, {
Expand All @@ -72,7 +72,7 @@ class NewNoteModal extends React.Component {
snippets: [
{
name: '',
mode: 'text',
mode: config.editor.snippetDefaultLanguage || 'text',
content: ''
}
]
Expand Down
2 changes: 1 addition & 1 deletion browser/main/modals/PreferencesModal/ConfigTab.styl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
line-height 30px

.group-section-label
width 150px
width 200px
text-align left
margin-right 10px
font-size 14px
Expand Down
17 changes: 17 additions & 0 deletions browser/main/modals/PreferencesModal/UiTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class UiTab extends React.Component {
displayLineNumbers: this.refs.editorDisplayLineNumbers.checked,
switchPreview: this.refs.editorSwitchPreview.value,
keyMap: this.refs.editorKeyMap.value,
snippetDefaultLanguage: this.refs.editorSnippetDefaultLanguage.value,
scrollPastEnd: this.refs.scrollPastEnd.checked,
fetchUrlTitle: this.refs.editorFetchUrlTitle.checked
},
Expand Down Expand Up @@ -387,6 +388,22 @@ class UiTab extends React.Component {
</div>
</div>

<div styleName='group-section'>
<div styleName='group-section-label'>
{i18n.__('Snippet Default Language')}
</div>
<div styleName='group-section-control'>
<select value={config.editor.snippetDefaultLanguage}
ref='editorSnippetDefaultLanguage'
onChange={(e) => this.handleUIChange(e)}
>
{
_.sortBy(CodeMirror.modeInfo.map(mode => mode.name)).map(name => (<option key={name} value={name}>{name}</option>))
}
</select>
</div>
</div>

<div styleName='group-checkBoxSection'>
<label>
<input onChange={(e) => this.handleUIChange(e)}
Expand Down
3 changes: 2 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,6 @@
"Allow styles": "Allow styles",
"Allow dangerous html tags": "Allow dangerous html tags",
"Convert textual arrows to beautiful signs. ⚠ This will interfere with using HTML comments in your Markdown.": "Convert textual arrows to beautiful signs. ⚠ This will interfere with using HTML comments in your Markdown.",
"⚠ You have pasted a link referring an attachment that could not be found in the storage location of this note. Pasting links referring attachments is only supported if the source and destination location is the same storage. Please Drag&Drop the attachment instead! ⚠": "⚠ You have pasted a link referring an attachment that could not be found in the storage location of this note. Pasting links referring attachments is only supported if the source and destination location is the same storage. Please Drag&Drop the attachment instead! ⚠"
"⚠ You have pasted a link referring an attachment that could not be found in the storage location of this note. Pasting links referring attachments is only supported if the source and destination location is the same storage. Please Drag&Drop the attachment instead! ⚠": "⚠ You have pasted a link referring an attachment that could not be found in the storage location of this note. Pasting links referring attachments is only supported if the source and destination location is the same storage. Please Drag&Drop the attachment instead! ⚠",
"Snippet Default Language": "Snippet Default Language"
}
3 changes: 2 additions & 1 deletion locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,6 @@
"Allow styles": "Accepter les styles",
"Allow dangerous html tags": "Accepter les tags html dangereux",
"Convert textual arrows to beautiful signs. ⚠ This will interfere with using HTML comments in your Markdown.": "Convertir des flèches textuelles en jolis signes. ⚠ Cela va interferérer avec les éventuels commentaires HTML dans votre Markdown.",
"⚠ You have pasted a link referring an attachment that could not be found in the storage location of this note. Pasting links referring attachments is only supported if the source and destination location is the same storage. Please Drag&Drop the attachment instead! ⚠": "⚠ Vous avez collé un lien qui référence une pièce-jointe qui n'a pas pu être récupéré dans le dossier de stockage de la note. Coller des liens qui font référence à des pièces-jointes ne fonctionne que si la source et la destination et la même. Veuillez plutôt utiliser du Drag & Drop ! ⚠"
"⚠ You have pasted a link referring an attachment that could not be found in the storage location of this note. Pasting links referring attachments is only supported if the source and destination location is the same storage. Please Drag&Drop the attachment instead! ⚠": "⚠ Vous avez collé un lien qui référence une pièce-jointe qui n'a pas pu être récupéré dans le dossier de stockage de la note. Coller des liens qui font référence à des pièces-jointes ne fonctionne que si la source et la destination et la même. Veuillez plutôt utiliser du Drag & Drop ! ⚠",
"Snippet Default Language": "Langage par défaut d'un snippet"
}