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

fix: 搜索结果图片显示问题修复 #455

Merged
merged 2 commits into from
Feb 1, 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
9 changes: 9 additions & 0 deletions src/controller/search_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,12 @@ void SearchDb::addSearchEntry(const QString &app_name, const QString &lang,
//正则替换所有的svg路径
QRegExp exp("src=\"([^>]*svg)\"");
exp.setMinimal(true);
QRegExp expPng("src=\"..\/common([^>]*png)\"");
expPng.setMinimal(true);

content = content.replace(exp, QString("src=\"%1/%2\"").arg(strTemp).arg("\\1"));
if (content.contains("common")/* && !content.contains("fig")*/)
content = content.replace(expPng, QString("src=\"%1/../common%2\"").arg(strTemp).arg("\\1"));
newContents.replace(i, content);
}
}
Expand Down Expand Up @@ -667,9 +672,13 @@ void SearchDb::handleSearchContent(const QString &keyword)
//新结构
QRegExp expFit("<img src=\\\"fig.*>");
expFit.setMinimal(true);
//相对路径
QRegExp expRelative("<img src=\\\"\.\/fig.*>");
expRelative.setMinimal(true);

highlightContent.remove(expFit);
highlightContent.remove(expJpg);
highlightContent.remove(expRelative);

//处理内容是否省略..
omitHighlight(highlightContent, keyword);
Expand Down
6 changes: 3 additions & 3 deletions src/web/toManual/js/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,8 @@ class App extends React.Component {
document.documentElement.style.setProperty(`--body-color-white2black`, '#FFFFFF');
document.documentElement.style.setProperty(`--app-word-color`, '#414D68');
document.documentElement.style.setProperty(`--nav-background-color`, '#FFFFFF');
document.documentElement.style.setProperty(`--nav-h2-word-color`, '#001A2E');
document.documentElement.style.setProperty(`--nav-h3-word-color`, '#001A2E');
document.documentElement.style.setProperty(`--nav-h2-word-color`, 'rgba(0, 0, 0, 0.85)');
document.documentElement.style.setProperty(`--nav-h3-word-color`, 'rgba(0, 0, 0, 0.7)');
document.documentElement.style.setProperty('--nav-hove-word-color', '#000000');
document.documentElement.style.setProperty('--nav-hove-border-color', 'rgba(0, 0, 0, 0.05)');
// document.documentElement.style.setProperty(`--nav-hash-word-color`, '#ca0c16'); //btn list 改这一行
Expand All @@ -599,7 +599,7 @@ class App extends React.Component {
document.documentElement.style.setProperty(`--article-table-cell-border-color`, 'rgba(0, 0, 0, 0.05)');
document.documentElement.style.setProperty(`--index-item-background-color`, '#FFFFFF');
document.documentElement.style.setProperty(`--index-item-hover-color`, 'rgba(0,0,0,0.05)');
document.documentElement.style.setProperty(`--index-item-span-word-color`, '#414D68');
document.documentElement.style.setProperty(`--index-item-span-word-color`, 'rgba(0, 0, 0, 0.7)');
document.documentElement.style.setProperty(`--search-noresult-word-color`, '#000000');
document.documentElement.style.setProperty(`--search-button-word-color`, '#414D68');
document.documentElement.style.setProperty(`--search-button-hover-word-color`, '#001B2E');
Expand Down
30 changes: 18 additions & 12 deletions src/web/toManual/sass/search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,28 @@
vertical-align: middle;
}

//png图片
&[src$='png'] {
$i: 0;
margin-top: -2px;
height: 18px;
vertical-align: middle;
}

@while $i<1 {
$i: $i+0.25;
//png图片
// &[src$='png'] {
// $i: 0;

@media screen and (-webkit-min-device-pixel-ratio: 1+$i) {
zoom: 0.5/$i;
}
}
// @while $i<1 {
// $i: $i+0.25;

// margin-top: 26px; //搜索界面图片对其
max-width: 99%;
cursor: pointer;
}
// @media screen and (-webkit-min-device-pixel-ratio: 1+$i) {
// zoom: 0.5/$i;
// }
// }

// // margin-top: 26px; //搜索界面图片对其
// max-width: 99%;
// cursor: pointer;
// }

//jpg图片
&[src$='jpg'] {
Expand Down
17 changes: 3 additions & 14 deletions src/web_dist/toManual/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -657,20 +657,9 @@ body {
height: 18px;
vertical-align: middle; }
#search .items .item img[src$='png'] {
max-width: 99%;
cursor: pointer; }
@media screen and (-webkit-min-device-pixel-ratio: 1.25) {
#search .items .item img[src$='png'] {
zoom: 2; } }
@media screen and (-webkit-min-device-pixel-ratio: 1.5) {
#search .items .item img[src$='png'] {
zoom: 1; } }
@media screen and (-webkit-min-device-pixel-ratio: 1.75) {
#search .items .item img[src$='png'] {
zoom: 0.66667; } }
@media screen and (-webkit-min-device-pixel-ratio: 2) {
#search .items .item img[src$='png'] {
zoom: 0.5; } }
margin-top: -2px;
height: 18px;
vertical-align: middle; }
#search .items .item img[src$='jpg'] {
max-width: 99%;
cursor: pointer;
Expand Down
6 changes: 3 additions & 3 deletions src/web_dist/toManual/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,8 @@ var App = function (_React$Component) {
document.documentElement.style.setProperty('--body-color-white2black', '#FFFFFF');
document.documentElement.style.setProperty('--app-word-color', '#414D68');
document.documentElement.style.setProperty('--nav-background-color', '#FFFFFF');
document.documentElement.style.setProperty('--nav-h2-word-color', '#001A2E');
document.documentElement.style.setProperty('--nav-h3-word-color', '#001A2E');
document.documentElement.style.setProperty('--nav-h2-word-color', 'rgba(0, 0, 0, 0.85)');
document.documentElement.style.setProperty('--nav-h3-word-color', 'rgba(0, 0, 0, 0.7)');
document.documentElement.style.setProperty('--nav-hove-word-color', '#000000');
document.documentElement.style.setProperty('--nav-hove-border-color', 'rgba(0, 0, 0, 0.05)');
// document.documentElement.style.setProperty(`--nav-hash-word-color`, '#ca0c16'); //btn list 改这一行
Expand All @@ -679,7 +679,7 @@ var App = function (_React$Component) {
document.documentElement.style.setProperty('--article-table-cell-border-color', 'rgba(0, 0, 0, 0.05)');
document.documentElement.style.setProperty('--index-item-background-color', '#FFFFFF');
document.documentElement.style.setProperty('--index-item-hover-color', 'rgba(0,0,0,0.05)');
document.documentElement.style.setProperty('--index-item-span-word-color', '#414D68');
document.documentElement.style.setProperty('--index-item-span-word-color', 'rgba(0, 0, 0, 0.7)');
document.documentElement.style.setProperty('--search-noresult-word-color', '#000000');
document.documentElement.style.setProperty('--search-button-word-color', '#414D68');
document.documentElement.style.setProperty('--search-button-hover-word-color', '#001B2E');
Expand Down
Loading