bugfix: 1. auto focus when add table. 2. arrow left and up is unavailable when cursor in first cell in table

This commit is contained in:
Jocs 2018-02-24 23:44:18 +08:00
parent 2870be80af
commit 56d3d9287b
6 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,5 @@
<p align="center"><img src="https://github.com/marktext/marktext/blob/master/static/logo-small.png" alt="mark text"></p>
# MarkText
**MarkText** is an **open source** Markdown editor for OS X, released under the **MIT license**. It is inspired by outstanding markdown editor **Typora**.

View File

@ -36,7 +36,7 @@ const arrowCtrl = ContentState => {
ContentState.prototype.findPreBlockInLocation = function (block) {
const parent = this.getParent(block)
const preBlock = this.getPreSibling(block)
if (block.preSibling && preBlock.type !== 'input') { // handle task item
if (block.preSibling && preBlock.type !== 'input' && preBlock.type !== 'div') { // handle task item and table
return this.lastInDescendant(preBlock)
} else if (parent) {
return this.findPreBlockInLocation(parent)

View File

@ -17,7 +17,7 @@ let viewMenu = {
}]
}
if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'development') {
if (process.env.NODE_ENV !== 'production' || process.env.NODE_ENV === 'development') {
// add devtool when development
viewMenu.submenu.push({
label: 'Toggle Developer Tools',

View File

@ -12,6 +12,7 @@
<el-form :model="tableChecker" :inline="true">
<el-form-item label="Rows">
<el-input-number
ref="rowInput"
size="mini" v-model="tableChecker.rows"
controls-position="right"
:min="2"
@ -101,6 +102,9 @@
case 'table':
this.tableChecker = { rows: 2, columns: 2 }
this.dialogTableVisible = true
this.$nextTick(() => {
this.$refs.rowInput.focus()
})
break
case 'ul-bullet':
case 'ul-task':

BIN
static/logo-small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
static/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB