Merge pull request #3042 from urbit/mp/publish/restore-edits

publish: edit post content no longer tied to api
This commit is contained in:
ixv 2020-06-23 17:51:17 -07:00 committed by GitHub
commit 3d27c63a21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 9 deletions

View File

@ -84,7 +84,7 @@ export class S3Upload extends Component {
accept="image/*"
onChange={this.onChange.bind(this)} />
<img className="invert-d"
src="/~groups/img/ImageUpload.png"
src="/~landscape/img/ImageUpload.png"
width="32"
height="32"
onClick={this.onClick.bind(this)} />

View File

@ -25,17 +25,19 @@ export class EditPost extends Component {
componentDidUpdate(prevProps) {
const { props, state } = this;
const contents = props.notebooks[props.ship]?.[props.book]?.notes?.[props.note]?.file;
if (prevProps && prevProps.api !== props.api) {
if (!(props.notebooks[props.ship]?.[props.book]?.notes?.[props.note]?.file)) {
if (!contents) {
props.api?.fetchNote(props.ship, props.book, props.note);
} else if (state.body === '') {
const notebook = props.notebooks[props.ship][props.book];
const note = notebook.notes[props.note];
const file = note.file;
const body = file.slice(file.indexOf(';>') + 3);
this.setState({ body: body });
}
}
if (contents && state.body === '') {
const notebook = props.notebooks[props.ship][props.book];
const note = notebook.notes[props.note];
const file = note.file;
const body = file.slice(file.indexOf(';>') + 3);
this.setState({ body: body });
}
}
postSubmit() {
@ -95,7 +97,7 @@ export class EditPost extends Component {
};
return (
<div className="f9 h-100 relative">
<div className="f9 h-100 relative publish">
<div className="w-100 tl pv4 flex justify-center">
<SidebarSwitcher
sidebarShown={props.sidebarShown}