-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Date shortcut ISO 8601 format as an option in preference #3094
Conversation
browser/main/lib/ConfigManager.js
Outdated
@@ -39,7 +39,8 @@ export const DEFAULT_CONFIG = { | |||
showCopyNotification: true, | |||
disableDirectWrite: false, | |||
defaultNote: 'ALWAYS_ASK', // 'ALWAYS_ASK', 'SNIPPET_NOTE', 'MARKDOWN_NOTE' | |||
showMenuBar: false | |||
showMenuBar: false, | |||
dateFormatISO8601: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn’t it be editor instead of ui?
@@ -293,7 +294,16 @@ class UiTab extends React.Component { | |||
</div> | |||
: null | |||
} | |||
|
|||
<div styleName='group-checkBoxSection'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should move this config down to editor setting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as you asked me I put the config in the editor setting
@@ -293,7 +295,16 @@ class UiTab extends React.Component { | |||
</div> | |||
: null | |||
} | |||
|
|||
{/* <div styleName='group-checkBoxSection'> |
There was a problem hiding this comment.
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 👍
@@ -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, |
There was a problem hiding this comment.
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 👍
browser/main/lib/ConfigManager.js
Outdated
@@ -40,6 +40,7 @@ export const DEFAULT_CONFIG = { | |||
disableDirectWrite: false, | |||
defaultNote: 'ALWAYS_ASK', // 'ALWAYS_ASK', 'SNIPPET_NOTE', 'MARKDOWN_NOTE' | |||
showMenuBar: false | |||
// dateFormatISO8601: false |
There was a problem hiding this comment.
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 👍
browser/components/MarkdownEditor.js
Outdated
@@ -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} |
There was a problem hiding this comment.
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 👍
@@ -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} |
There was a problem hiding this comment.
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 👍
@@ -738,6 +738,8 @@ class SnippetNoteDetail extends React.Component { | |||
enableSmartPaste={config.editor.enableSmartPaste} | |||
hotkey={config.hotkey} | |||
autoDetect={autoDetect} | |||
// dateISO8601={config.ui.dateFormatISO8601} |
There was a problem hiding this comment.
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 👍
There was a problem hiding this comment.
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.
@lockee14 can you fix the conflict before I approve your code please? |
done |
@lockee14 It seems 1 check has failed. Could you look into this and fix it? |
missing indentation and brace between line 229 - 234: before: 'Shift-Cmd-/': function (cm) { if (global.process.platform !== 'darwin') { return } [translateHotkey(hotkey.insertDateTime)]: function (cm) { const dateNow = new Date() cm.replaceSelection(dateNow.toLocaleString()) }, after: 'Shift-Cmd-/': function (cm) { if (global.process.platform !== 'darwin') { return } [translateHotkey(hotkey.insertDateTime)]: function (cm) { const dateNow = new Date() cm.replaceSelection(dateNow.toLocaleString()) } },
Maybe it's because of this rule? This is so strange, it haven't happen before. I'll investigate it when I'm at home |
by looking at it a second time I think I get it, the code should be:
translateHotkey seems to be here to handle compatibility issue between mac/linux/windows for the 'cmd' key thus:
I think it should solve the issue but I'd like a second look on it since I'm not familiar with the codebase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lockee14 can you fix your code according to my review?
cm.replaceSelection(dateNow.toLocaleDateString()) | ||
} | ||
}, | ||
'Cmd-/': function (cm) { |
There was a problem hiding this comment.
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())
}
}
@lockee14 ping! |
@lockee14 ping 2 |
ping3 @lockee14 if you not interested in this PR anymore I'll take over it after a week 👍 |
Sorry for not answering I'm too busy with other things and I don't remember what I did, it was a long time ago... |
That's alright, I'll take it over and finish it for you:) Unless u are interested in finish it yourself |
Take over here #3600 |
Description
Feature: #3064
Add an option in preference > interface to toggle the iso 8601 format for the Date shortcut using ctrl-/ and ctrl-shift-/
Issue fixed
Type of changes
Checklist:
IssueHunt Summary
IssueHunt has been backed by the following sponsors. Become a sponsor