mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Merge branch 'master' into tags
This commit is contained in:
@@ -5,7 +5,7 @@ import CodeMirror from 'codemirror'
|
|||||||
import 'codemirror-mode-elixir'
|
import 'codemirror-mode-elixir'
|
||||||
import attachmentManagement from 'browser/main/lib/dataApi/attachmentManagement'
|
import attachmentManagement from 'browser/main/lib/dataApi/attachmentManagement'
|
||||||
import convertModeName from 'browser/lib/convertModeName'
|
import convertModeName from 'browser/lib/convertModeName'
|
||||||
import { options, TableEditor } from '@susisu/mte-kernel'
|
import { options, TableEditor, Alignment } from '@susisu/mte-kernel'
|
||||||
import TextEditorInterface from 'browser/lib/TextEditorInterface'
|
import TextEditorInterface from 'browser/lib/TextEditorInterface'
|
||||||
import eventEmitter from 'browser/main/lib/eventEmitter'
|
import eventEmitter from 'browser/main/lib/eventEmitter'
|
||||||
import iconv from 'iconv-lite'
|
import iconv from 'iconv-lite'
|
||||||
@@ -59,6 +59,7 @@ export default class CodeEditor extends React.Component {
|
|||||||
this.searchState = null
|
this.searchState = null
|
||||||
|
|
||||||
this.formatTable = () => this.handleFormatTable()
|
this.formatTable = () => this.handleFormatTable()
|
||||||
|
this.editorActivityHandler = () => this.handleEditorActivity()
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSearch (msg) {
|
handleSearch (msg) {
|
||||||
@@ -99,6 +100,28 @@ export default class CodeEditor extends React.Component {
|
|||||||
this.tableEditor.formatAll(options({textWidthOptions: {}}))
|
this.tableEditor.formatAll(options({textWidthOptions: {}}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleEditorActivity () {
|
||||||
|
if (!this.textEditorInterface.transaction) {
|
||||||
|
this.updateTableEditorState()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateTableEditorState () {
|
||||||
|
const active = this.tableEditor.cursorIsInTable(this.tableEditorOptions)
|
||||||
|
if (active) {
|
||||||
|
if (this.extraKeysMode !== 'editor') {
|
||||||
|
this.extraKeysMode = 'editor'
|
||||||
|
this.editor.setOption('extraKeys', this.editorKeyMap)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.extraKeysMode !== 'default') {
|
||||||
|
this.extraKeysMode = 'default'
|
||||||
|
this.editor.setOption('extraKeys', this.defaultKeyMap)
|
||||||
|
this.tableEditor.resetSmartCursor()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
const { rulers, enableRulers } = this.props
|
const { rulers, enableRulers } = this.props
|
||||||
const expandSnippet = this.expandSnippet.bind(this)
|
const expandSnippet = this.expandSnippet.bind(this)
|
||||||
@@ -119,6 +142,59 @@ export default class CodeEditor extends React.Component {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.defaultKeyMap = CodeMirror.normalizeKeyMap({
|
||||||
|
Tab: function (cm) {
|
||||||
|
const cursor = cm.getCursor()
|
||||||
|
const line = cm.getLine(cursor.line)
|
||||||
|
const cursorPosition = cursor.ch
|
||||||
|
const charBeforeCursor = line.substr(cursorPosition - 1, 1)
|
||||||
|
if (cm.somethingSelected()) cm.indentSelection('add')
|
||||||
|
else {
|
||||||
|
const tabs = cm.getOption('indentWithTabs')
|
||||||
|
if (line.trimLeft().match(/^(-|\*|\+) (\[( |x)] )?$/)) {
|
||||||
|
cm.execCommand('goLineStart')
|
||||||
|
if (tabs) {
|
||||||
|
cm.execCommand('insertTab')
|
||||||
|
} else {
|
||||||
|
cm.execCommand('insertSoftTab')
|
||||||
|
}
|
||||||
|
cm.execCommand('goLineEnd')
|
||||||
|
} else if (
|
||||||
|
!charBeforeCursor.match(/\t|\s|\r|\n/) &&
|
||||||
|
cursor.ch > 1
|
||||||
|
) {
|
||||||
|
// text expansion on tab key if the char before is alphabet
|
||||||
|
const snippets = JSON.parse(
|
||||||
|
fs.readFileSync(consts.SNIPPET_FILE, 'utf8')
|
||||||
|
)
|
||||||
|
if (expandSnippet(line, cursor, cm, snippets) === false) {
|
||||||
|
if (tabs) {
|
||||||
|
cm.execCommand('insertTab')
|
||||||
|
} else {
|
||||||
|
cm.execCommand('insertSoftTab')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (tabs) {
|
||||||
|
cm.execCommand('insertTab')
|
||||||
|
} else {
|
||||||
|
cm.execCommand('insertSoftTab')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'Cmd-T': function (cm) {
|
||||||
|
// Do nothing
|
||||||
|
},
|
||||||
|
Enter: 'boostNewLineAndIndentContinueMarkdownList',
|
||||||
|
'Ctrl-C': cm => {
|
||||||
|
if (cm.getOption('keyMap').substr(0, 3) === 'vim') {
|
||||||
|
document.execCommand('copy')
|
||||||
|
}
|
||||||
|
return CodeMirror.Pass
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
this.value = this.props.value
|
this.value = this.props.value
|
||||||
this.editor = CodeMirror(this.refs.root, {
|
this.editor = CodeMirror(this.refs.root, {
|
||||||
rulers: buildCMRulers(rulers, enableRulers),
|
rulers: buildCMRulers(rulers, enableRulers),
|
||||||
@@ -141,58 +217,7 @@ export default class CodeEditor extends React.Component {
|
|||||||
explode: '[]{}``$$',
|
explode: '[]{}``$$',
|
||||||
override: true
|
override: true
|
||||||
},
|
},
|
||||||
extraKeys: {
|
extraKeys: this.defaultKeyMap
|
||||||
Tab: function (cm) {
|
|
||||||
const cursor = cm.getCursor()
|
|
||||||
const line = cm.getLine(cursor.line)
|
|
||||||
const cursorPosition = cursor.ch
|
|
||||||
const charBeforeCursor = line.substr(cursorPosition - 1, 1)
|
|
||||||
if (cm.somethingSelected()) cm.indentSelection('add')
|
|
||||||
else {
|
|
||||||
const tabs = cm.getOption('indentWithTabs')
|
|
||||||
if (line.trimLeft().match(/^(-|\*|\+) (\[( |x)] )?$/)) {
|
|
||||||
cm.execCommand('goLineStart')
|
|
||||||
if (tabs) {
|
|
||||||
cm.execCommand('insertTab')
|
|
||||||
} else {
|
|
||||||
cm.execCommand('insertSoftTab')
|
|
||||||
}
|
|
||||||
cm.execCommand('goLineEnd')
|
|
||||||
} else if (
|
|
||||||
!charBeforeCursor.match(/\t|\s|\r|\n/) &&
|
|
||||||
cursor.ch > 1
|
|
||||||
) {
|
|
||||||
// text expansion on tab key if the char before is alphabet
|
|
||||||
const snippets = JSON.parse(
|
|
||||||
fs.readFileSync(consts.SNIPPET_FILE, 'utf8')
|
|
||||||
)
|
|
||||||
if (expandSnippet(line, cursor, cm, snippets) === false) {
|
|
||||||
if (tabs) {
|
|
||||||
cm.execCommand('insertTab')
|
|
||||||
} else {
|
|
||||||
cm.execCommand('insertSoftTab')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (tabs) {
|
|
||||||
cm.execCommand('insertTab')
|
|
||||||
} else {
|
|
||||||
cm.execCommand('insertSoftTab')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'Cmd-T': function (cm) {
|
|
||||||
// Do nothing
|
|
||||||
},
|
|
||||||
Enter: 'boostNewLineAndIndentContinueMarkdownList',
|
|
||||||
'Ctrl-C': cm => {
|
|
||||||
if (cm.getOption('keyMap').substr(0, 3) === 'vim') {
|
|
||||||
document.execCommand('copy')
|
|
||||||
}
|
|
||||||
return CodeMirror.Pass
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
this.setMode(this.props.mode)
|
this.setMode(this.props.mode)
|
||||||
@@ -215,8 +240,58 @@ export default class CodeEditor extends React.Component {
|
|||||||
CodeMirror.Vim.defineEx('qw', 'qw', this.quitEditor)
|
CodeMirror.Vim.defineEx('qw', 'qw', this.quitEditor)
|
||||||
CodeMirror.Vim.map('ZZ', ':q', 'normal')
|
CodeMirror.Vim.map('ZZ', ':q', 'normal')
|
||||||
|
|
||||||
this.tableEditor = new TableEditor(new TextEditorInterface(this.editor))
|
this.textEditorInterface = new TextEditorInterface(this.editor)
|
||||||
|
this.tableEditor = new TableEditor(this.textEditorInterface)
|
||||||
eventEmitter.on('code:format-table', this.formatTable)
|
eventEmitter.on('code:format-table', this.formatTable)
|
||||||
|
|
||||||
|
this.tableEditorOptions = options({
|
||||||
|
smartCursor: true
|
||||||
|
})
|
||||||
|
|
||||||
|
this.editorKeyMap = CodeMirror.normalizeKeyMap({
|
||||||
|
'Tab': () => { this.tableEditor.nextCell(this.tableEditorOptions) },
|
||||||
|
'Shift-Tab': () => { this.tableEditor.previousCell(this.tableEditorOptions) },
|
||||||
|
'Enter': () => { this.tableEditor.nextRow(this.tableEditorOptions) },
|
||||||
|
'Ctrl-Enter': () => { this.tableEditor.escape(this.tableEditorOptions) },
|
||||||
|
'Cmd-Enter': () => { this.tableEditor.escape(this.tableEditorOptions) },
|
||||||
|
'Shift-Ctrl-Left': () => { this.tableEditor.alignColumn(Alignment.LEFT, this.tableEditorOptions) },
|
||||||
|
'Shift-Cmd-Left': () => { this.tableEditor.alignColumn(Alignment.LEFT, this.tableEditorOptions) },
|
||||||
|
'Shift-Ctrl-Right': () => { this.tableEditor.alignColumn(Alignment.RIGHT, this.tableEditorOptions) },
|
||||||
|
'Shift-Cmd-Right': () => { this.tableEditor.alignColumn(Alignment.RIGHT, this.tableEditorOptions) },
|
||||||
|
'Shift-Ctrl-Up': () => { this.tableEditor.alignColumn(Alignment.CENTER, this.tableEditorOptions) },
|
||||||
|
'Shift-Cmd-Up': () => { this.tableEditor.alignColumn(Alignment.CENTER, this.tableEditorOptions) },
|
||||||
|
'Shift-Ctrl-Down': () => { this.tableEditor.alignColumn(Alignment.NONE, this.tableEditorOptions) },
|
||||||
|
'Shift-Cmd-Down': () => { this.tableEditor.alignColumn(Alignment.NONE, this.tableEditorOptions) },
|
||||||
|
'Ctrl-Left': () => { this.tableEditor.moveFocus(0, -1, this.tableEditorOptions) },
|
||||||
|
'Cmd-Left': () => { this.tableEditor.moveFocus(0, -1, this.tableEditorOptions) },
|
||||||
|
'Ctrl-Right': () => { this.tableEditor.moveFocus(0, 1, this.tableEditorOptions) },
|
||||||
|
'Cmd-Right': () => { this.tableEditor.moveFocus(0, 1, this.tableEditorOptions) },
|
||||||
|
'Ctrl-Up': () => { this.tableEditor.moveFocus(-1, 0, this.tableEditorOptions) },
|
||||||
|
'Cmd-Up': () => { this.tableEditor.moveFocus(-1, 0, this.tableEditorOptions) },
|
||||||
|
'Ctrl-Down': () => { this.tableEditor.moveFocus(1, 0, this.tableEditorOptions) },
|
||||||
|
'Cmd-Down': () => { this.tableEditor.moveFocus(1, 0, this.tableEditorOptions) },
|
||||||
|
'Ctrl-K Ctrl-I': () => { this.tableEditor.insertRow(this.tableEditorOptions) },
|
||||||
|
'Cmd-K Cmd-I': () => { this.tableEditor.insertRow(this.tableEditorOptions) },
|
||||||
|
'Ctrl-L Ctrl-I': () => { this.tableEditor.deleteRow(this.tableEditorOptions) },
|
||||||
|
'Cmd-L Cmd-I': () => { this.tableEditor.deleteRow(this.tableEditorOptions) },
|
||||||
|
'Ctrl-K Ctrl-J': () => { this.tableEditor.insertColumn(this.tableEditorOptions) },
|
||||||
|
'Cmd-K Cmd-J': () => { this.tableEditor.insertColumn(this.tableEditorOptions) },
|
||||||
|
'Ctrl-L Ctrl-J': () => { this.tableEditor.deleteColumn(this.tableEditorOptions) },
|
||||||
|
'Cmd-L Cmd-J': () => { this.tableEditor.deleteColumn(this.tableEditorOptions) },
|
||||||
|
'Alt-Shift-Ctrl-Left': () => { this.tableEditor.moveColumn(-1, this.tableEditorOptions) },
|
||||||
|
'Alt-Shift-Cmd-Left': () => { this.tableEditor.moveColumn(-1, this.tableEditorOptions) },
|
||||||
|
'Alt-Shift-Ctrl-Right': () => { this.tableEditor.moveColumn(1, this.tableEditorOptions) },
|
||||||
|
'Alt-Shift-Cmd-Right': () => { this.tableEditor.moveColumn(1, this.tableEditorOptions) },
|
||||||
|
'Alt-Shift-Ctrl-Up': () => { this.tableEditor.moveRow(-1, this.tableEditorOptions) },
|
||||||
|
'Alt-Shift-Cmd-Up': () => { this.tableEditor.moveRow(-1, this.tableEditorOptions) },
|
||||||
|
'Alt-Shift-Ctrl-Down': () => { this.tableEditor.moveRow(1, this.tableEditorOptions) },
|
||||||
|
'Alt-Shift-Cmd-Down': () => { this.tableEditor.moveRow(1, this.tableEditorOptions) }
|
||||||
|
})
|
||||||
|
|
||||||
|
if (this.props.enableTableEditor) {
|
||||||
|
this.editor.on('cursorActivity', this.editorActivityHandler)
|
||||||
|
this.editor.on('changes', this.editorActivityHandler)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expandSnippet (line, cursor, cm, snippets) {
|
expandSnippet (line, cursor, cm, snippets) {
|
||||||
@@ -353,6 +428,19 @@ export default class CodeEditor extends React.Component {
|
|||||||
this.editor.setOption('scrollPastEnd', this.props.scrollPastEnd)
|
this.editor.setOption('scrollPastEnd', this.props.scrollPastEnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prevProps.enableTableEditor !== this.props.enableTableEditor) {
|
||||||
|
if (this.props.enableTableEditor) {
|
||||||
|
this.editor.on('cursorActivity', this.editorActivityHandler)
|
||||||
|
this.editor.on('changes', this.editorActivityHandler)
|
||||||
|
} else {
|
||||||
|
this.editor.off('cursorActivity', this.editorActivityHandler)
|
||||||
|
this.editor.off('changes', this.editorActivityHandler)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.extraKeysMode = 'default'
|
||||||
|
this.editor.setOption('extraKeys', this.defaultKeyMap)
|
||||||
|
}
|
||||||
|
|
||||||
if (needRefresh) {
|
if (needRefresh) {
|
||||||
this.editor.refresh()
|
this.editor.refresh()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -265,6 +265,7 @@ class MarkdownEditor extends React.Component {
|
|||||||
storageKey={storageKey}
|
storageKey={storageKey}
|
||||||
noteKey={noteKey}
|
noteKey={noteKey}
|
||||||
fetchUrlTitle={config.editor.fetchUrlTitle}
|
fetchUrlTitle={config.editor.fetchUrlTitle}
|
||||||
|
enableTableEditor={config.editor.enableTableEditor}
|
||||||
onChange={(e) => this.handleChange(e)}
|
onChange={(e) => this.handleChange(e)}
|
||||||
onBlur={(e) => this.handleBlur(e)}
|
onBlur={(e) => this.handleBlur(e)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ class MarkdownSplitEditor extends React.Component {
|
|||||||
rulers={config.editor.rulers}
|
rulers={config.editor.rulers}
|
||||||
scrollPastEnd={config.editor.scrollPastEnd}
|
scrollPastEnd={config.editor.scrollPastEnd}
|
||||||
fetchUrlTitle={config.editor.fetchUrlTitle}
|
fetchUrlTitle={config.editor.fetchUrlTitle}
|
||||||
|
enableTableEditor={config.editor.enableTableEditor}
|
||||||
storageKey={storageKey}
|
storageKey={storageKey}
|
||||||
noteKey={noteKey}
|
noteKey={noteKey}
|
||||||
onChange={this.handleOnChange.bind(this)}
|
onChange={this.handleOnChange.bind(this)}
|
||||||
|
|||||||
@@ -1,53 +1,113 @@
|
|||||||
import { Point } from '@susisu/mte-kernel'
|
import { Point } from '@susisu/mte-kernel'
|
||||||
|
|
||||||
export default class TextEditorInterface {
|
export default class TextEditorInterface {
|
||||||
constructor (editor) {
|
constructor (editor) {
|
||||||
this.editor = editor
|
this.editor = editor
|
||||||
}
|
this.doc = editor.getDoc()
|
||||||
|
this.transaction = false
|
||||||
getCursorPosition () {
|
}
|
||||||
const pos = this.editor.getCursor()
|
|
||||||
return new Point(pos.line, pos.ch)
|
getCursorPosition () {
|
||||||
}
|
const { line, ch } = this.doc.getCursor()
|
||||||
|
return new Point(line, ch)
|
||||||
setCursorPosition (pos) {
|
}
|
||||||
this.editor.setCursor({line: pos.row, ch: pos.column})
|
|
||||||
}
|
setCursorPosition (pos) {
|
||||||
|
this.doc.setCursor({
|
||||||
setSelectionRange (range) {
|
line: pos.row,
|
||||||
this.editor.setSelection({
|
ch: pos.column
|
||||||
anchor: {line: range.start.row, ch: range.start.column},
|
})
|
||||||
head: {line: range.end.row, ch: range.end.column}
|
}
|
||||||
})
|
|
||||||
}
|
setSelectionRange (range) {
|
||||||
|
this.doc.setSelection(
|
||||||
getLastRow () {
|
{ line: range.start.row, ch: range.start.column },
|
||||||
return this.editor.lastLine()
|
{ line: range.end.row, ch: range.end.column }
|
||||||
}
|
)
|
||||||
|
}
|
||||||
acceptsTableEdit (row) {
|
|
||||||
return true
|
getLastRow () {
|
||||||
}
|
return this.doc.lineCount() - 1
|
||||||
|
}
|
||||||
getLine (row) {
|
|
||||||
return this.editor.getLine(row)
|
acceptsTableEdit () {
|
||||||
}
|
return true
|
||||||
|
}
|
||||||
insertLine (row, line) {
|
|
||||||
this.editor.replaceRange(line, {line: row, ch: 0})
|
getLine (row) {
|
||||||
}
|
return this.doc.getLine(row)
|
||||||
|
}
|
||||||
deleteLine (row) {
|
|
||||||
this.editor.replaceRange('', {line: row, ch: 0}, {line: row, ch: this.editor.getLine(row).length})
|
insertLine (row, line) {
|
||||||
}
|
const lastRow = this.getLastRow()
|
||||||
|
if (row > lastRow) {
|
||||||
replaceLines (startRow, endRow, lines) {
|
const lastLine = this.getLine(lastRow)
|
||||||
endRow-- // because endRow is a first line after a table.
|
this.doc.replaceRange(
|
||||||
const endRowCh = this.editor.getLine(endRow).length
|
'\n' + line,
|
||||||
this.editor.replaceRange(lines, {line: startRow, ch: 0}, {line: endRow, ch: endRowCh})
|
{ line: lastRow, ch: lastLine.length },
|
||||||
}
|
{ line: lastRow, ch: lastLine.length }
|
||||||
|
)
|
||||||
transact (func) {
|
} else {
|
||||||
func()
|
this.doc.replaceRange(
|
||||||
}
|
line + '\n',
|
||||||
}
|
{ line: row, ch: 0 },
|
||||||
|
{ line: row, ch: 0 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteLine (row) {
|
||||||
|
const lastRow = this.getLastRow()
|
||||||
|
if (row >= lastRow) {
|
||||||
|
if (lastRow > 0) {
|
||||||
|
const preLastLine = this.getLine(lastRow - 1)
|
||||||
|
const lastLine = this.getLine(lastRow)
|
||||||
|
this.doc.replaceRange(
|
||||||
|
'',
|
||||||
|
{ line: lastRow - 1, ch: preLastLine.length },
|
||||||
|
{ line: lastRow, ch: lastLine.length }
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
const lastLine = this.getLine(lastRow)
|
||||||
|
this.doc.replaceRange(
|
||||||
|
'',
|
||||||
|
{ line: lastRow, ch: 0 },
|
||||||
|
{ line: lastRow, ch: lastLine.length }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.doc.replaceRange(
|
||||||
|
'',
|
||||||
|
{ line: row, ch: 0 },
|
||||||
|
{ line: row + 1, ch: 0 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
replaceLines (startRow, endRow, lines) {
|
||||||
|
const lastRow = this.getLastRow()
|
||||||
|
if (endRow > lastRow) {
|
||||||
|
const lastLine = this.getLine(lastRow)
|
||||||
|
this.doc.replaceRange(
|
||||||
|
lines.join('\n'),
|
||||||
|
{ line: startRow, ch: 0 },
|
||||||
|
{ line: lastRow, ch: lastLine.length }
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
this.doc.replaceRange(
|
||||||
|
lines.join('\n') + '\n',
|
||||||
|
{ line: startRow, ch: 0 },
|
||||||
|
{ line: endRow, ch: 0 }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transact (func) {
|
||||||
|
this.transaction = true
|
||||||
|
func()
|
||||||
|
this.transaction = false
|
||||||
|
if (this.onDidFinishTransaction) {
|
||||||
|
this.onDidFinishTransaction.call(undefined)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -692,6 +692,7 @@ class SnippetNoteDetail extends React.Component {
|
|||||||
keyMap={config.editor.keyMap}
|
keyMap={config.editor.keyMap}
|
||||||
scrollPastEnd={config.editor.scrollPastEnd}
|
scrollPastEnd={config.editor.scrollPastEnd}
|
||||||
fetchUrlTitle={config.editor.fetchUrlTitle}
|
fetchUrlTitle={config.editor.fetchUrlTitle}
|
||||||
|
enableTableEditor={config.editor.enableTableEditor}
|
||||||
onChange={(e) => this.handleCodeChange(index)(e)}
|
onChange={(e) => this.handleCodeChange(index)(e)}
|
||||||
ref={'code-' + index}
|
ref={'code-' + index}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ export const DEFAULT_CONFIG = {
|
|||||||
switchPreview: 'BLUR', // Available value: RIGHTCLICK, BLUR
|
switchPreview: 'BLUR', // Available value: RIGHTCLICK, BLUR
|
||||||
scrollPastEnd: false,
|
scrollPastEnd: false,
|
||||||
type: 'SPLIT',
|
type: 'SPLIT',
|
||||||
fetchUrlTitle: true
|
fetchUrlTitle: true,
|
||||||
|
enableTableEditor: false
|
||||||
},
|
},
|
||||||
preview: {
|
preview: {
|
||||||
fontSize: '14',
|
fontSize: '14',
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ class UiTab extends React.Component {
|
|||||||
keyMap: this.refs.editorKeyMap.value,
|
keyMap: this.refs.editorKeyMap.value,
|
||||||
snippetDefaultLanguage: this.refs.editorSnippetDefaultLanguage.value,
|
snippetDefaultLanguage: this.refs.editorSnippetDefaultLanguage.value,
|
||||||
scrollPastEnd: this.refs.scrollPastEnd.checked,
|
scrollPastEnd: this.refs.scrollPastEnd.checked,
|
||||||
fetchUrlTitle: this.refs.editorFetchUrlTitle.checked
|
fetchUrlTitle: this.refs.editorFetchUrlTitle.checked,
|
||||||
|
enableTableEditor: this.refs.enableTableEditor.checked
|
||||||
},
|
},
|
||||||
preview: {
|
preview: {
|
||||||
fontSize: this.refs.previewFontSize.value,
|
fontSize: this.refs.previewFontSize.value,
|
||||||
@@ -480,6 +481,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.enableTableEditor}
|
||||||
|
ref='enableTableEditor'
|
||||||
|
type='checkbox'
|
||||||
|
/>
|
||||||
|
{i18n.__('Enable smart table editor')}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div styleName='group-header2'>{i18n.__('Preview')}</div>
|
<div styleName='group-header2'>{i18n.__('Preview')}</div>
|
||||||
<div styleName='group-section'>
|
<div styleName='group-section'>
|
||||||
<div styleName='group-section-label'>
|
<div styleName='group-section-label'>
|
||||||
|
|||||||
@@ -179,5 +179,6 @@
|
|||||||
"Save tags of a note in alphabetical order": "Save tags of a note in alphabetical order",
|
"Save tags of a note in alphabetical order": "Save tags of a note in alphabetical order",
|
||||||
"Show tags of a note in alphabetical order": "Show tags of a note in alphabetical order",
|
"Show tags of a note in alphabetical order": "Show tags of a note in alphabetical order",
|
||||||
"Enable live count of notes": "Enable live count of notes",
|
"Enable live count of notes": "Enable live count of notes",
|
||||||
|
"Enable smart table editor": "Enable smart table editor",
|
||||||
"Snippet Default Language": "Snippet Default Language"
|
"Snippet Default Language": "Snippet Default Language"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,5 +156,6 @@
|
|||||||
"Save tags of a note in alphabetical order": "Sauvegarder les tags d'une note en ordre alphabétique",
|
"Save tags of a note in alphabetical order": "Sauvegarder les tags d'une note en ordre alphabétique",
|
||||||
"Show tags of a note in alphabetical order": "Afficher les tags d'une note par ordre alphabétique",
|
"Show tags of a note in alphabetical order": "Afficher les tags d'une note par ordre alphabétique",
|
||||||
"Enable live count of notes": "Activer le comptage live des notes",
|
"Enable live count of notes": "Activer le comptage live des notes",
|
||||||
|
"Enable smart table editor": "Activer l'intelligent éditeur de tableaux",
|
||||||
"Snippet Default Language": "Langage par défaut d'un snippet"
|
"Snippet Default Language": "Langage par défaut d'un snippet"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user