mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 02:06:29 +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) {
|
'Ctrl-/': function (cm) {
|
||||||
if (global.process.platform === 'darwin') { return }
|
if (global.process.platform === 'darwin') { return }
|
||||||
const dateNow = new Date()
|
const dateNow = new Date()
|
||||||
if (self.props.dateISO8601) {
|
if (self.props.dateFormatISO8601) {
|
||||||
cm.replaceSelection(dateNow.toISOString().split('T')[0])
|
cm.replaceSelection(dateNow.toISOString().split('T')[0])
|
||||||
} else {
|
} else {
|
||||||
cm.replaceSelection(dateNow.toLocaleDateString())
|
cm.replaceSelection(dateNow.toLocaleDateString())
|
||||||
@@ -222,7 +222,7 @@ 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()
|
||||||
if (self.props.dateISO8601) {
|
if (self.props.dateFormatISO8601) {
|
||||||
cm.replaceSelection(dateNow.toISOString())
|
cm.replaceSelection(dateNow.toISOString())
|
||||||
} else {
|
} else {
|
||||||
cm.replaceSelection(dateNow.toLocaleString())
|
cm.replaceSelection(dateNow.toLocaleString())
|
||||||
|
|||||||
@@ -321,7 +321,8 @@ 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}
|
// dateISO8601={config.ui.dateFormatISO8601}
|
||||||
|
dateFormatISO8601={config.editor.dateFormatISO8601}
|
||||||
/>
|
/>
|
||||||
<MarkdownPreview styleName={this.state.status === 'PREVIEW'
|
<MarkdownPreview styleName={this.state.status === 'PREVIEW'
|
||||||
? 'preview'
|
? 'preview'
|
||||||
|
|||||||
@@ -181,7 +181,8 @@ 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}
|
// dateISO8601={config.ui.dateFormatISO8601}
|
||||||
|
dateFormatISO8601={config.editor.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' />
|
||||||
|
|||||||
@@ -738,7 +738,8 @@ 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}
|
// dateISO8601={config.ui.dateFormatISO8601}
|
||||||
|
dateFormatISO8601={config.editor.dateFormatISO8601}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -39,8 +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
|
// dateFormatISO8601: false
|
||||||
},
|
},
|
||||||
editor: {
|
editor: {
|
||||||
theme: 'base16-light',
|
theme: 'base16-light',
|
||||||
@@ -66,7 +66,8 @@ export const DEFAULT_CONFIG = {
|
|||||||
spellcheck: false,
|
spellcheck: false,
|
||||||
enableSmartPaste: false,
|
enableSmartPaste: false,
|
||||||
enableMarkdownLint: false,
|
enableMarkdownLint: false,
|
||||||
customMarkdownLintConfig: DEFAULT_MARKDOWN_LINT_CONFIG
|
customMarkdownLintConfig: DEFAULT_MARKDOWN_LINT_CONFIG,
|
||||||
|
dateFormatISO8601: false
|
||||||
},
|
},
|
||||||
preview: {
|
preview: {
|
||||||
fontSize: '14',
|
fontSize: '14',
|
||||||
|
|||||||
@@ -78,7 +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,
|
// 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
|
||||||
@@ -106,7 +106,8 @@ class UiTab extends React.Component {
|
|||||||
spellcheck: this.refs.spellcheck.checked,
|
spellcheck: this.refs.spellcheck.checked,
|
||||||
enableSmartPaste: this.refs.enableSmartPaste.checked,
|
enableSmartPaste: this.refs.enableSmartPaste.checked,
|
||||||
enableMarkdownLint: this.refs.enableMarkdownLint.checked,
|
enableMarkdownLint: this.refs.enableMarkdownLint.checked,
|
||||||
customMarkdownLintConfig: this.customMarkdownLintConfigCM.getCodeMirror().getValue()
|
customMarkdownLintConfig: this.customMarkdownLintConfigCM.getCodeMirror().getValue(),
|
||||||
|
dateFormatISO8601: this.refs.dateFormatISO8601.checked
|
||||||
},
|
},
|
||||||
preview: {
|
preview: {
|
||||||
fontSize: this.refs.previewFontSize.value,
|
fontSize: this.refs.previewFontSize.value,
|
||||||
@@ -294,7 +295,7 @@ class UiTab extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
<div styleName='group-checkBoxSection'>
|
{/* <div styleName='group-checkBoxSection'>
|
||||||
<label>
|
<label>
|
||||||
<input onChange={(e) => this.handleUIChange(e)}
|
<input onChange={(e) => this.handleUIChange(e)}
|
||||||
checked={this.state.config.ui.dateFormatISO8601}
|
checked={this.state.config.ui.dateFormatISO8601}
|
||||||
@@ -303,7 +304,7 @@ class UiTab extends React.Component {
|
|||||||
/>
|
/>
|
||||||
{i18n.__('Date shortcut use iso 8601 format')}
|
{i18n.__('Date shortcut use iso 8601 format')}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div> */}
|
||||||
<div styleName='group-header2'>Tags</div>
|
<div styleName='group-header2'>Tags</div>
|
||||||
|
|
||||||
<div styleName='group-checkBoxSection'>
|
<div styleName='group-checkBoxSection'>
|
||||||
@@ -610,6 +611,17 @@ class UiTab extends React.Component {
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</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'>
|
||||||
<div styleName='group-section-label'>
|
<div styleName='group-section-label'>
|
||||||
{i18n.__('Matching character pairs')}
|
{i18n.__('Matching character pairs')}
|
||||||
|
|||||||
Reference in New Issue
Block a user