Merge pull request #394 from Strencher/development
More details for the ErrorBoundary, update gulpfile.js
This commit is contained in:
commit
60e0b9a1b0
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -11,6 +11,6 @@ gulp.task("watch-css", function() {
|
||||||
function minifyCSS() {
|
function minifyCSS() {
|
||||||
return gulp.src("./src/styles/index.css")
|
return gulp.src("./src/styles/index.css")
|
||||||
.pipe(csso({restructure: false}))
|
.pipe(csso({restructure: false}))
|
||||||
.pipe(rename("style.min.css"))
|
.pipe(rename("style.css"))
|
||||||
.pipe(gulp.dest("./dist"));
|
.pipe(gulp.dest("./dist"));
|
||||||
}
|
}
|
|
@ -1,3 +1,11 @@
|
||||||
|
/* Error Boundary stuff */
|
||||||
|
.react-error {
|
||||||
|
color: red;
|
||||||
|
font-weight: bold;
|
||||||
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.bd-settings-group.collapsible .bd-settings-title {
|
.bd-settings-group.collapsible .bd-settings-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import {React, Logger} from "modules";
|
import {React, Logger} from "modules";
|
||||||
|
import {remote} from "electron";
|
||||||
export default class ErrorBoundary extends React.Component {
|
export default class ErrorBoundary extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {hasError: false};
|
this.state = {hasError: false};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidCatch() {
|
componentDidCatch(error, errorInfo) {
|
||||||
this.setState({hasError: true});
|
this.setState({hasError: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.hasError) return <div className="react-error">Component Error</div>;
|
if (this.state.hasError) return <div onClick={() => remote.getCurrentWindow().openDevTools()} className="react-error">There was an unexpected Error. Click to open console for more details.</div>;
|
||||||
return this.props.children;
|
return this.props.children;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ export default class AddonCard extends React.Component {
|
||||||
catch (err) { Logger.stacktrace("Addon Settings", "Unable to get settings panel for " + name + ".", err); }
|
catch (err) { Logger.stacktrace("Addon Settings", "Unable to get settings panel for " + name + ".", err); }
|
||||||
|
|
||||||
const props = {id: `${name}-settings`, className: "addon-settings", ref: this.panelRef};
|
const props = {id: `${name}-settings`, className: "addon-settings", ref: this.panelRef};
|
||||||
if (typeof(settingsPanel) == "string") {
|
if (typeof(this.settingsPanel) == "string") {
|
||||||
Logger.warn("Addon Settings", "Using a DOMString is officially deprecated.");
|
Logger.warn("Addon Settings", "Using a DOMString is officially deprecated.");
|
||||||
props.dangerouslySetInnerHTML = this.settingsPanel;
|
props.dangerouslySetInnerHTML = this.settingsPanel;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue