@codecademy/codebytes 0.1.1-alpha.19caf8.0 → 0.1.1-alpha.9d702d.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/package.json +2 -2
- package/src/editor.tsx +4 -2
- package/src/index.tsx +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
### [0.1.1-alpha.
|
|
6
|
+
### [0.1.1-alpha.9d702d.0](https://github.com/Codecademy/client-modules/compare/@codecademy/codebytes@0.1.0...@codecademy/codebytes@0.1.1-alpha.9d702d.0) (2021-12-21)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @codecademy/codebytes
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/codebytes",
|
|
3
3
|
"description": "Codebytes Code Editor",
|
|
4
|
-
"version": "0.1.1-alpha.
|
|
4
|
+
"version": "0.1.1-alpha.9d702d.0",
|
|
5
5
|
"author": "Codecademy Engineering <dev@codecademy.com>",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.css",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "61905c84b7898bbfe7dbd2702afed7911d5eaf6b"
|
|
47
47
|
}
|
package/src/editor.tsx
CHANGED
|
@@ -38,7 +38,9 @@ type EditorProps = {
|
|
|
38
38
|
language: languageOption;
|
|
39
39
|
text: string;
|
|
40
40
|
// eslint-disable-next-line react/no-unused-prop-types
|
|
41
|
-
onChange: (
|
|
41
|
+
onChange: (
|
|
42
|
+
text: string
|
|
43
|
+
) => void /* TODO: Add onChange behavior in DISC-353 */;
|
|
42
44
|
onCopy?: (text: string, language: string) => void;
|
|
43
45
|
};
|
|
44
46
|
|
|
@@ -66,7 +68,7 @@ export const Editor: React.FC<EditorProps> = ({
|
|
|
66
68
|
onCopy?.(
|
|
67
69
|
text,
|
|
68
70
|
language
|
|
69
|
-
); /* TODO: pass in onCopyBBCodeblock behavior from
|
|
71
|
+
); /* TODO: pass in onCopyBBCodeblock behavior from the future version we migrate to Next.js */
|
|
70
72
|
setIsCodeByteCopied(true);
|
|
71
73
|
}
|
|
72
74
|
};
|
package/src/index.tsx
CHANGED
|
@@ -11,6 +11,7 @@ export interface CodeByteEditorProps {
|
|
|
11
11
|
text: string;
|
|
12
12
|
language: languageOption;
|
|
13
13
|
hideCopyButton: boolean;
|
|
14
|
+
onCopy?: (text: string, language: string) => void;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
const EditorContainer = styled(Background)(
|
|
@@ -29,6 +30,7 @@ export const CodeByteEditor: React.FC<CodeByteEditorProps> = ({
|
|
|
29
30
|
text: initialText,
|
|
30
31
|
language,
|
|
31
32
|
hideCopyButton,
|
|
33
|
+
onCopy,
|
|
32
34
|
}) => {
|
|
33
35
|
const [text, setText] = useState<string>(initialText);
|
|
34
36
|
return (
|
|
@@ -45,12 +47,13 @@ export const CodeByteEditor: React.FC<CodeByteEditorProps> = ({
|
|
|
45
47
|
/>
|
|
46
48
|
</Box>
|
|
47
49
|
<Editor
|
|
50
|
+
language={language}
|
|
48
51
|
text={text}
|
|
52
|
+
hideCopyButton={hideCopyButton}
|
|
49
53
|
onChange={(newText: string) => {
|
|
50
54
|
setText(newText);
|
|
51
55
|
}}
|
|
52
|
-
|
|
53
|
-
language={language}
|
|
56
|
+
onCopy={onCopy}
|
|
54
57
|
/>
|
|
55
58
|
</EditorContainer>
|
|
56
59
|
</>
|