mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
repair wechat bug (#4150)
This commit is contained in:
@@ -135,8 +135,13 @@ class App extends Component {
|
||||
navigate(url, {repalce: true});
|
||||
} else {
|
||||
let url = siteRoot + 'lib/' + selectedItem.repo_id + '/file' + Utils.encodePath(selectedItem.path);
|
||||
let newWindow = window.open('about:blank');
|
||||
newWindow.location.href = url;
|
||||
let isWeChat = Utils.isWeChat();
|
||||
if (!isWeChat) {
|
||||
let newWindow = window.open('about:blank');
|
||||
newWindow.location.href = url;
|
||||
} else {
|
||||
location.href = url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1068,9 +1068,14 @@ class LibContentView extends React.Component {
|
||||
if (this.state.currentMode === 'column' && Utils.isMarkdownFile(direntPath)) {
|
||||
this.showColumnMarkdownFile(direntPath);
|
||||
} else {
|
||||
const w=window.open('about:blank');
|
||||
const url = siteRoot + 'lib/' + repoID + '/file' + Utils.encodePath(direntPath);
|
||||
w.location.href = url;
|
||||
let isWeChat = Utils.isWeChat();
|
||||
if (!isWeChat) {
|
||||
let newWindow = window.open('about:blank');
|
||||
newWindow.location.href = url;
|
||||
} else {
|
||||
location.href = url;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -38,6 +38,13 @@ export const Utils = {
|
||||
return window.innerWidth >= 768;
|
||||
},
|
||||
|
||||
isWeChat: function() {
|
||||
let ua = window.navigator.userAgent.toLowerCase();
|
||||
let isWeChat = ua.match(/MicroMessenger/i) == 'micromessenger';
|
||||
let isEnterpriseWeChat = ua.match(/MicroMessenger/i) == 'micromessenger' && ua.match(/wxwork/i) == 'wxwork';
|
||||
return isEnterpriseWeChat || isWeChat;
|
||||
},
|
||||
|
||||
FILEEXT_ICON_MAP: {
|
||||
|
||||
// text file
|
||||
|
Reference in New Issue
Block a user