Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
12 changes: 10 additions & 2 deletions browser/components/CodeEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ export default class CodeEditor extends React.Component {
'Ctrl-/': function (cm) {
if (global.process.platform === 'darwin') { return }
const dateNow = new Date()
cm.replaceSelection(dateNow.toLocaleDateString())
if (self.props.dateFormatISO8601) {
cm.replaceSelection(dateNow.toISOString().split('T')[0])
} else {
cm.replaceSelection(dateNow.toLocaleDateString())
}
},
'Cmd-/': function (cm) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should remove the code for Cmd-/ and Shift-Ctrl-/ and replace that with [translateHotkey(hotkey.insertDateTime)]. You code should be something like this:

[translateHotkey(hotkey.insertDateTime)]: function (cm) {
  const dateNow = new Date()
  if (self.props.dateFormatISO8601) {
       cm.replaceSelection(dateNow.toISOString())
  } else {
       cm.replaceSelection(dateNow.toLocaleString())
  }
}

if (global.process.platform !== 'darwin') { return }
Expand All @@ -218,7 +222,11 @@ export default class CodeEditor extends React.Component {
'Shift-Ctrl-/': function (cm) {
if (global.process.platform === 'darwin') { return }
const dateNow = new Date()
cm.replaceSelection(dateNow.toLocaleString())
if (self.props.dateFormatISO8601) {
cm.replaceSelection(dateNow.toISOString())
} else {
cm.replaceSelection(dateNow.toLocaleString())
}
},
'Shift-Cmd-/': function (cm) {
if (global.process.platform !== 'darwin') { return }
Expand Down
2 changes: 2 additions & 0 deletions browser/components/MarkdownEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ class MarkdownEditor extends React.Component {
switchPreview={config.editor.switchPreview}
enableMarkdownLint={config.editor.enableMarkdownLint}
customMarkdownLintConfig={config.editor.customMarkdownLintConfig}
// dateISO8601={config.ui.dateFormatISO8601}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the code instead of just comment it out. Thank you 👍

dateFormatISO8601={config.editor.dateFormatISO8601}
/>
<MarkdownPreview styleName={this.state.status === 'PREVIEW'
? 'preview'
Expand Down
2 changes: 2 additions & 0 deletions browser/components/MarkdownSplitEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ class MarkdownSplitEditor extends React.Component {
switchPreview={config.editor.switchPreview}
enableMarkdownLint={config.editor.enableMarkdownLint}
customMarkdownLintConfig={config.editor.customMarkdownLintConfig}
// dateISO8601={config.ui.dateFormatISO8601}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the code instead of just comment it out. Thank you 👍

dateFormatISO8601={config.editor.dateFormatISO8601}
/>
<div styleName='slider' style={{left: this.state.codeEditorWidthInPercent + '%'}} onMouseDown={e => this.handleMouseDown(e)} >
<div styleName='slider-hitbox' />
Expand Down
2 changes: 2 additions & 0 deletions browser/main/Detail/SnippetNoteDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,8 @@ class SnippetNoteDetail extends React.Component {
enableSmartPaste={config.editor.enableSmartPaste}
hotkey={config.hotkey}
autoDetect={autoDetect}
// dateISO8601={config.ui.dateFormatISO8601}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the code instead of just comment it out. Thank you 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry I forgot to remove those before committing, it's done.

dateFormatISO8601={config.editor.dateFormatISO8601}
/>
}
</div>
Expand Down
4 changes: 3 additions & 1 deletion browser/main/lib/ConfigManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const DEFAULT_CONFIG = {
disableDirectWrite: false,
defaultNote: 'ALWAYS_ASK', // 'ALWAYS_ASK', 'SNIPPET_NOTE', 'MARKDOWN_NOTE'
showMenuBar: false
// dateFormatISO8601: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the code instead of just comment it out. Thank you 👍

},
editor: {
theme: 'base16-light',
Expand All @@ -65,7 +66,8 @@ export const DEFAULT_CONFIG = {
spellcheck: false,
enableSmartPaste: false,
enableMarkdownLint: false,
customMarkdownLintConfig: DEFAULT_MARKDOWN_LINT_CONFIG
customMarkdownLintConfig: DEFAULT_MARKDOWN_LINT_CONFIG,
dateFormatISO8601: false
},
preview: {
fontSize: '14',
Expand Down
26 changes: 24 additions & 2 deletions browser/main/modals/PreferencesModal/UiTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class UiTab extends React.Component {
saveTagsAlphabetically: this.refs.saveTagsAlphabetically.checked,
enableLiveNoteCounts: this.refs.enableLiveNoteCounts.checked,
showMenuBar: this.refs.showMenuBar.checked,
// dateFormatISO8601: this.refs.dateFormatISO8601.checked,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the code instead of just comment it out. Thank you 👍

disableDirectWrite: this.refs.uiD2w != null
? this.refs.uiD2w.checked
: false
Expand Down Expand Up @@ -105,7 +106,8 @@ class UiTab extends React.Component {
spellcheck: this.refs.spellcheck.checked,
enableSmartPaste: this.refs.enableSmartPaste.checked,
enableMarkdownLint: this.refs.enableMarkdownLint.checked,
customMarkdownLintConfig: this.customMarkdownLintConfigCM.getCodeMirror().getValue()
customMarkdownLintConfig: this.customMarkdownLintConfigCM.getCodeMirror().getValue(),
dateFormatISO8601: this.refs.dateFormatISO8601.checked
},
preview: {
fontSize: this.refs.previewFontSize.value,
Expand Down Expand Up @@ -293,7 +295,16 @@ class UiTab extends React.Component {
</div>
: null
}

{/* <div styleName='group-checkBoxSection'>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the code instead of just comment it out. Thank you 👍

<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-checkBoxSection'>
Expand Down Expand Up @@ -600,6 +611,17 @@ class UiTab extends React.Component {
</label>
</div>

<div styleName='group-checkBoxSection'>
<label>
<input onChange={(e) => this.handleUIChange(e)}
checked={this.state.config.editor.dateFormatISO8601}
ref='dateFormatISO8601'
type='checkbox'
/>&nbsp;
{i18n.__('Date shortcut use iso 8601 format')}
</label>
</div>

<div styleName='group-section'>
<div styleName='group-section-label'>
{i18n.__('Matching character pairs')}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "boost",
"productName": "Boostnote",
"version": "0.11.17",
"version": "0.11.17",
"main": "index.js",
"description": "Boostnote",
"license": "GPL-3.0",
Expand Down