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

[DRAFT] New Perseus Preview component #1304

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b6318da
IframeContentRenderer: move to 'preview' subfolder
jeremywiebe Aug 12, 2024
08f346c
Add vite aliases for `strings` exports
jeremywiebe Aug 12, 2024
e662bdc
ContentRenderer: Initial basic content preview (no iframe)
jeremywiebe May 18, 2024
0193db8
DeviceFramer: Tweak comment
jeremywiebe May 22, 2024
1263fbc
ContentRenderer: Get linting working somewhat
jeremywiebe May 24, 2024
2c9f10b
Lint: Use phosphor icon
jeremywiebe May 24, 2024
39231e5
ContentRenderer: Fix keypad connection for 'mobile' in previews
jeremywiebe Jul 26, 2024
2ef1dee
ContentRenderer: Implement nochrome
jeremywiebe Jul 26, 2024
1acd8e1
ContentRenderer: add linter props
jeremywiebe Jul 30, 2024
4a76f5e
ContentRenderer: Fix import of mock strings
jeremywiebe Jul 30, 2024
79b19d3
ContentRenderer: set framework-perseus and, if relevant, perseus-mobi…
jeremywiebe Aug 1, 2024
4ee30b8
ContentRenderer: add story to demo the new preview system
jeremywiebe Aug 7, 2024
5d191b0
ContentRenderer: move article sample data to .testdata.ts file
jeremywiebe Aug 7, 2024
642f930
ContentRenderer: add story showing lint support
jeremywiebe Aug 7, 2024
53d0e40
ContentRenderer: Extend linting story
jeremywiebe Aug 8, 2024
8b46b8b
Lint: revert updates for now
jeremywiebe Aug 8, 2024
f9ae119
ItemEditor: Remove imperative API for preview updates
jeremywiebe Jul 17, 2024
ad99a25
ItemEditor: provide linter context to new ContentRenderer (preview)
jeremywiebe Jul 30, 2024
ee27578
Remove Storybook-specific preview for EditorPage - real preview now w…
jeremywiebe Aug 7, 2024
84b23db
HintEditor: migrate to iframe-less preview (ContentRenderer)
jeremywiebe Jul 30, 2024
2823360
HintEditor: propogate preview device type to ContentRenderer
jeremywiebe Aug 6, 2024
67b9ee4
ArticleEditor: migrate to new preview (ContentRenderer)
jeremywiebe Jul 30, 2024
c5b3986
ArticleEditor: restore section border to preview
jeremywiebe Aug 1, 2024
4e52482
ArticleEditor: handle rendering one or all sections
jeremywiebe Aug 1, 2024
9e6c8d6
ArticleEditor: build onChange handler safely (bind this as we pass a …
jeremywiebe Aug 1, 2024
dc9fff2
ArticleEditor: add example article to article editor story
jeremywiebe Aug 1, 2024
f8b21ef
ArticleEditor: fix more types related to refs
jeremywiebe Aug 6, 2024
e891cca
Remove part of a dependencies error message that makes no sense anymore
jeremywiebe Jul 30, 2024
090b701
Spike on iframe dynamic rendering - failure as styles are very hard t…
jeremywiebe Jul 31, 2024
2229388
ArticleEditor: remove 'replace' prop passed to Editor - articles aren…
jeremywiebe Aug 9, 2024
f5f19db
PerseusEditor: clarify types around serialize() and getSaveWarnings()
jeremywiebe Aug 9, 2024
e260df8
Fonts: fix path to Lato-Regular.woff2 in Storybook
jeremywiebe Aug 9, 2024
64826e7
Lint: modernize stories
jeremywiebe Aug 9, 2024
011f727
Lint: Use <span> for lint content as <div> is not supported
jeremywiebe Aug 12, 2024
9e87fc8
Lint: Hide children prop in stories - it's not useful
jeremywiebe Aug 12, 2024
3cdd246
Lint: Provide 'severity' dropdown in storybook
jeremywiebe Aug 12, 2024
05fc776
InteractiveGraphEditor: fix readonly typedness in story
jeremywiebe Aug 12, 2024
b2ea199
ViewportResizer: Use Phosphor icons
jeremywiebe Aug 12, 2024
e8acd31
EditorPage: tiny WB improvements for JSON mode and viewport resizer a…
jeremywiebe Aug 12, 2024
dbd968e
GroupEditor: Handle ref being null - should not happen so using invar…
jeremywiebe Aug 12, 2024
a80c35b
EditorPage: Preview only desktop, but note phone and tablet checking …
jeremywiebe Aug 13, 2024
9920bc7
ArticleEditor: remove passing 'screen' to editor
jeremywiebe Aug 13, 2024
760fdcb
EditorPage: Add note about preview being desktop-only now
jeremywiebe Aug 13, 2024
05b5521
EditorPage: Don't change ApiOptions based on previewDevice
jeremywiebe Aug 13, 2024
143f88c
Changeset
jeremywiebe Aug 13, 2024
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
Prev Previous commit
Next Next commit
ContentRenderer: add linter props
  • Loading branch information
jeremywiebe committed Aug 12, 2024
commit 1acd8e1cdb35d09d6f408e1cf4a217b9383bf6e2
18 changes: 10 additions & 8 deletions packages/perseus-editor/src/preview/content-renderer.tsx
Original file line number Diff line number Diff line change
@@ -12,15 +12,20 @@ import {StyleSheet} from "aphrodite";
import * as React from "react";

import type {APIOptions, PerseusRenderer} from "@khanacademy/perseus";
import type {LinterContextProps} from "@khanacademy/perseus-linter";

function ComponentRenderer({
function ContentRenderer({
question,
apiOptions,
seamless,
linterContext,
legacyPerseusLint,
}: {
question?: PerseusRenderer;
apiOptions?: APIOptions;
seamless?: boolean;
linterContext?: LinterContextProps;
legacyPerseusLint?: ReadonlyArray<string>;
}) {
return (
<View style={[styles.container, !seamless ? styles.gutter : undefined]}>
@@ -32,12 +37,8 @@ function ComponentRenderer({
strings={mockStrings}
apiOptions={apiOptions}
keypadElement={keypadElement}
linterContext={{
contentType: "exercise",
highlightLint: true,
paths: [],
stack: [],
}}
linterContext={linterContext}
legacyPerseusLint={legacyPerseusLint}
{...question}
/>

@@ -58,4 +59,5 @@ const styles = StyleSheet.create({
container: {padding: spacing.xxxSmall_4},
gutter: {marginRight: constants.lintGutterWidth},
});
export default ComponentRenderer;

export default ContentRenderer;