Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: 优化iframe预览,后缀名不区分大小写;预览背景不透明 #246

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/components/ShowFile/ShowFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4358,13 +4358,16 @@ export default {
return this.notPreviewDialogVisible;
},
hasIframePreview(suffix, fileHandlers) {
// 将 suffix 转换为小写
const lowerCaseSuffix = suffix.toLowerCase();
for (let key in fileHandlers) {
const extensions = key.split(',')
if (extensions.includes(suffix)) {
return fileHandlers[key]
// 将 key 中的扩展名全部转换为小写
const extensions = key.split(',').map(extension => extension.toLowerCase());
if (extensions.includes(lowerCaseSuffix)) {
return fileHandlers[key];
}
}
return null
return null;
},
determineDownload(file) {
this.download(file)
Expand Down
3 changes: 2 additions & 1 deletion src/components/preview/IframeContentPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
:value="item.value">
</el-option>
</el-select>
<el-button size="medium" type="primary" @click="openUrl"><svg-icon icon-class="wailian"/></el-button>
<el-button title="外部打开" size="medium" type="primary" @click="openUrl"><svg-icon icon-class="wailian"/></el-button>
</div>
</div>
</div>
Expand Down Expand Up @@ -153,6 +153,7 @@ export default {
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
background: #dcdfe6;
iframe {
width: 100%;
height: 100%;
Expand Down