-
Notifications
You must be signed in to change notification settings - Fork 14
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
add image in markdown format #183
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
||
const newImages = [...uploadedImages, { name, url }]; | ||
setUploadedImages(newImages); | ||
localStorage.setItem(`uploadedImages_${questionIdInFocus}`, JSON.stringify(newImages)); |
There was a problem hiding this comment.
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}>>(() => { |
There was a problem hiding this comment.
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?
545c248
to
dcdfb60
Compare
@@ -138,7 +138,7 @@ const UploadImage: React.FC<Props> = ({ onImageUpload }) => { | |||
shape="circle" | |||
style={{ fontSize: '16px', marginRight: '10px' }} | |||
> | |||
📁 | |||
<FolderOutlined /> |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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]
?
There was a problem hiding this comment.
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 = [ |
There was a problem hiding this comment.
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
No description provided.