mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-27 00:30:09 +02:00
add propert redirections
This commit is contained in:
@@ -179,10 +179,10 @@ export default class ContentWrap extends Component {
|
|||||||
};
|
};
|
||||||
const writeInsideIframe = () => {
|
const writeInsideIframe = () => {
|
||||||
const sandbox = this.frame.getAttribute('sweet');
|
const sandbox = this.frame.getAttribute('sweet');
|
||||||
console.log('setting back sandbox attr', sandbox);
|
// console.log('setting back sandbox attr', sandbox);
|
||||||
this.frame.setAttribute('sandbox', sandbox);
|
this.frame.setAttribute('sandbox', sandbox);
|
||||||
this.frame.removeAttribute('sweet');
|
this.frame.removeAttribute('sweet');
|
||||||
console.log('sending postmessage');
|
// console.log('sending postmessage');
|
||||||
this.frame.contentWindow.postMessage({ contents }, '*');
|
this.frame.contentWindow.postMessage({ contents }, '*');
|
||||||
// this.frame.contentDocument.open();
|
// this.frame.contentDocument.open();
|
||||||
// this.frame.contentDocument.write(contents);
|
// this.frame.contentDocument.write(contents);
|
||||||
@@ -190,7 +190,7 @@ export default class ContentWrap extends Component {
|
|||||||
};
|
};
|
||||||
refreshAndDo(() => {
|
refreshAndDo(() => {
|
||||||
const sandbox = this.frame.getAttribute('sandbox');
|
const sandbox = this.frame.getAttribute('sandbox');
|
||||||
console.log('removing sandbox', sandbox);
|
// console.log('removing sandbox', sandbox);
|
||||||
this.frame.setAttribute('sweet', sandbox);
|
this.frame.setAttribute('sweet', sandbox);
|
||||||
this.frame.removeAttribute('sandbox');
|
this.frame.removeAttribute('sandbox');
|
||||||
refreshAndDo(writeInsideIframe);
|
refreshAndDo(writeInsideIframe);
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { h, Component } from 'preact';
|
import { h, Component } from 'preact';
|
||||||
|
import { route } from 'preact-router';
|
||||||
// import '../service-worker-registration';
|
// import '../service-worker-registration';
|
||||||
import { MainHeader } from './MainHeader.jsx';
|
import { MainHeader } from './MainHeader.jsx';
|
||||||
import ContentWrap from './ContentWrap.jsx';
|
import ContentWrap from './ContentWrap.jsx';
|
||||||
@@ -253,8 +254,16 @@ export default class App extends Component {
|
|||||||
this.refreshEditor();
|
this.refreshEditor();
|
||||||
});
|
});
|
||||||
} else if (this.props.itemId) {
|
} else if (this.props.itemId) {
|
||||||
window.db.fetchItem(this.props.itemId).then(item => {
|
window.db
|
||||||
|
.fetchItem(this.props.itemId)
|
||||||
|
.then(item => {
|
||||||
this.setCurrentItem(item).then(() => this.refreshEditor());
|
this.setCurrentItem(item).then(() => this.refreshEditor());
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
alert('No such creation found!');
|
||||||
|
this.createNewItem();
|
||||||
|
|
||||||
|
// route('/');
|
||||||
});
|
});
|
||||||
} else if (result.preserveLastCode && lastCode) {
|
} else if (result.preserveLastCode && lastCode) {
|
||||||
this.setState({ unsavedEditCount: 0 });
|
this.setState({ unsavedEditCount: 0 });
|
||||||
@@ -430,10 +439,12 @@ export default class App extends Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.setCurrentItem(item).then(() => this.refreshEditor());
|
this.setCurrentItem(item).then(() => this.refreshEditor());
|
||||||
|
route('/create');
|
||||||
alertsService.add('New item created');
|
alertsService.add('New item created');
|
||||||
}
|
}
|
||||||
openItem(item) {
|
openItem(item) {
|
||||||
this.setCurrentItem(item).then(() => this.refreshEditor());
|
this.setCurrentItem(item).then(() => this.refreshEditor());
|
||||||
|
route(`/create/${item.id}`);
|
||||||
alertsService.add('Saved item loaded');
|
alertsService.add('Saved item loaded');
|
||||||
}
|
}
|
||||||
removeItem(item) {
|
removeItem(item) {
|
||||||
|
Reference in New Issue
Block a user