mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
refactor: move the config down to editor setting
This commit is contained in:
@@ -208,7 +208,7 @@ export default class CodeEditor extends React.Component {
|
||||
'Ctrl-/': function (cm) {
|
||||
if (global.process.platform === 'darwin') { return }
|
||||
const dateNow = new Date()
|
||||
if (self.props.dateISO8601) {
|
||||
if (self.props.dateFormatISO8601) {
|
||||
cm.replaceSelection(dateNow.toISOString().split('T')[0])
|
||||
} else {
|
||||
cm.replaceSelection(dateNow.toLocaleDateString())
|
||||
@@ -222,7 +222,7 @@ export default class CodeEditor extends React.Component {
|
||||
'Shift-Ctrl-/': function (cm) {
|
||||
if (global.process.platform === 'darwin') { return }
|
||||
const dateNow = new Date()
|
||||
if (self.props.dateISO8601) {
|
||||
if (self.props.dateFormatISO8601) {
|
||||
cm.replaceSelection(dateNow.toISOString())
|
||||
} else {
|
||||
cm.replaceSelection(dateNow.toLocaleString())
|
||||
|
||||
@@ -321,7 +321,8 @@ class MarkdownEditor extends React.Component {
|
||||
switchPreview={config.editor.switchPreview}
|
||||
enableMarkdownLint={config.editor.enableMarkdownLint}
|
||||
customMarkdownLintConfig={config.editor.customMarkdownLintConfig}
|
||||
dateISO8601={config.ui.dateFormatISO8601}
|
||||
// dateISO8601={config.ui.dateFormatISO8601}
|
||||
dateFormatISO8601={config.editor.dateFormatISO8601}
|
||||
/>
|
||||
<MarkdownPreview styleName={this.state.status === 'PREVIEW'
|
||||
? 'preview'
|
||||
|
||||
@@ -181,7 +181,8 @@ class MarkdownSplitEditor extends React.Component {
|
||||
switchPreview={config.editor.switchPreview}
|
||||
enableMarkdownLint={config.editor.enableMarkdownLint}
|
||||
customMarkdownLintConfig={config.editor.customMarkdownLintConfig}
|
||||
dateISO8601={config.ui.dateFormatISO8601}
|
||||
// dateISO8601={config.ui.dateFormatISO8601}
|
||||
dateFormatISO8601={config.editor.dateFormatISO8601}
|
||||
/>
|
||||
<div styleName='slider' style={{left: this.state.codeEditorWidthInPercent + '%'}} onMouseDown={e => this.handleMouseDown(e)} >
|
||||
<div styleName='slider-hitbox' />
|
||||
|
||||
@@ -738,7 +738,8 @@ class SnippetNoteDetail extends React.Component {
|
||||
enableSmartPaste={config.editor.enableSmartPaste}
|
||||
hotkey={config.hotkey}
|
||||
autoDetect={autoDetect}
|
||||
dateISO8601={config.ui.dateFormatISO8601}
|
||||
// dateISO8601={config.ui.dateFormatISO8601}
|
||||
dateFormatISO8601={config.editor.dateFormatISO8601}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -39,8 +39,8 @@ export const DEFAULT_CONFIG = {
|
||||
showCopyNotification: true,
|
||||
disableDirectWrite: false,
|
||||
defaultNote: 'ALWAYS_ASK', // 'ALWAYS_ASK', 'SNIPPET_NOTE', 'MARKDOWN_NOTE'
|
||||
showMenuBar: false,
|
||||
dateFormatISO8601: false
|
||||
showMenuBar: false
|
||||
// dateFormatISO8601: false
|
||||
},
|
||||
editor: {
|
||||
theme: 'base16-light',
|
||||
@@ -66,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',
|
||||
|
||||
@@ -78,7 +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,
|
||||
// dateFormatISO8601: this.refs.dateFormatISO8601.checked,
|
||||
disableDirectWrite: this.refs.uiD2w != null
|
||||
? this.refs.uiD2w.checked
|
||||
: false
|
||||
@@ -106,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,
|
||||
@@ -294,7 +295,7 @@ class UiTab extends React.Component {
|
||||
</div>
|
||||
: null
|
||||
}
|
||||
<div styleName='group-checkBoxSection'>
|
||||
{/* <div styleName='group-checkBoxSection'>
|
||||
<label>
|
||||
<input onChange={(e) => this.handleUIChange(e)}
|
||||
checked={this.state.config.ui.dateFormatISO8601}
|
||||
@@ -303,7 +304,7 @@ class UiTab extends React.Component {
|
||||
/>
|
||||
{i18n.__('Date shortcut use iso 8601 format')}
|
||||
</label>
|
||||
</div>
|
||||
</div> */}
|
||||
<div styleName='group-header2'>Tags</div>
|
||||
|
||||
<div styleName='group-checkBoxSection'>
|
||||
@@ -610,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'
|
||||
/>
|
||||
{i18n.__('Date shortcut use iso 8601 format')}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div styleName='group-section'>
|
||||
<div styleName='group-section-label'>
|
||||
{i18n.__('Matching character pairs')}
|
||||
|
||||
Reference in New Issue
Block a user