mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
solve compatibility problems
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('react-app-polyfill/ie9');
|
||||
require('react-app-polyfill/stable');
|
||||
|
||||
if (typeof Promise === 'undefined') {
|
||||
// Rejection tracking prevents a common issue where React gets into an
|
||||
// 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');
|
||||
}
|
||||
|
||||
// require('babel-polyfill');
|
||||
require('react-app-polyfill/stable');
|
||||
|
||||
// fetch() polyfill for making API calls.
|
||||
require('whatwg-fetch');
|
||||
|
||||
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
||||
import listener from './globalEventListener';
|
||||
import { hideMenu } from './actions';
|
||||
import { callIfExists } from './helpers';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
id: PropTypes.string.isRequired,
|
||||
@@ -192,7 +193,7 @@ class ContextMenu extends React.Component {
|
||||
|
||||
onMenuItemClick = (event) => {
|
||||
event.stopPropagation();
|
||||
let operation = event.target.dataset.operation;
|
||||
let operation = Utils.getEventData(event, 'operation');
|
||||
let currentObject = this.state.currentObject;
|
||||
this.props.onMenuItemClick(operation, currentObject, event);
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import { Link } from '@reach/router';
|
||||
import { UncontrolledTooltip } from 'reactstrap';
|
||||
import { siteRoot, gettext } from '../../utils/constants';
|
||||
import InternalLinkDialog from '../dialog/internal-link-dialog';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
repoName: PropTypes.string.isRequired,
|
||||
@@ -19,7 +20,7 @@ const propTypes = {
|
||||
class DirPath extends React.Component {
|
||||
|
||||
onPathClick = (e) => {
|
||||
let path = e.target.dataset.path;
|
||||
let path = Utils.getEventData(e, 'path');
|
||||
this.props.onPathClick(path);
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,7 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap';
|
||||
import { gettext, folderPermEnabled, enableRepoSnapshotLabel, enableResetEncryptedRepoPassword, isEmailConfigured } from '../../utils/constants';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
isPC: PropTypes.bool,
|
||||
@@ -21,7 +22,7 @@ class MylibRepoMenu extends React.Component {
|
||||
}
|
||||
|
||||
onMenuItemClick = (e) => {
|
||||
let operation = e.target.dataset.toggle;
|
||||
let operation = Utils.getEventData(e, 'toggle');
|
||||
this.props.onMenuItemClick(operation);
|
||||
}
|
||||
|
||||
|
@@ -6,6 +6,7 @@ import CommonToolbar from '../../components/toolbar/common-toolbar';
|
||||
import WikiMarkdownViewer from '../../components/wiki-markdown-viewer';
|
||||
import WikiDirListView from '../../components/wiki-dir-list-view/wiki-dir-list-view';
|
||||
import Loading from '../../components/loading';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
path: PropTypes.string.isRequired,
|
||||
@@ -37,7 +38,8 @@ class MainPanel extends Component {
|
||||
}
|
||||
|
||||
onMainNavBarClick = (e) => {
|
||||
this.props.onMainNavBarClick(e.target.dataset.path);
|
||||
let path = Utils.getEventData(e, path);
|
||||
this.props.onMainNavBarClick(path);
|
||||
}
|
||||
|
||||
renderNavPath = () => {
|
||||
|
@@ -229,6 +229,13 @@ export const Utils = {
|
||||
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) {
|
||||
let size = Utils.isHiDPI() ? 48 : 24;
|
||||
size = isBig ? 256 : size;
|
||||
@@ -871,6 +878,14 @@ export const Utils = {
|
||||
password += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
}
|
||||
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