Skip to content

Commit

Permalink
Merge pull request #24 from shd101wyy/0.1.7-fix
Browse files Browse the repository at this point in the history
0.1.7 fix
  • Loading branch information
shd101wyy authored Jul 12, 2017
2 parents 75722c0 + cbb10e8 commit 2fc164c
Show file tree
Hide file tree
Showing 5 changed files with 1,136 additions and 13 deletions.
12 changes: 7 additions & 5 deletions docs/welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ presentation:

<!-- slide -->
# Hello version 0.1.7
This presentation is created by
**Markdown Preview Enhanced**

Powered by
[reveal.js](https://github.com/hakimel/reveal.js)

<p style="font-size: 18px;">press <kbd>?</kbd> key to see keyboard help.</p>
<p style="font-size: 18px;">press <kbd>s</kbd> key to open note window.</p>
<p style="font-size: 18px;">press <kbd>arrow</kbd> key to navigate.</p>
<p style="font-size: 18px;">press <kbd>esc</kbd> to toggle overview.</p>

<!-- slide -->
This presentation is created by
**Markdown Preview Enhanced**

Powered by
[reveal.js](https://github.com/hakimel/reveal.js)

<!-- slide -->
You can easily create beautiful presentation by running command

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
"package": "vsce package"
},
"dependencies": {
"@shd101wyy/mume": "0.0.9"
"@shd101wyy/mume": "^0.1.0"
},
"devDependencies": {
"@types/jquery": "^2.0.46",
Expand Down
8 changes: 3 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,10 @@ export function activate(context: vscode.ExtensionContext) {
}

function webviewFinishLoading(sourceUri) {
// do nothing
/*
sourceUri = vscode.Uri.parse(sourceUri)
contentProvider.initMarkdownEngine(sourceUri)
contentProvider.update(sourceUri)
*/
// contentProvider.initMarkdownEngine(sourceUri)
// contentProvider.update(sourceUri)
contentProvider.updateMarkdown(sourceUri)
}

/**
Expand Down
11 changes: 9 additions & 2 deletions src/markdown-preview-enhanced-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export class MarkdownPreviewEnhancedView implements vscode.TextDocumentContentPr
config: this.config
})
this.engineMaps[sourceUri.fsPath] = engine
this.jsAndCssFilesMaps[sourceUri.fsPath] = []
}
return engine
}
Expand Down Expand Up @@ -230,17 +231,23 @@ export class MarkdownPreviewEnhancedView implements vscode.TextDocumentContentPr
previewUri: previewUri.toString(),
sourceUri: sourceUri.toString(),
initialLine: initialLine,
}
},
webviewScript: path.resolve(this.context.extensionPath, './out/src/webview.js')
})
})
}

// FIXME: presentation markdown is parsed twice here...
public updateMarkdown(sourceUri:Uri, triggeredBySave?:boolean) {
const engine = this.getEngine(sourceUri)
// console.log('updateMarkdown: ' + Object.keys(this.engineMaps).length)
if (!engine) return

// presentation mode
if (engine.isPreviewInPresentationMode) {
return this._onDidChange.fire(getPreviewUri(sourceUri))
}

// not presentation mode
vscode.workspace.openTextDocument(sourceUri).then(document => {
const text = document.getText()

Expand Down
Loading

0 comments on commit 2fc164c

Please sign in to comment.