Simplify browser url, remove useless pdf buttons

This commit is contained in:
James-Yu 2017-01-12 08:20:05 +08:00
parent a2f210a094
commit eafa2206d9
6 changed files with 23 additions and 12 deletions

View File

@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.2.1] - 2017-01-12
### Changed
- In browser PDF preview URL.
- User should not experience any feature changes
### Removed
- Several useless PDF viewer buttons: open, download, presentation mode.
## [0.2.0] - 2017-01-11
### Add
- In browser PDF preview.

View File

@ -26,7 +26,7 @@ Alternatively, you can check out this repository and copy it to the VS Code loca
- Compile: Either use `latex-workshop.compile` command, or use right click menu, or simply enable compile-on-save.
- Preview: Click on the `Show Preview` button on the top-right corner of the editor. The preview is updated automatically after compilation.
- In-browser Preview: Right click on TeX and select `Show In-browser Preview`
- In-browser Preview: Right click on TeX and select `Show In-browser Preview`.
- Direct SyncTex from Tex to PDF: Open preview first then right click on TeX and select `Find in Preview`.
- Reverse SyncTex from PDF to TeX: ctrl/cmd + left click on PDF preview.
- Autocomplete: An autocomplete list will show up when '\' or '{' is typed. Multi-citation supported.

View File

@ -3,7 +3,7 @@
"displayName": "LaTeX Workshop",
"description": "AIO LaTeX extension to preview, compile, autocomplete, colorize, and more.",
"icon": "img/icon.png",
"version": "0.2.0",
"version": "0.2.1",
"publisher": "James-Yu",
"license": "MIT",
"homepage": "https://github.com/James-Yu/LaTeX-Workshop",

View File

@ -1,6 +1,7 @@
var query = document.location.search.substring(1);
var parts = query.split('&');
var server, file;
var server = undefined;
var file;
for (var i = 0, ii = parts.length; i < ii; ++i) {
var param = parts[i].split('=');
if (param[0].toLowerCase() == "server")
@ -8,6 +9,9 @@ for (var i = 0, ii = parts.length; i < ii; ++i) {
if (param[0].toLowerCase() == "file")
file = decodeURIComponent(param[1]);
}
if (server == undefined) {
server = `ws://${window.location.hostname}:${window.location.port}`
}
var socket = new WebSocket(server);
socket.addEventListener("open", () => socket.send(JSON.stringify({type:"open", path:file})));

View File

@ -96,11 +96,11 @@ See https://github.com/adobe-type-tools/cmap-resources
<div id="secondaryToolbar" class="secondaryToolbar hidden doorHangerRight">
<div id="secondaryToolbarButtonContainer">
<button id="secondaryPresentationMode" class="secondaryToolbarButton presentationMode visibleLargeView" title="Switch to Presentation Mode" tabindex="51" data-l10n-id="presentation_mode">
<button style="display:none" id="secondaryPresentationMode" class="secondaryToolbarButton presentationMode visibleLargeView" title="Switch to Presentation Mode" tabindex="51" data-l10n-id="presentation_mode">
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>
<button id="secondaryOpenFile" class="secondaryToolbarButton openFile visibleLargeView" title="Open File" tabindex="52" data-l10n-id="open_file">
<button style="display:none" id="secondaryOpenFile" class="secondaryToolbarButton openFile visibleLargeView" title="Open File" tabindex="52" data-l10n-id="open_file">
<span data-l10n-id="open_file_label">Open</span>
</button>
@ -108,7 +108,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<span data-l10n-id="print_label">Print</span>
</button>
<button id="secondaryDownload" class="secondaryToolbarButton download visibleMediumView" title="Download" tabindex="54" data-l10n-id="download">
<button style="display:none" id="secondaryDownload" class="secondaryToolbarButton download visibleMediumView" title="Download" tabindex="54" data-l10n-id="download">
<span data-l10n-id="download_label">Download</span>
</button>
@ -172,11 +172,11 @@ See https://github.com/adobe-type-tools/cmap-resources
<span id="numPages" class="toolbarLabel"></span>
</div>
<div id="toolbarViewerRight">
<button id="presentationMode" class="toolbarButton presentationMode hiddenLargeView" title="Switch to Presentation Mode" tabindex="31" data-l10n-id="presentation_mode">
<button style="display:none" id="presentationMode" class="toolbarButton presentationMode hiddenLargeView" title="Switch to Presentation Mode" tabindex="31" data-l10n-id="presentation_mode">
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>
<button id="openFile" class="toolbarButton openFile hiddenLargeView" title="Open File" tabindex="32" data-l10n-id="open_file">
<button style="display:none" id="openFile" class="toolbarButton openFile hiddenLargeView" title="Open File" tabindex="32" data-l10n-id="open_file">
<span data-l10n-id="open_file_label">Open</span>
</button>
@ -184,7 +184,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<span data-l10n-id="print_label">Print</span>
</button>
<button id="download" class="toolbarButton download hiddenMediumView" title="Download" tabindex="34" data-l10n-id="download">
<button style="display:none" id="download" class="toolbarButton download hiddenMediumView" title="Download" tabindex="34" data-l10n-id="download">
<span data-l10n-id="download_label">Download</span>
</button>
<a href="#" id="viewBookmark" class="toolbarButton bookmark hiddenSmallView" title="Current view (copy or open in new window)" tabindex="35" data-l10n-id="bookmark">

View File

@ -23,7 +23,7 @@ var in_browser_url = undefined;
export function create_server(context) {
var html_file = context.asAbsolutePath('pdfjs')
http_server = http.createServer((request, response) => {
if (request.url.indexOf('/pdf-file') < 0) {
if (request.url.indexOf('/pdf-preview') < 0) {
var file = path.join(html_file, request.url.split('?')[0])
var extname = path.extname(file);
var contentType = 'text/html';
@ -77,7 +77,7 @@ export function create_server(context) {
e(err)
else {
var {address, port} = http_server.address();
in_browser_url = `http://${address}:${port}/web/viewer.html?file=pdf-file&server=ws://${address}:${port}`
in_browser_url = `http://${address}:${port}/web/viewer.html?file=pdf-preview`
c()
}
}));
@ -148,7 +148,6 @@ export function preview_browser() {
compile();
}
open(in_browser_url);
console.log(in_browser_url)
}
export function preview(file_uri, column) {