diff --git a/src/editor/parser/marked/lexer.js b/src/editor/parser/marked/lexer.js index 9fcb3db8..bae45489 100644 --- a/src/editor/parser/marked/lexer.js +++ b/src/editor/parser/marked/lexer.js @@ -325,19 +325,21 @@ Lexer.prototype.token = function (src, top, bq) { cap = this.rules.def.exec(src) if (!bq && top && cap) { let text = '' - while (cap) { + do { src = src.substring(cap[0].length) this.tokens.links[cap[1].toLowerCase()] = { href: cap[2], title: cap[3] } text += cap[0] + if (cap[0].endsWith('\n\n')) break cap = this.rules.def.exec(src) - } + } while (cap) + if (this.options.disableInline) { this.tokens.push({ type: 'paragraph', - text + text: text.replace(/\n*$/, '') }) } continue diff --git a/src/main/actions/file.js b/src/main/actions/file.js index 9a7b0b28..e7198100 100644 --- a/src/main/actions/file.js +++ b/src/main/actions/file.js @@ -243,6 +243,10 @@ export const newFile = () => { appWindow.createWindow() } +export const newTab = win => { + win.webContents.send('AGANI::new-tab') +} + export const save = win => { win.webContents.send('AGANI::ask-file-save') } diff --git a/src/main/menus/file.js b/src/main/menus/file.js index 1d14bae3..a87c9806 100755 --- a/src/main/menus/file.js +++ b/src/main/menus/file.js @@ -14,6 +14,14 @@ export default function (recentlyUsedFiles) { click (menuItem, browserWindow) { actions.newFile() } + }, { + label: 'New Tab', + accelerator: 'Shift+CmdOrCtrl+T', + click (menuItem, browserWindow) { + actions.newTab(browserWindow) + } + }, { + type: 'separator' }, { label: 'Open File', accelerator: 'CmdOrCtrl+O', diff --git a/src/main/menus/view.js b/src/main/menus/view.js index c94c8373..c0de088c 100755 --- a/src/main/menus/view.js +++ b/src/main/menus/view.js @@ -38,7 +38,7 @@ let viewMenu = { }, { id: 'typewriterModeMenuItem', label: 'Typewriter Mode', - accelerator: 'Shift+CmdOrCtrl+T', + accelerator: 'Option+CmdOrCtrl+T', type: 'checkbox', checked: false, click (item, browserWindow) { diff --git a/src/renderer/app.vue b/src/renderer/app.vue index 4ba0229b..5d3857c5 100644 --- a/src/renderer/app.vue +++ b/src/renderer/app.vue @@ -120,6 +120,7 @@ dispatch('LISTEN_FOR_INSERT_IMAGE') dispatch('LISTEN_FOR_RENAME') dispatch('LINTEN_FOR_SET_LINE_ENDING') + dispatch('LISTEN_FOR_NEW_TAB') // module: notification dispatch('LISTEN_FOR_NOTIFICATION') } diff --git a/src/renderer/store/editor.js b/src/renderer/store/editor.js index 016d05e2..a89cf1fa 100644 --- a/src/renderer/store/editor.js +++ b/src/renderer/store/editor.js @@ -293,6 +293,12 @@ const actions = { }) }, + LISTEN_FOR_NEW_TAB ({ dispatch }) { + ipcRenderer.on('AGANI::new-tab', e => { + dispatch('NEW_BLANK_FILE') + }) + }, + NEW_BLANK_FILE ({ commit, state, dispatch }) { const { tabs, lineEnding } = state const fileState = getBlankFileState(tabs, lineEnding)