Skip to content

Commit 346665a

Browse files
committed
Add version parameter to editor links (fixes #1036)
1 parent 328d625 commit 346665a

5 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/components/Footer/index.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { getEntry } from "astro:content";
33
import { getCurrentLocale, getUiTranslator } from "@/src/i18n/utils";
44
import { Icon } from "../Icon";
55
import Banner from "@components/Banner/index.astro";
6+
import { p5Version } from "@/src/globals/p5-version";
67
78
const currentLocale = getCurrentLocale(Astro.url.pathname);
89
const t = await getUiTranslator(currentLocale);
@@ -32,7 +33,7 @@ const bannerEntry = await getEntry("banner", currentLocale);
3233
<li><a href="/contribute/">{t("Contribute")}</a></li>
3334
<li><a href="/community/">{t("Community")}</a></li>
3435
<li><a href="/about/">{t("About")}</a></li>
35-
<li><a href="https://editor.p5js.org">{t("Start Coding")}</a></li>
36+
<li><a href={`https://editor.p5js.org?version=${p5Version}`}>{t("Start Coding")}</a></li>
3637
<li><a href="/donate/">{t("Donate")}</a></li>
3738
</ul>
3839
</div>

src/components/Nav/MainNavLinks.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import styles from "./styles.module.scss";
22
import { Logo } from "../Logo";
33
import { Icon } from "../Icon";
4+
import { p5Version } from "@/src/globals/p5-version";
45

56
type MainNavLinksProps = {
67
links: {
@@ -81,7 +82,7 @@ export const MainNavLinks = ({
8182
</ul>
8283
<ul class="flex flex-col gap-[15px]">
8384
<li>
84-
<a className={styles.buttonlink} href="https://editor.p5js.org">
85+
<a className={styles.buttonlink} href={`https://editor.p5js.org?version=${p5Version}`}>
8586
<div class="mr-xxs">
8687
<Icon kind="code-brackets" />
8788
</div>

src/content/text-detail/en/download.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ import {
99
libraryDownloadUrl,
1010
minifiedLibraryDownloadUrl
1111
} from '@src/globals/globals'
12+
import { p5Version } from '@src/globals/p5-version'
1213

1314
Welcome! This page contains the links to start using p5.js in the way that suits you best. Open the p5.js Editor in your web browser, or download the library to your own computer. We’ve tried to order the links to reflect what a beginner might want first, then what a more experienced programmer may be looking for.
1415

1516
### Start Coding Online
1617
This link redirects you to the p5.js Editor online so you can begin using p5.js immediately.
1718

18-
<LinkButton variant='link' url='https://editor.p5js.org/'> p5.js Editor </LinkButton>
19+
<LinkButton variant='link' url={`https://editor.p5js.org?version=${p5Version}`}> p5.js Editor </LinkButton>
1920

2021
### Download the Complete Library
2122
This is a download containing the p5.js library file, the p5.sound addon, and an example project. It does not contain an editor. Visit [Get Started](/tutorials/get-started) to learn how to setup a p5.js project.

src/content/text-detail/zh-Hans/download.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ import {
99
libraryDownloadUrl,
1010
minifiedLibraryDownloadUrl
1111
} from '@src/globals/globals'
12+
import { p5Version } from '@src/globals/p5-version'
1213

1314
欢迎!本页面包含了开始使用 p5.js 的各种方式的链接。您可以在网络浏览器中打开 p5.js 编辑器,或者将库下载到您的计算机上。我们按照从初学者到进阶开发者的需求顺序来组织这些链接。
1415

1516
### 在线开始编程
1617
此链接将带您前往在线 p5.js 编辑器,您可以立即开始使用 p5.js。
1718

18-
<LinkButton variant='link' url='https://editor.p5js.org/'> p5.js 编辑器 </LinkButton>
19+
<LinkButton variant='link' url={`https://editor.p5js.org?version=${p5Version}`}> p5.js 编辑器 </LinkButton>
1920

2021
### 下载完整库
2122
这个下载包含了 p5.js 库文件、p5.sound 插件和一个示例项目。不包含编辑器。访问[入门指南](/tutorials/get-started)了解如何设置 p5.js 项目。

vitest.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import preact from "@preact/preset-vite";
44

55
export default getViteConfig({
66
// needed to ensure react 3rd party libraries work with preact
7-
plugins: [preact()],
7+
plugins: [preact() as any],
88
resolve: {
99
mainFields: ["module"],
1010
},
11+
// @ts-expect-error - vitest config not recognized by astro's getViteConfig
1112
test: {
1213
projects: [
1314
{

0 commit comments

Comments
 (0)