mirror of
https://github.com/ritz078/transform.git
synced 2026-11-25 02:10:02 +03:00
remove code from url
This commit is contained in:
1 parent
2dd4586544
commit
49b1398d9f
2 files changed
+11
-23
No files matched your search
@@ -72,16 +72,19 @@ export default class ConversionPanel extends PureComponent {
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
const code = this.props.url.query.code || this.props.defaultText;
|
||||
const splitValue = this.props.url.query.splitValue || this.props.splitValue;
|
||||
const {defaultText, splitValue} = this.props
|
||||
|
||||
const code = defaultText;
|
||||
const sValue = splitValue;
|
||||
this.setState({
|
||||
value: code,
|
||||
splitValue,
|
||||
resultValue: this.props.getTransformedValue(code, splitValue)
|
||||
splitValue: sValue,
|
||||
resultValue: this.props.getTransformedValue(code, sValue)
|
||||
});
|
||||
}
|
||||
|
||||
onChange = (newValue: string, leftSplitValue: string) => {
|
||||
onChange = (newValue, leftSplitValue) => {
|
||||
debugger
|
||||
const nValue = newValue || this.state.value;
|
||||
const splitValue =
|
||||
leftSplitValue && typeof leftSplitValue === "string"
|
||||
@@ -96,8 +99,6 @@ export default class ConversionPanel extends PureComponent {
|
||||
info: "",
|
||||
infoType: ""
|
||||
});
|
||||
|
||||
this.setCodeInUrl(newValue, leftSplitValue);
|
||||
} catch (e) {
|
||||
this.setState({
|
||||
info: e.message,
|
||||
@@ -111,17 +112,7 @@ export default class ConversionPanel extends PureComponent {
|
||||
});
|
||||
};
|
||||
|
||||
setCodeInUrl = (code, leftSplitValue) => {
|
||||
Router.replace({
|
||||
pathname: this.props.url.pathname,
|
||||
query: {
|
||||
code,
|
||||
splitValue: leftSplitValue
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
toggleCheckbox = (e: MouseEvent) => {
|
||||
toggleCheckbox = (e) => {
|
||||
const checked = e.currentTarget.checked;
|
||||
if (this.props.onCheckboxChange) {
|
||||
this.props.onCheckboxChange(checked, () => {
|
||||
@@ -132,13 +123,10 @@ export default class ConversionPanel extends PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
setResult = (result: string) => {
|
||||
setResult = (result) => {
|
||||
this.setState(
|
||||
{
|
||||
value: result
|
||||
},
|
||||
() => {
|
||||
this.setCodeInUrl(result);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
@@ -430,7 +430,7 @@ export default class Layout extends PureComponent {
|
||||
}
|
||||
>
|
||||
{route.content.map(a => (
|
||||
<Link prefetch href={a.path}>
|
||||
<Link key={a.path} prefetch href={a.path}>
|
||||
<a className={this.getClass(a.path)}>{a.label}</a>
|
||||
</Link>
|
||||
))}
|
||||
|
||||
Reference in new issue
Block a user