mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
solve compatibility problems
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
require('react-app-polyfill/ie9');
|
||||||
|
require('react-app-polyfill/stable');
|
||||||
|
|
||||||
if (typeof Promise === 'undefined') {
|
if (typeof Promise === 'undefined') {
|
||||||
// Rejection tracking prevents a common issue where React gets into an
|
// Rejection tracking prevents a common issue where React gets into an
|
||||||
// inconsistent state due to an error, but it gets swallowed by a Promise,
|
// inconsistent state due to an error, but it gets swallowed by a Promise,
|
||||||
@@ -8,9 +11,6 @@ if (typeof Promise === 'undefined') {
|
|||||||
window.Promise = require('promise/lib/es6-extensions.js');
|
window.Promise = require('promise/lib/es6-extensions.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
// require('babel-polyfill');
|
|
||||||
require('react-app-polyfill/stable');
|
|
||||||
|
|
||||||
// fetch() polyfill for making API calls.
|
// fetch() polyfill for making API calls.
|
||||||
require('whatwg-fetch');
|
require('whatwg-fetch');
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
import listener from './globalEventListener';
|
import listener from './globalEventListener';
|
||||||
import { hideMenu } from './actions';
|
import { hideMenu } from './actions';
|
||||||
import { callIfExists } from './helpers';
|
import { callIfExists } from './helpers';
|
||||||
|
import { Utils } from '../../utils/utils';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
id: PropTypes.string.isRequired,
|
id: PropTypes.string.isRequired,
|
||||||
@@ -192,7 +193,7 @@ class ContextMenu extends React.Component {
|
|||||||
|
|
||||||
onMenuItemClick = (event) => {
|
onMenuItemClick = (event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
let operation = event.target.dataset.operation;
|
let operation = Utils.getEventData(event, 'operation');
|
||||||
let currentObject = this.state.currentObject;
|
let currentObject = this.state.currentObject;
|
||||||
this.props.onMenuItemClick(operation, currentObject, event);
|
this.props.onMenuItemClick(operation, currentObject, event);
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@ import { Link } from '@reach/router';
|
|||||||
import { UncontrolledTooltip } from 'reactstrap';
|
import { UncontrolledTooltip } from 'reactstrap';
|
||||||
import { siteRoot, gettext } from '../../utils/constants';
|
import { siteRoot, gettext } from '../../utils/constants';
|
||||||
import InternalLinkDialog from '../dialog/internal-link-dialog';
|
import InternalLinkDialog from '../dialog/internal-link-dialog';
|
||||||
|
import { Utils } from '../../utils/utils';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
repoName: PropTypes.string.isRequired,
|
repoName: PropTypes.string.isRequired,
|
||||||
@@ -19,7 +20,7 @@ const propTypes = {
|
|||||||
class DirPath extends React.Component {
|
class DirPath extends React.Component {
|
||||||
|
|
||||||
onPathClick = (e) => {
|
onPathClick = (e) => {
|
||||||
let path = e.target.dataset.path;
|
let path = Utils.getEventData(e, 'path');
|
||||||
this.props.onPathClick(path);
|
this.props.onPathClick(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap';
|
import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap';
|
||||||
import { gettext, folderPermEnabled, enableRepoSnapshotLabel, enableResetEncryptedRepoPassword, isEmailConfigured } from '../../utils/constants';
|
import { gettext, folderPermEnabled, enableRepoSnapshotLabel, enableResetEncryptedRepoPassword, isEmailConfigured } from '../../utils/constants';
|
||||||
|
import { Utils } from '../../utils/utils';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
isPC: PropTypes.bool,
|
isPC: PropTypes.bool,
|
||||||
@@ -21,7 +22,7 @@ class MylibRepoMenu extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMenuItemClick = (e) => {
|
onMenuItemClick = (e) => {
|
||||||
let operation = e.target.dataset.toggle;
|
let operation = Utils.getEventData(e, 'toggle');
|
||||||
this.props.onMenuItemClick(operation);
|
this.props.onMenuItemClick(operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,6 +6,7 @@ import CommonToolbar from '../../components/toolbar/common-toolbar';
|
|||||||
import WikiMarkdownViewer from '../../components/wiki-markdown-viewer';
|
import WikiMarkdownViewer from '../../components/wiki-markdown-viewer';
|
||||||
import WikiDirListView from '../../components/wiki-dir-list-view/wiki-dir-list-view';
|
import WikiDirListView from '../../components/wiki-dir-list-view/wiki-dir-list-view';
|
||||||
import Loading from '../../components/loading';
|
import Loading from '../../components/loading';
|
||||||
|
import { Utils } from '../../utils/utils';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
@@ -37,7 +38,8 @@ class MainPanel extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMainNavBarClick = (e) => {
|
onMainNavBarClick = (e) => {
|
||||||
this.props.onMainNavBarClick(e.target.dataset.path);
|
let path = Utils.getEventData(e, path);
|
||||||
|
this.props.onMainNavBarClick(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderNavPath = () => {
|
renderNavPath = () => {
|
||||||
|
@@ -229,6 +229,13 @@ export const Utils = {
|
|||||||
navigator.userAgent.indexOf('Chrome') > -1;
|
navigator.userAgent.indexOf('Chrome') > -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isIEBrower: function() {
|
||||||
|
var userAgent = navigator.userAgent;
|
||||||
|
var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1;
|
||||||
|
var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
|
||||||
|
return isIE || isIE11;
|
||||||
|
},
|
||||||
|
|
||||||
getDefaultLibIconUrl: function(isBig) {
|
getDefaultLibIconUrl: function(isBig) {
|
||||||
let size = Utils.isHiDPI() ? 48 : 24;
|
let size = Utils.isHiDPI() ? 48 : 24;
|
||||||
size = isBig ? 256 : size;
|
size = isBig ? 256 : size;
|
||||||
@@ -871,6 +878,14 @@ export const Utils = {
|
|||||||
password += possible.charAt(Math.floor(Math.random() * possible.length));
|
password += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||||
}
|
}
|
||||||
return password;
|
return password;
|
||||||
|
},
|
||||||
|
|
||||||
|
getEventData: function(event, data) {
|
||||||
|
if (event.target.dataset) {
|
||||||
|
return event.target.dataset[data];
|
||||||
|
}
|
||||||
|
return event.target.getAttribute('data-' + data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user