Revert "Upgrade to webpack@5 (#4725)" (#4872)

This commit is contained in:
Jim Ehrismann authored and GitHub committed 2022-02-16 09:14:14 -05:00
1 parent a2ee3c4d5d
commit 733bb543c9
52 files changed
+18973 -5519

No files matched your search

+4 -12
View File
@@ -11,7 +11,6 @@ import type { LocationDescriptor } from "history";
import { boundMethod, cssNames } from "../../utils";
import { TooltipDecoratorProps, withTooltip } from "../tooltip";
import isNumber from "lodash/isNumber";
import { decode } from "../../../common/utils/base64";
export interface IconProps extends React.HTMLAttributes<any>, TooltipDecoratorProps {
material?: string; // material-icon, see available names at https://material.io/icons/
@@ -37,10 +36,6 @@ export class Icon extends React.PureComponent<IconProps> {
focusable: true,
};
static isSvg(content: string) {
return String(content).includes("svg+xml"); // data-url for raw svg-icon
}
get isInteractive() {
const { interactive, onClick, href, link } = this.props;
@@ -63,7 +58,7 @@ export class Icon extends React.PureComponent<IconProps> {
switch (evt.nativeEvent.code) {
case "Space":
// fallthrough
// fallthrough
case "Enter": {
this.ref.current?.click();
evt.preventDefault();
@@ -103,12 +98,9 @@ export class Icon extends React.PureComponent<IconProps> {
// render as inline svg-icon
if (typeof svg === "string") {
const dataUrlPrefix = "data:image/svg+xml;base64,";
const svgIconDataUrl = svg.startsWith(dataUrlPrefix) ? svg : require(`./${svg}.svg`);
const svgIconText = typeof svgIconDataUrl == "string" // decode xml from data-url
? decode(svgIconDataUrl.replace(dataUrlPrefix, "")) : "";
const svgIconText = svg.includes("<svg") ? svg : require(`!!raw-loader!./${svg}.svg`).default;
iconContent = <span className="icon" dangerouslySetInnerHTML={{ __html: svgIconText }} />;
iconContent = <span className="icon" dangerouslySetInnerHTML={{ __html: svgIconText }}/>;
}
// render as material-icon
@@ -136,7 +128,7 @@ export class Icon extends React.PureComponent<IconProps> {
}
if (href) {
return <a {...iconProps} href={href} ref={this.ref} />;
return <a {...iconProps} href={href} ref={this.ref}/>;
}
return <i {...iconProps} ref={this.ref} />;