Skip to content

Fix: Abnormal strings appear when comments are saved after editing #29991

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

Merged
merged 3 commits into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web_src/js/features/repo-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ async function onEditContent(event) {
const $content = $segment;
if (!$content.find('.dropzone-attachments').length) {
if (data.attachments !== '') {
$content[0].append(data.attachments);
$content[0].insertAdjacentHTML('beforeend', data.attachments);
Copy link
Member

@silverwind silverwind Mar 22, 2024

Choose a reason for hiding this comment

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

Previous code had a .dropzone-attachments class, it it no longer needed to be created, @yardenshoham?

Copy link
Member

@yardenshoham yardenshoham Mar 22, 2024

Choose a reason for hiding this comment

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

It's immediately replaced...

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see the previous code created and appended it, but then immediately replaced it with the HTML string, so likely it's okay.

}
} else if (data.attachments === '') {
$content.find('.dropzone-attachments').remove();
Expand Down