Skip to content

Commit

Permalink
+:developer tools
Browse files Browse the repository at this point in the history
  • Loading branch information
dzylikecode committed Oct 20, 2022
1 parent 784b655 commit e46e4d5
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 3 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@

![](assets/feature/go-here.gif)

If you are interested in my Docsify template, welcome to visit my [Docsify-template](https://dzylikecode.github.io/#/blog/docsify/?id=template), which supports mindmap, math formula, mermaid, jsRunkit, and so on.
- open develop tools

![](assets/2022-10-20-10-22-01.png)

> the hint to find your source file in the developer tools
If you are interested in my Docsify template, welcome to visit my [Docsify-template](https://dzylikecode.github.io/#/blog/docsify/?id=template) or fork this [repo](https://github.com/dzylikecode/template-docsify), which supports mindmap, math formula, mermaid, jsRunkit, and so on.

If you want to paste images in markdown, welcome to use my other plugin:[md-paste-enhanced](https://marketplace.visualstudio.com/items?itemName=dzylikecode.md-paste-enhanced).

Expand Down Expand Up @@ -61,6 +67,14 @@ I have fixed all the issues I met. If you find any issues, please report them to

## Release Notes

### 1.4.0

- feature:

- context menu

open develop tools

### 1.3.0

- fix:
Expand Down
Binary file added assets/2022-10-20-10-22-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "docsify-preview",
"displayName": "docsify-Preview",
"description": "write docs easily with docsify",
"version": "1.3.0",
"version": "1.4.0",
"engines": {
"vscode": "^1.71.0"
},
Expand Down
4 changes: 4 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ async function main(context, disposable) {
} else if (message.command == "loaded") {
server.url = server.parseUrl(message.url);
server.setTitile(`[Preview] ${message.url}`);
} else if (message.command == "openDeveloperTools") {
vscode.commands.executeCommand(
"workbench.action.webview.openDeveloperTools"
);
}
return;
function goHere(url, linePercent) {
Expand Down
7 changes: 6 additions & 1 deletion src/server/assets/css/contextMenu.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ ul.contextMenu li {
border-radius: 0.2em;
}
ul.contextMenu li i {
width: 1em;
width: 1.2em;
}
ul.contextMenu li i.fa-file-lines {
position: relative;
left: 2px;
}

ul.contextMenu li i.fa-code {
position: relative;
right: 3px;
}

ul.contextMenu li:hover {
background-color: #395973;
}
9 changes: 9 additions & 0 deletions src/server/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ window.addEventListener("message", (event) => {
break;
}
});

function loadFrame(url) {
iframe.src = url;
}
Expand All @@ -74,6 +75,7 @@ function popContextMenu(x, y) {
$("ul.contextMenu").show().css({ top: y, left: x });
}
}

function openInBrowser() {
log("open in browser");
hideContextMenu();
Expand All @@ -89,3 +91,10 @@ function goHere() {
linePercent: curScrollPos,
});
}

function openDeveloperTools() {
hideContextMenu();
vscode.postMessage({
command: "openDeveloperTools",
});
}
3 changes: 3 additions & 0 deletions src/server/webView.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<li onclick="openInBrowser()">
<i class="fa-solid fa-file-lines"></i> Open in Browser
</li>
<li onclick="openDeveloperTools()">
<i class="fa-solid fa-code"></i> Open Developer Tools
</li>
</ul>
<iframe id="Server" allowTransparency="false" frameborder="0"></iframe>
<script src="${assets/js/main.js}"></script>
Expand Down

0 comments on commit e46e4d5

Please sign in to comment.