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

Fix editor asset URLs #962

Merged
merged 7 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Editor losing focus when project changes (#959)
- Fix preview link (#912)
- Web component code attribute (#963)
- Fix substring match on CSS images (#910)
- Error message wrapping (#968)
- Fix scrollbars not showing (#816)
- Width of empty `p5` canvas (#969)
Expand Down
6 changes: 4 additions & 2 deletions src/components/Editor/Runners/HtmlRunner/HtmlRunner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ function HtmlRunner() {
var updatedProjectFile = { ...projectFile };
if (projectFile.extension === "css") {
projectImages.forEach((image) => {
const find = new RegExp(`['"]${image.filename}['"]`, "g"); // prevent substring matches
const replace = `"${image.url}"`;
updatedProjectFile.content = updatedProjectFile.content.replaceAll(
image.filename,
image.url,
find,
replace,
);
});
}
Expand Down