Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into am/lems-2306/phet-widget-sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
aemandine committed Sep 4, 2024
2 parents c41f5dc + 377b7ce commit 3ad05bf
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/thirty-pans-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": minor
"@khanacademy/perseus-editor": minor
---

Add save warnings to PhET widget editor and un-hide widget from content editor widget dropdown
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable @khanacademy/ts-no-error-suppressions */
import {makeSafeUrl} from "@khanacademy/perseus";
import {LabeledTextField} from "@khanacademy/wonder-blocks-form";
import * as React from "react";

Expand Down Expand Up @@ -31,6 +32,13 @@ class PhetSimulationEditor extends React.Component<Props> {
};
}

getSaveWarnings: () => ReadonlyArray<string> = () => {
if (makeSafeUrl(this.props.url, "en") === null) {
return ["Please enter a URL from the PhET domain."];
}
return [];
};

render(): React.ReactNode {
return (
<div>
Expand Down
2 changes: 2 additions & 0 deletions packages/perseus/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ export {
getAngleCoords,
} from "./widgets/interactive-graphs/reducer/initialize-graph-state";

export {makeSafeUrl} from "./widgets/phet-simulation";

/**
* Mixins
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/perseus/src/widgets/phet-simulation/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {default} from "./phet-simulation";
export {default, makeSafeUrl} from "./phet-simulation";
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,5 @@ export default {
name: "phet-simulation",
displayName: "PhET Simulation",
widget: PhetSimulation,
// Hides widget from content creators until full release
hidden: true,
isLintable: true,
} as WidgetExports<typeof PhetSimulation>;

0 comments on commit 3ad05bf

Please sign in to comment.