Skip to content

Commit 81c0606

Browse files
committed
feat(webview): preview the image of bucket explorer
1 parent f3aa7e0 commit 81c0606

File tree

11 files changed

+783
-12
lines changed

11 files changed

+783
-12
lines changed

.eslintignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
dist
22
out
3-
webpack.config.js
3+
webpack.config.js
4+
resources/webview/main.js

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,11 @@ If you want to debugger the project, just press `F5` to Run Extension. Then we c
157157

158158
> since `@types/ali-oss` is outdated you may see some ts error in your local
159159
160-
## WIP
160+
<!-- ## WIP
161161
162162
working in bucket explorer
163163
164-
![bucketExplorerWIP](https://fangbinwei-blog-image.oss-cn-shanghai.aliyuncs.com/github/aliyun-oss-uploader/bucketExplorerWIP.png)
164+
![bucketExplorerWIP](https://fangbinwei-blog-image.oss-cn-shanghai.aliyuncs.com/github/aliyun-oss-uploader/bucketExplorerWIP.png) -->
165165

166166
## TODO
167167

package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,18 @@
3939
"commands": [
4040
{
4141
"command": "elan.setOSSConfiguration",
42-
"title": "Elan: Set OSS Configuration"
42+
"title": "Set OSS Configuration",
43+
"category": "Elan"
4344
},
4445
{
4546
"command": "elan.uploadFromClipboard",
46-
"title": "Elan: Upload Image from Clipboard"
47+
"title": "Upload Image from Clipboard",
48+
"category": "Elan"
4749
},
4850
{
4951
"command": "elan.uploadFromExplorer",
50-
"title": "Elan: Upload Image from Explorer"
52+
"title": "Upload Image from Explorer",
53+
"category": "Elan"
5154
},
5255
{
5356
"command": "elan.uploadFromExplorerContext",

resources/webview/loading-dark.svg

+31
Loading

resources/webview/loading-hc.svg

+31
Loading

resources/webview/loading.svg

+31
Loading

resources/webview/main.css

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
html, body {
7+
width: 100%;
8+
height: 100%;
9+
text-align: center;
10+
}
11+
12+
body img {
13+
max-width: none;
14+
max-height: none;
15+
}
16+
17+
.container:focus {
18+
outline: none !important;
19+
}
20+
21+
.container {
22+
padding: 5px 0 0 10px;
23+
box-sizing: border-box;
24+
-webkit-user-select: none;
25+
user-select: none;
26+
}
27+
28+
.container.image {
29+
padding: 0;
30+
display: flex;
31+
box-sizing: border-box;
32+
}
33+
34+
.container.image img {
35+
padding: 0;
36+
background-position: 0 0, 8px 8px;
37+
background-size: 16px 16px;
38+
border: 1px solid var(--vscode-imagePreview-border);
39+
}
40+
41+
.container.image img {
42+
background-image:
43+
linear-gradient(45deg, rgb(230, 230, 230) 25%, transparent 25%, transparent 75%, rgb(230, 230, 230) 75%, rgb(230, 230, 230)),
44+
linear-gradient(45deg, rgb(230, 230, 230) 25%, transparent 25%, transparent 75%, rgb(230, 230, 230) 75%, rgb(230, 230, 230));
45+
}
46+
47+
.vscode-dark.container.image img {
48+
background-image:
49+
linear-gradient(45deg, rgb(20, 20, 20) 25%, transparent 25%, transparent 75%, rgb(20, 20, 20) 75%, rgb(20, 20, 20)),
50+
linear-gradient(45deg, rgb(20, 20, 20) 25%, transparent 25%, transparent 75%, rgb(20, 20, 20) 75%, rgb(20, 20, 20));
51+
}
52+
53+
.container img.pixelated {
54+
image-rendering: pixelated;
55+
}
56+
57+
.container img.scale-to-fit {
58+
max-width: calc(100% - 20px);
59+
max-height: calc(100% - 20px);
60+
object-fit: contain;
61+
}
62+
63+
.container img {
64+
margin: auto;
65+
}
66+
67+
.container.ready.zoom-in {
68+
cursor: zoom-in;
69+
}
70+
71+
.container.ready.zoom-out {
72+
cursor: zoom-out;
73+
}
74+
75+
.container .embedded-link,
76+
.container .embedded-link:hover {
77+
cursor: pointer;
78+
text-decoration: underline;
79+
margin-left: 5px;
80+
}
81+
82+
.container.loading,
83+
.container.error {
84+
display: flex;
85+
justify-content: center;
86+
align-items: center;
87+
}
88+
89+
.loading-indicator {
90+
width: 30px;
91+
height: 30px;
92+
background-image: url('./loading.svg');
93+
background-size: cover;
94+
}
95+
96+
.loading-indicator,
97+
.image-load-error {
98+
display: none;
99+
}
100+
101+
.loading .loading-indicator,
102+
.error .image-load-error {
103+
display: block;
104+
}
105+
106+
.image-load-error {
107+
margin: 1em;
108+
}
109+
110+
.vscode-dark .loading-indicator {
111+
background-image: url('./loading-dark.svg');
112+
}
113+
114+
.vscode-high-contrast .loading-indicator {
115+
background-image: url('./loading-hc.svg');
116+
}

0 commit comments

Comments
 (0)