-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Passage widgets default props (#2143)
## Summary: Tidied up some versions and move Passage widget stuff that we'll need to be able to use on the server. - Passage - PassageRef - PassageRefTarget Issue: LEMS-2737 ## Test plan: Nothing should functionally change, just moving code Author: handeyeco Reviewers: handeyeco, jeremywiebe Required Reviewers: Approved By: jeremywiebe Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x) Pull Request URL: #2143
- Loading branch information
Showing
13 changed files
with
100 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@khanacademy/perseus-core": minor | ||
"@khanacademy/perseus": patch | ||
"@khanacademy/perseus-editor": patch | ||
--- | ||
|
||
Move Passage widgets upgrade logic to Perseus Core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/perseus-core/src/widgets/passage-ref-target/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type {PerseusPassageRefTargetWidgetOptions} from "../../data-schema"; | ||
import type {WidgetLogic} from "../logic-export.types"; | ||
|
||
export type PassageRefTargetDefaultWidgetOptions = Pick< | ||
PerseusPassageRefTargetWidgetOptions, | ||
"content" | ||
>; | ||
|
||
const defaultWidgetOptions: PassageRefTargetDefaultWidgetOptions = { | ||
content: "", | ||
}; | ||
|
||
const passageRefTargetWidgetLogic: WidgetLogic = { | ||
name: "passageRefTarget", | ||
defaultWidgetOptions, | ||
}; | ||
|
||
export default passageRefTargetWidgetLogic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {currentVersion, defaultWidgetOptions} from "./passage-ref-upgrade"; | ||
|
||
import type {WidgetLogic} from "../logic-export.types"; | ||
|
||
export type {PassageRefDefaultWidgetOptions} from "./passage-ref-upgrade"; | ||
|
||
const passageRefWidgetLogic: WidgetLogic = { | ||
name: "passageRef", | ||
version: currentVersion, | ||
defaultWidgetOptions: defaultWidgetOptions, | ||
}; | ||
|
||
export default passageRefWidgetLogic; |
14 changes: 14 additions & 0 deletions
14
packages/perseus-core/src/widgets/passage-ref/passage-ref-upgrade.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type {PerseusPassageRefWidgetOptions} from "../../data-schema"; | ||
|
||
export const currentVersion = {major: 0, minor: 1}; | ||
|
||
export type PassageRefDefaultWidgetOptions = Pick< | ||
PerseusPassageRefWidgetOptions, | ||
"passageNumber" | "referenceNumber" | "summaryText" | ||
>; | ||
|
||
export const defaultWidgetOptions: PassageRefDefaultWidgetOptions = { | ||
passageNumber: 1, | ||
referenceNumber: 1, | ||
summaryText: "", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type {PerseusPassageWidgetOptions} from "../../data-schema"; | ||
import type {WidgetLogic} from "../logic-export.types"; | ||
|
||
export type PassageDefaultWidgetOptions = Pick< | ||
PerseusPassageWidgetOptions, | ||
"passageTitle" | "passageText" | "footnotes" | "showLineNumbers" | ||
>; | ||
|
||
const defaultWidgetOptions: PassageDefaultWidgetOptions = { | ||
passageTitle: "", | ||
passageText: "", | ||
footnotes: "", | ||
showLineNumbers: true, | ||
}; | ||
|
||
const passageWidgetLogic: WidgetLogic = { | ||
name: "passage", | ||
defaultWidgetOptions, | ||
}; | ||
|
||
export default passageWidgetLogic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters