Skip to content

Commit

Permalink
Merge pull request #39 from shd101wyy/0.2.4
Browse files Browse the repository at this point in the history
0.2.4
  • Loading branch information
shd101wyy authored Aug 7, 2017
2 parents ddd56c2 + dbf2bc3 commit 9b20b39
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Contact me if you are willing to help translate the documentation :)
| Shortcuts | Functionality |
|---|---|
| <kbd>cmd-k v</kbd> or <kbd>ctrl-shift-m</kbd> | Open preview |
| <kbd>ctrl-shift-m</kbd> or <kbd>cmd-k v</kbd> | Open preview |
| <kbd>ctrl-shift-s</kbd> | Sync preview / Sync source |
| <kbd>ctrl-shift-i</kbd> | Open Image Helper |
| <kbd>shift-enter</kbd> | Run Code Chunk |
Expand Down
2 changes: 1 addition & 1 deletion docs/newest.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
I will be busy hunting jobs (August & September), so I won't have time to implement new features for this extension.
The updates in the following two months will be bug fixes only.

## 0.2.3
## 0.2.3 & 0.2.4
* The old feature [WaveDrom diagram](https://shd101wyy.github.io/markdown-preview-enhanced/#/diagrams?id=wavedrom) is now supported again.
* The doc of customization css is updated, please [check it here](https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css).
* Sidebar TOC is now supported in HTML export, and it is enabled by default.
Expand Down
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
"command": "markdown-preview-enhanced.runCodeChunk",
"title": "Markdown Preview Enhanced: Run Code Chunk"
},
{
"command": "markdown-preview-enhanced.syncPreview",
"title": "Markdown Preview Enhanced: Sync Preview"
},
{
"command": "markdown-preview-enhanced.customizeCss",
"title": "Markdown Preview Enhanced: Customize CSS"
Expand Down Expand Up @@ -112,6 +116,11 @@
"command": "markdown-preview-enhanced.runCodeChunk",
"key": "shift+enter",
"when": "editorLangId == markdown"
},
{
"command": "markdown-preview-enhanced.syncPreview",
"key": "ctrl+shift+s",
"when": "editorLangId == markdown"
}
],
"configuration": {
Expand Down Expand Up @@ -351,7 +360,7 @@
"package": "vsce package"
},
"dependencies": {
"@shd101wyy/mume": "^0.1.7"
"@shd101wyy/mume": "^0.1.8"
},
"devDependencies": {
"@types/jquery": "^2.0.46",
Expand All @@ -362,4 +371,4 @@
"typescript": "^2.0.3",
"vscode": "^1.0.0"
}
}
}
19 changes: 19 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,23 @@ export function activate(context: vscode.ExtensionContext) {
})
}

function syncPreview() {
const textEditor = vscode.window.activeTextEditor
if (!textEditor.document) return
if (!isMarkdownFile(textEditor.document)) return

const previewUri = getPreviewUri(textEditor.document.uri)
if (!previewUri) return

vscode.commands.executeCommand('_workbench.htmlPreview.postMessage',
previewUri,
{
command: 'changeTextEditorSelection',
line: textEditor.selections[0].active.line,
forced: true
})
}

function clickTagA(uri, href) {
const sourceUri = vscode.Uri.parse(decodeURIComponent(uri));
href = decodeURIComponent(href)
Expand Down Expand Up @@ -372,6 +389,8 @@ export function activate(context: vscode.ExtensionContext) {

context.subscriptions.push(vscode.commands.registerCommand('markdown-preview-enhanced.runCodeChunk', runCodeChunkCommand))

context.subscriptions.push(vscode.commands.registerCommand('markdown-preview-enhanced.syncPreview', syncPreview))

context.subscriptions.push(vscode.commands.registerCommand('markdown-preview-enhanced.customizeCss', customizeCSS))

context.subscriptions.push(vscode.commands.registerCommand('markdown-preview-enhanced.openMermaidConfig', openMermaidConfig))
Expand Down

0 comments on commit 9b20b39

Please sign in to comment.