Skip to content

Commit

Permalink
Merge pull request #81 from NEARBuilders/cleanup-after-compose
Browse files Browse the repository at this point in the history
Cleanup after post
  • Loading branch information
elliotBraem authored Jan 24, 2024
2 parents 94b818e + af96b8e commit ce19c9f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion apps/builddao/widget/Compose.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ const postToCustomFeed = ({ feed, text, labels }) => {
return Social.set(data, {
force: true,
onCommit: () => {
// console.log(`Commited ${feed}: #${postId}`);
setPostContent("");
Storage.privateSet(draftKey, props.template || "");
setHandler("autocompleteSelected"); // this is a hack to force the iframe to update
},
onCancel: () => {
// console.log(`Cancelled ${feed}: #${postId}`);
Expand Down Expand Up @@ -572,6 +574,7 @@ return (
)}
</Button>
<Button
disabled={postContent === "" || postContent === props.template}
variant="primary"
style={{ fontSize: 14 }}
onClick={() =>
Expand Down
8 changes: 8 additions & 0 deletions apps/builddao/widget/Feed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const feeds = {
label: "Task",
icon: "bi-check-lg",
name: "task",
hashtag: "task",
template: `## TASK TITLE
(posted via [Build DAO Gateway](https://nearbuilders.org/feed?hashtag=task))
Expand All @@ -148,6 +149,13 @@ const feeds = {
- [Provide any context or details]
`,
},
test: {
label: "Test",
icon: "bi-tools",
name: "test",
hashtag: "test",
template: ``,
},
bookmarks: {
label: "Bookmarks",
icon: "bi-bookmark",
Expand Down
2 changes: 1 addition & 1 deletion apps/builddao/widget/components/MarkdownEditorIframe.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ window.addEventListener("message", (event) => {
if (editorInstance) {
editorInstance.updateEditorState(event.data.content);
}
}
}
}
});
Expand Down

0 comments on commit ce19c9f

Please sign in to comment.