Skip to content

Commit

Permalink
Merge pull request #47 from shd101wyy/0.2.6
Browse files Browse the repository at this point in the history
0.2.6
  • Loading branch information
shd101wyy authored Aug 18, 2017
2 parents 5b3474b + 240309b commit 4fd613e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
5 changes: 5 additions & 0 deletions docs/newest.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
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.6
* Removed the `Welcome Page`.
* Supported revealjs `fragment` [#559](https://github.com/shd101wyy/markdown-preview-enhanced/issues/559).
* Supported Experimental Puppeteer export (Headless Chrome).

## 0.2.5
* Fixed revealjs html export style bug.
* Supported configuring attributes for diagram **containers**.
Expand Down
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@
"command": "markdown-preview-enhanced.openPhantomJSConfig",
"title": "Markdown Preview Enhanced: Open PhantomJS Config"
},
{
"command": "markdown-preview-enhanced.openWelcomePage",
"title": "Markdown Preview Enhanced: Open Welcome Page"
},
{
"command": "markdown-preview-enhanced.extendParser",
"title": "Markdown Preview Enhanced: Extend Parser"
Expand Down Expand Up @@ -360,7 +356,7 @@
"package": "vsce package"
},
"dependencies": {
"@shd101wyy/mume": "^0.1.9"
"@shd101wyy/mume": "^0.2.0"
},
"devDependencies": {
"@types/jquery": "^2.0.46",
Expand All @@ -371,4 +367,4 @@
"typescript": "^2.0.3",
"vscode": "^1.0.0"
}
}
}
11 changes: 8 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as fs from "fs"

import {utility} from "@shd101wyy/mume"

import {MarkdownPreviewEnhancedView, getPreviewUri, isMarkdownFile, useSinglePreview, openWelcomePage} from "./preview-content-provider"
import {MarkdownPreviewEnhancedView, getPreviewUri, isMarkdownFile, useSinglePreview} from "./preview-content-provider"
import {uploadImageFile, pasteImageFile} from "./image-helper"

// this method is called when your extension iopenTextDocuments activated
Expand Down Expand Up @@ -174,6 +174,11 @@ export function activate(context: vscode.ExtensionContext) {
contentProvider.htmlExport(sourceUri, offline)
}

function chromeExport(uri, type) {
const sourceUri = vscode.Uri.parse(decodeURIComponent(uri));
contentProvider.chromeExport(sourceUri, type)
}

function phantomjsExport(uri, type) {
const sourceUri = vscode.Uri.parse(decodeURIComponent(uri));
contentProvider.phantomjsExport(sourceUri, type)
Expand Down Expand Up @@ -399,8 +404,6 @@ export function activate(context: vscode.ExtensionContext) {

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

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

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

context.subscriptions.push(vscode.commands.registerCommand('markdown-preview-enhanced.showUploadedImages', showUploadedImages))
Expand All @@ -427,6 +430,8 @@ export function activate(context: vscode.ExtensionContext) {

context.subscriptions.push(vscode.commands.registerCommand('_mume.htmlExport', htmlExport))

context.subscriptions.push(vscode.commands.registerCommand('_mume.chromeExport', chromeExport))

context.subscriptions.push(vscode.commands.registerCommand('_mume.phantomjsExport', phantomjsExport))

context.subscriptions.push(vscode.commands.registerCommand('_mume.princeExport', princeExport))
Expand Down
20 changes: 18 additions & 2 deletions src/preview-content-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class MarkdownPreviewEnhancedView implements vscode.TextDocumentContentPr
const extensionVersion = require(path.resolve(this.context.extensionPath, './package.json'))['version']
if (extensionVersion !== mume.configs.config['vscode_mpe_version']) {
mume.utility.updateExtensionConfig({'vscode_mpe_version': extensionVersion})
openWelcomePage()
// openWelcomePage() // <== disable welcome page
}
})
}
Expand Down Expand Up @@ -322,12 +322,28 @@ export class MarkdownPreviewEnhancedView implements vscode.TextDocumentContentPr
}
}

public chromeExport(sourceUri: Uri, type: string) {
const engine = this.getEngine(sourceUri)
if (engine) {
engine.chromeExport({fileType: type, openFileAfterGeneration: true})
.then((dest)=> {
vscode.window.showInformationMessage(`File ${path.basename(dest)} was created at path: ${dest}`)
})
.catch((error)=> {
vscode.window.showErrorMessage(error)
})
}
}

public phantomjsExport(sourceUri: Uri, type: string) {
const engine = this.getEngine(sourceUri)
if (engine) {
engine.phantomjsExport({fileType: type, openFileAfterGeneration: true})
.then((dest)=> {
vscode.window.showInformationMessage(`File ${path.basename(dest)} was created at path: ${dest}`)
if (dest.endsWith('?print-pdf')) // presentation pdf
vscode.window.showInformationMessage(`Please copy and open the link: { ${dest.replace(/\_/g, '\\_')} } in Chrome then Print as Pdf.`)
else
vscode.window.showInformationMessage(`File ${path.basename(dest)} was created at path: ${dest}`)
})
.catch((error)=> {
vscode.window.showErrorMessage(error)
Expand Down

0 comments on commit 4fd613e

Please sign in to comment.