Skip to content

Commit

Permalink
feat: render code from URL
Browse files Browse the repository at this point in the history
  • Loading branch information
dyon21 committed Nov 25, 2023
1 parent f2dc7a5 commit 3a4b02e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default class App extends Component {
lightVersion: false,
lineWrap: true,
infiniteLoopTimeout: 1000,
layoutMode: 2,
layoutMode: 1,
isJs13kModeOn: false,
autoCloseTags: true,
};
Expand Down Expand Up @@ -192,8 +192,16 @@ export default class App extends Component {
(result) => {
this.toggleLayout(result.layoutMode);
this.state.prefs.layoutMode = result.layoutMode;
if (result.code) {
lastCode = result.code;
let urlCode;
try {
urlCode = JSON.parse(
decodeURIComponent(new URLSearchParams(location.search).get('code'))
);
} catch (err) {
console.error(err);
}
if (urlCode || result.code) {
lastCode = urlCode || result.code;
}
}
);
Expand Down

0 comments on commit 3a4b02e

Please sign in to comment.