Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add image in markdown format #183

Merged
merged 7 commits into from
Nov 27, 2024

Conversation

keraliss
Copy link

No description provided.

Copy link

vercel bot commented Nov 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nostr-forms-formstr-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2024 6:27am


const newImages = [...uploadedImages, { name, url }];
setUploadedImages(newImages);
localStorage.setItem(`uploadedImages_${questionIdInFocus}`, JSON.stringify(newImages));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to set this in localStorage?

@@ -25,6 +27,17 @@ function AnswerSettings() {
option.answerSettings.renderElement === answerSettings.renderElement
);

const [uploadedImages, setUploadedImages] = useState<Array<{name: string, url: string}>>(() => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this state when we are already using the editQuestion context?

@@ -138,7 +138,7 @@ const UploadImage: React.FC<Props> = ({ onImageUpload }) => {
shape="circle"
style={{ fontSize: '16px', marginRight: '10px' }}
>
📁
<FolderOutlined />
Copy link
Owner

@abhay-raizada abhay-raizada Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have this to <PictureOutlined /> ?

formData.append("image", file);

const response = await fetch(
"https://api.imgbb.com/1/upload?key=47b2691c6dca3f52bf6f70029396682d",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this to a dummy

question[4],
JSON.stringify({
...answerSettings,
imageUrl: imageMarkdown,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need this anymore? since we're already adding the image markdown in newDisplay on question[3] ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we don't need this!

? `${currentDisplay}\n\n${imageMarkdown}`
: imageMarkdown;

const field: Field = [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could also have done
field = question and field[3] = newDisplay but it's fine for now

@abhay-raizada abhay-raizada merged commit 39aac6d into abhay-raizada:dev Nov 27, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants