-
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.
Support visible/aria label for the Expression widget (#1404)
* add inputs for labels to the expression editor * add aria label to mobile input * fix tests * changeset * rough out idea for CSS * flow elements better * add comment to hack * change name of prop and tweak tests * remove findDOMNode from render * consolidate mobile vs desktop logic * add more tests * make labels serializable * ignore errors in story * try again with vertical-align * use WB labels * move styles to aphrodite * add comments * i18n aria label default * add WCAG link to tooltip thing
- Loading branch information
Showing
21 changed files
with
571 additions
and
293 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/math-input": minor | ||
"@khanacademy/perseus": minor | ||
"@khanacademy/perseus-editor": minor | ||
--- | ||
|
||
Add label options for Expression |
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
41 changes: 41 additions & 0 deletions
41
packages/perseus-editor/src/__stories__/article-editor.stories.tsx
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,41 @@ | ||
import {ApiOptions} from "@khanacademy/perseus"; | ||
import * as React from "react"; | ||
import {useRef, useState} from "react"; | ||
|
||
import ArticleEditor from "../article-editor"; | ||
import {registerAllWidgetsAndEditorsForTesting} from "../util/register-all-widgets-and-editors-for-testing"; | ||
|
||
registerAllWidgetsAndEditorsForTesting(); | ||
|
||
export default { | ||
title: "PerseusEditor/ArticleEditor", | ||
}; | ||
|
||
export const Base = (): React.ReactElement => { | ||
const [state, setState] = useState(); | ||
const articleEditorRef = useRef(); | ||
|
||
function handleChange(value) { | ||
setState(value.json); | ||
} | ||
|
||
function serialize() { | ||
// eslint-disable-next-line no-console | ||
console.log((articleEditorRef.current as any).serialize()); | ||
} | ||
|
||
return ( | ||
<> | ||
<button onClick={serialize}>Serialize</button> | ||
<hr /> | ||
<ArticleEditor | ||
apiOptions={ApiOptions.defaults} | ||
imageUploader={() => {}} | ||
json={state} | ||
onChange={handleChange} | ||
previewURL="/perseus/frame" | ||
ref={articleEditorRef as any} | ||
/> | ||
</> | ||
); | ||
}; |
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
Oops, something went wrong.