1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 18:26:26 +00:00

add Date ISO 8601 format

This commit is contained in:
mehdi
2019-06-24 06:10:31 +09:00
parent 49c75e3599
commit 6e45ee6a38
7 changed files with 27 additions and 5 deletions

View File

@@ -208,7 +208,11 @@ export default class CodeEditor extends React.Component {
'Ctrl-/': function (cm) { 'Ctrl-/': function (cm) {
if (global.process.platform === 'darwin') { return } if (global.process.platform === 'darwin') { return }
const dateNow = new Date() const dateNow = new Date()
cm.replaceSelection(dateNow.toLocaleDateString()) if (self.props.dateISO8601) {
cm.replaceSelection(dateNow.toISOString().split('T')[0])
} else {
cm.replaceSelection(dateNow.toLocaleDateString())
}
}, },
'Cmd-/': function (cm) { 'Cmd-/': function (cm) {
if (global.process.platform !== 'darwin') { return } if (global.process.platform !== 'darwin') { return }
@@ -218,7 +222,11 @@ export default class CodeEditor extends React.Component {
'Shift-Ctrl-/': function (cm) { 'Shift-Ctrl-/': function (cm) {
if (global.process.platform === 'darwin') { return } if (global.process.platform === 'darwin') { return }
const dateNow = new Date() const dateNow = new Date()
cm.replaceSelection(dateNow.toLocaleString()) if (self.props.dateISO8601) {
cm.replaceSelection(dateNow.toISOString())
} else {
cm.replaceSelection(dateNow.toLocaleString())
}
}, },
'Shift-Cmd-/': function (cm) { 'Shift-Cmd-/': function (cm) {
if (global.process.platform !== 'darwin') { return } if (global.process.platform !== 'darwin') { return }

View File

@@ -321,6 +321,7 @@ class MarkdownEditor extends React.Component {
switchPreview={config.editor.switchPreview} switchPreview={config.editor.switchPreview}
enableMarkdownLint={config.editor.enableMarkdownLint} enableMarkdownLint={config.editor.enableMarkdownLint}
customMarkdownLintConfig={config.editor.customMarkdownLintConfig} customMarkdownLintConfig={config.editor.customMarkdownLintConfig}
dateISO8601={config.ui.dateFormatISO8601}
/> />
<MarkdownPreview styleName={this.state.status === 'PREVIEW' <MarkdownPreview styleName={this.state.status === 'PREVIEW'
? 'preview' ? 'preview'

View File

@@ -181,6 +181,7 @@ class MarkdownSplitEditor extends React.Component {
switchPreview={config.editor.switchPreview} switchPreview={config.editor.switchPreview}
enableMarkdownLint={config.editor.enableMarkdownLint} enableMarkdownLint={config.editor.enableMarkdownLint}
customMarkdownLintConfig={config.editor.customMarkdownLintConfig} customMarkdownLintConfig={config.editor.customMarkdownLintConfig}
dateISO8601={config.ui.dateFormatISO8601}
/> />
<div styleName='slider' style={{left: this.state.codeEditorWidthInPercent + '%'}} onMouseDown={e => this.handleMouseDown(e)} > <div styleName='slider' style={{left: this.state.codeEditorWidthInPercent + '%'}} onMouseDown={e => this.handleMouseDown(e)} >
<div styleName='slider-hitbox' /> <div styleName='slider-hitbox' />

View File

@@ -738,6 +738,7 @@ class SnippetNoteDetail extends React.Component {
enableSmartPaste={config.editor.enableSmartPaste} enableSmartPaste={config.editor.enableSmartPaste}
hotkey={config.hotkey} hotkey={config.hotkey}
autoDetect={autoDetect} autoDetect={autoDetect}
dateISO8601={config.ui.dateFormatISO8601}
/> />
} }
</div> </div>

View File

@@ -39,7 +39,8 @@ export const DEFAULT_CONFIG = {
showCopyNotification: true, showCopyNotification: true,
disableDirectWrite: false, disableDirectWrite: false,
defaultNote: 'ALWAYS_ASK', // 'ALWAYS_ASK', 'SNIPPET_NOTE', 'MARKDOWN_NOTE' defaultNote: 'ALWAYS_ASK', // 'ALWAYS_ASK', 'SNIPPET_NOTE', 'MARKDOWN_NOTE'
showMenuBar: false showMenuBar: false,
dateFormatISO8601: false
}, },
editor: { editor: {
theme: 'base16-light', theme: 'base16-light',

View File

@@ -78,6 +78,7 @@ class UiTab extends React.Component {
saveTagsAlphabetically: this.refs.saveTagsAlphabetically.checked, saveTagsAlphabetically: this.refs.saveTagsAlphabetically.checked,
enableLiveNoteCounts: this.refs.enableLiveNoteCounts.checked, enableLiveNoteCounts: this.refs.enableLiveNoteCounts.checked,
showMenuBar: this.refs.showMenuBar.checked, showMenuBar: this.refs.showMenuBar.checked,
dateFormatISO8601: this.refs.dateFormatISO8601.checked,
disableDirectWrite: this.refs.uiD2w != null disableDirectWrite: this.refs.uiD2w != null
? this.refs.uiD2w.checked ? this.refs.uiD2w.checked
: false : false
@@ -293,7 +294,16 @@ class UiTab extends React.Component {
</div> </div>
: null : null
} }
<div styleName='group-checkBoxSection'>
<label>
<input onChange={(e) => this.handleUIChange(e)}
checked={this.state.config.ui.dateFormatISO8601}
ref='dateFormatISO8601'
type='checkbox'
/>&nbsp;
{i18n.__('Date shortcut use iso 8601 format')}
</label>
</div>
<div styleName='group-header2'>Tags</div> <div styleName='group-header2'>Tags</div>
<div styleName='group-checkBoxSection'> <div styleName='group-checkBoxSection'>

View File

@@ -1,7 +1,7 @@
{ {
"name": "boost", "name": "boost",
"productName": "Boostnote", "productName": "Boostnote",
"version": "0.11.17", "version": "0.11.17",
"main": "index.js", "main": "index.js",
"description": "Boostnote", "description": "Boostnote",
"license": "GPL-3.0", "license": "GPL-3.0",