docusaurus-live-brython 3.0.0-beta.21 → 3.0.0-beta.23
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/.prettierignore +17 -0
- package/.prettierrc +9 -8
- package/README.md +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +17 -14
- package/lib/options.d.ts.map +1 -1
- package/lib/options.js +2 -2
- package/lib/theme/CodeBlock/index.d.ts +1 -1
- package/lib/theme/CodeBlock/index.d.ts.map +1 -1
- package/lib/theme/CodeBlock/index.jsx +13 -5
- package/lib/theme/CodeEditor/Actions/DownloadCode.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Actions/DownloadCode.jsx +2 -2
- package/lib/theme/CodeEditor/Actions/Reset.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Actions/Reset.jsx +1 -1
- package/lib/theme/CodeEditor/Actions/RunCode.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Actions/ShowRaw.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Actions/ShowRaw.jsx +8 -2
- package/lib/theme/CodeEditor/Actions/ShowSyncStatus.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Actions/ShowSyncStatus.jsx +4 -4
- package/lib/theme/CodeEditor/Actions/styles.module.css +2 -3
- package/lib/theme/CodeEditor/BrythonCommunicator.d.ts +1 -1
- package/lib/theme/CodeEditor/BrythonCommunicator.d.ts.map +1 -1
- package/lib/theme/CodeEditor/BrythonCommunicator.jsx +10 -6
- package/lib/theme/CodeEditor/Button/index.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Button/styles.module.css +1 -1
- package/lib/theme/CodeEditor/CodeHistory/index.d.ts.map +1 -1
- package/lib/theme/CodeEditor/CodeHistory/index.jsx +20 -9
- package/lib/theme/CodeEditor/CodeHistory/styles.module.css +31 -31
- package/lib/theme/CodeEditor/ContextEditor/index.d.ts.map +1 -1
- package/lib/theme/CodeEditor/ContextEditor/index.jsx +1 -1
- package/lib/theme/CodeEditor/Editor/EditorAce.jsx +4 -4
- package/lib/theme/CodeEditor/Editor/Header/index.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Editor/Header/index.jsx +3 -3
- package/lib/theme/CodeEditor/Editor/Header/styles.module.css +7 -7
- package/lib/theme/CodeEditor/Editor/HiddenCode/index.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Editor/HiddenCode/index.jsx +5 -2
- package/lib/theme/CodeEditor/Editor/HiddenCode/styles.module.css +4 -8
- package/lib/theme/CodeEditor/Editor/Result/Graphics/Canvas.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Editor/Result/Graphics/Canvas.jsx +2 -2
- package/lib/theme/CodeEditor/Editor/Result/Graphics/Turtle.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Editor/Result/Graphics/Turtle.jsx +3 -3
- package/lib/theme/CodeEditor/Editor/Result/Graphics/index.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Editor/Result/Graphics/index.jsx +1 -1
- package/lib/theme/CodeEditor/Editor/Result/Graphics/styles.module.css +2 -2
- package/lib/theme/CodeEditor/Editor/Result/index.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Editor/Result/index.jsx +1 -3
- package/lib/theme/CodeEditor/Editor/Result/styles.module.css +10 -10
- package/lib/theme/CodeEditor/Editor/index.d.ts +1 -1
- package/lib/theme/CodeEditor/Editor/index.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Editor/index.jsx +25 -26
- package/lib/theme/CodeEditor/Editor/styles.module.css +11 -11
- package/lib/theme/CodeEditor/Editor/utils/checkForButtonClick.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Editor/utils/saveSvg.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Editor/utils/saveSvg.js +19 -8
- package/lib/theme/CodeEditor/Editor/utils/svgWithoutAnimations.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Editor/utils/svgWithoutAnimations.js +43 -49
- package/lib/theme/CodeEditor/Icon/icons.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Icon/index.d.ts.map +1 -1
- package/lib/theme/CodeEditor/Icon/index.jsx +9 -2
- package/lib/theme/CodeEditor/Icon/styles.module.css +1 -1
- package/lib/theme/CodeEditor/WithScript/ScriptContext.d.ts +2 -2
- package/lib/theme/CodeEditor/WithScript/ScriptContext.d.ts.map +1 -1
- package/lib/theme/CodeEditor/WithScript/ScriptContext.jsx +5 -7
- package/lib/theme/CodeEditor/WithScript/Storage.d.ts +1 -1
- package/lib/theme/CodeEditor/WithScript/Storage.d.ts.map +1 -1
- package/lib/theme/CodeEditor/WithScript/Types.d.ts +1 -1
- package/lib/theme/CodeEditor/WithScript/Types.d.ts.map +1 -1
- package/lib/theme/CodeEditor/WithScript/bryRunner.d.ts +1 -1
- package/lib/theme/CodeEditor/WithScript/bryRunner.d.ts.map +1 -1
- package/lib/theme/CodeEditor/WithScript/bryRunner.js +6 -3
- package/lib/theme/CodeEditor/WithScript/createStore.d.ts +1 -1
- package/lib/theme/CodeEditor/WithScript/createStore.d.ts.map +1 -1
- package/lib/theme/CodeEditor/WithScript/createStore.js +36 -11
- package/lib/theme/CodeEditor/WithScript/helpers.d.ts.map +1 -1
- package/lib/theme/CodeEditor/WithScript/helpers.js +4 -1
- package/lib/theme/CodeEditor/constants.d.ts.map +1 -1
- package/lib/theme/CodeEditor/hooks/index.d.ts.map +1 -1
- package/lib/theme/CodeEditor/hooks/useScript.d.ts +1 -1
- package/lib/theme/CodeEditor/hooks/useScript.d.ts.map +1 -1
- package/lib/theme/CodeEditor/hooks/useScript.js +1 -1
- package/lib/theme/CodeEditor/hooks/useStore.d.ts +1 -1
- package/lib/theme/CodeEditor/hooks/useStore.d.ts.map +1 -1
- package/lib/theme/CodeEditor/hooks/useStore.js +3 -3
- package/lib/theme/CodeEditor/index.d.ts.map +1 -1
- package/lib/theme/CodeEditor/index.jsx +6 -6
- package/lib/theme/CodeEditor/styles.module.css +28 -30
- package/package.json +5 -3
- package/src/index.ts +40 -38
- package/src/options.ts +12 -12
- package/src/theme/CodeBlock/index.tsx +32 -28
- package/src/theme/CodeEditor/Actions/DownloadCode.tsx +17 -16
- package/src/theme/CodeEditor/Actions/Reset.tsx +10 -8
- package/src/theme/CodeEditor/Actions/RunCode.tsx +9 -6
- package/src/theme/CodeEditor/Actions/ShowRaw.tsx +12 -6
- package/src/theme/CodeEditor/Actions/ShowSyncStatus.tsx +8 -16
- package/src/theme/CodeEditor/Actions/styles.module.css +2 -3
- package/src/theme/CodeEditor/BrythonCommunicator.tsx +12 -15
- package/src/theme/CodeEditor/Button/index.tsx +14 -10
- package/src/theme/CodeEditor/Button/styles.module.css +1 -1
- package/src/theme/CodeEditor/CodeHistory/index.tsx +25 -13
- package/src/theme/CodeEditor/CodeHistory/styles.module.css +31 -31
- package/src/theme/CodeEditor/ContextEditor/index.tsx +6 -8
- package/src/theme/CodeEditor/Editor/EditorAce.tsx +6 -6
- package/src/theme/CodeEditor/Editor/Header/index.tsx +3 -9
- package/src/theme/CodeEditor/Editor/Header/styles.module.css +7 -7
- package/src/theme/CodeEditor/Editor/HiddenCode/index.tsx +14 -4
- package/src/theme/CodeEditor/Editor/HiddenCode/styles.module.css +4 -8
- package/src/theme/CodeEditor/Editor/Result/Graphics/Canvas.tsx +19 -15
- package/src/theme/CodeEditor/Editor/Result/Graphics/Turtle.tsx +15 -11
- package/src/theme/CodeEditor/Editor/Result/Graphics/index.tsx +4 -11
- package/src/theme/CodeEditor/Editor/Result/Graphics/styles.module.css +2 -2
- package/src/theme/CodeEditor/Editor/Result/index.tsx +2 -4
- package/src/theme/CodeEditor/Editor/Result/styles.module.css +10 -10
- package/src/theme/CodeEditor/Editor/index.tsx +61 -69
- package/src/theme/CodeEditor/Editor/styles.module.css +11 -11
- package/src/theme/CodeEditor/Editor/utils/checkForButtonClick.ts +5 -5
- package/src/theme/CodeEditor/Editor/utils/saveSvg.ts +63 -53
- package/src/theme/CodeEditor/Editor/utils/svgWithoutAnimations.ts +182 -201
- package/src/theme/CodeEditor/Icon/icons.ts +23 -13
- package/src/theme/CodeEditor/Icon/index.tsx +28 -9
- package/src/theme/CodeEditor/Icon/styles.module.css +1 -1
- package/src/theme/CodeEditor/WithScript/ScriptContext.tsx +13 -14
- package/src/theme/CodeEditor/WithScript/Storage.ts +3 -3
- package/src/theme/CodeEditor/WithScript/Types.ts +7 -8
- package/src/theme/CodeEditor/WithScript/bryRunner.ts +13 -13
- package/src/theme/CodeEditor/WithScript/createStore.ts +102 -69
- package/src/theme/CodeEditor/WithScript/helpers.ts +16 -12
- package/src/theme/CodeEditor/constants.ts +9 -11
- package/src/theme/CodeEditor/hooks/index.ts +2 -2
- package/src/theme/CodeEditor/hooks/useScript.ts +3 -3
- package/src/theme/CodeEditor/hooks/useStore.ts +9 -9
- package/src/theme/CodeEditor/index.tsx +16 -21
- package/src/theme/CodeEditor/styles.module.css +28 -30
package/.prettierignore
ADDED
package/.prettierrc
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
"arrowParens": "always",
|
|
3
|
+
"bracketSpacing": true,
|
|
4
|
+
"bracketSameLine": false,
|
|
5
|
+
"printWidth": 110,
|
|
6
|
+
"proseWrap": "never",
|
|
7
|
+
"singleQuote": true,
|
|
8
|
+
"trailingComma": "none",
|
|
9
|
+
"tabWidth": 4
|
|
10
|
+
}
|
package/README.md
CHANGED
|
@@ -41,8 +41,8 @@ module.exports = {
|
|
|
41
41
|
+ themes: [
|
|
42
42
|
+ ['docusaurus-live-brython'],
|
|
43
43
|
+ {
|
|
44
|
-
+
|
|
45
|
-
+
|
|
44
|
+
+ brythonSrc: 'https://cdn.jsdelivr.net/npm/brython@3.12.4/brython.min.js', // default
|
|
45
|
+
+ brythonStdlibSrc: 'https://cdn.jsdelivr.net/npm/brython@3.12.4/brython_stdlib.js' // default
|
|
46
46
|
+ }
|
|
47
47
|
presets: ['@docusaurus/preset-classic']
|
|
48
48
|
...
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMvE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,OAAO,EAAmB,MAAM,WAAW,CAAC;AAG7E,eAAO,MAAM,IAAI,2BAAqC,CAAC;AACvD,eAAO,MAAM,eAAe,YAAsB,CAAC;AAiBnD,QAAA,MAAM,KAAK,EAAE,MAAM,CAAC;IAAE,cAAc,EAAE,QAAQ,EAAE,CAAA;CAAE,CAkIjD,CAAC;AAEF,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -36,7 +36,7 @@ const extractImports = (script) => {
|
|
|
36
36
|
return imports;
|
|
37
37
|
};
|
|
38
38
|
const theme = (context, options) => {
|
|
39
|
-
const { i18n: { currentLocale }
|
|
39
|
+
const { i18n: { currentLocale } } = context;
|
|
40
40
|
const libDir = options.libDir || DEFAULT_LIB_DIR;
|
|
41
41
|
const isRemote = /https?:\/\//.test(libDir);
|
|
42
42
|
const isHashRouter = context.siteConfig.future?.experimental_router === 'hash';
|
|
@@ -72,12 +72,15 @@ const theme = (context, options) => {
|
|
|
72
72
|
for (const libName of libNames) {
|
|
73
73
|
const libContent = libraries[libName];
|
|
74
74
|
const imports = extractImports(libContent);
|
|
75
|
-
const injectAt = Math.max(...bryModules.map((lib, idx) => imports.includes(lib.name) ? idx : -1), -1);
|
|
75
|
+
const injectAt = Math.max(...bryModules.map((lib, idx) => (imports.includes(lib.name) ? idx : -1)), -1);
|
|
76
76
|
if (injectAt < 0) {
|
|
77
77
|
bryModules.splice(0, 0, { name: libName, content: libContent });
|
|
78
78
|
}
|
|
79
79
|
else if (injectAt + 1 < bryModules.length) {
|
|
80
|
-
bryModules.splice(injectAt + 1, 0, {
|
|
80
|
+
bryModules.splice(injectAt + 1, 0, {
|
|
81
|
+
name: libName,
|
|
82
|
+
content: libContent
|
|
83
|
+
});
|
|
81
84
|
}
|
|
82
85
|
else {
|
|
83
86
|
bryModules.push({ name: libName, content: libContent });
|
|
@@ -92,7 +95,7 @@ const theme = (context, options) => {
|
|
|
92
95
|
getDefaultCodeTranslationMessages() {
|
|
93
96
|
return readDefaultCodeTranslationMessages({
|
|
94
97
|
locale: currentLocale,
|
|
95
|
-
name: NAME
|
|
98
|
+
name: NAME
|
|
96
99
|
});
|
|
97
100
|
},
|
|
98
101
|
async contentLoaded({ content, actions }) {
|
|
@@ -110,9 +113,9 @@ const theme = (context, options) => {
|
|
|
110
113
|
{
|
|
111
114
|
test: /\.raw\.*/,
|
|
112
115
|
type: 'asset/source'
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
116
119
|
};
|
|
117
120
|
},
|
|
118
121
|
getThemePath() {
|
|
@@ -128,20 +131,20 @@ const theme = (context, options) => {
|
|
|
128
131
|
tagName: 'script',
|
|
129
132
|
attributes: {
|
|
130
133
|
src: options.brythonSrc || DEFAULT_OPTIONS.brythonSrc,
|
|
131
|
-
crossorigin:
|
|
132
|
-
referrerpolicy:
|
|
134
|
+
crossorigin: 'anonymous',
|
|
135
|
+
referrerpolicy: 'no-referrer',
|
|
133
136
|
defer: 'defer'
|
|
134
|
-
}
|
|
137
|
+
}
|
|
135
138
|
},
|
|
136
139
|
{
|
|
137
140
|
tagName: 'script',
|
|
138
141
|
attributes: {
|
|
139
142
|
src: options.brythonStdlibSrc || DEFAULT_OPTIONS.brythonStdlibSrc,
|
|
140
|
-
crossorigin:
|
|
141
|
-
referrerpolicy:
|
|
143
|
+
crossorigin: 'anonymous',
|
|
144
|
+
referrerpolicy: 'no-referrer',
|
|
142
145
|
defer: 'defer'
|
|
143
|
-
}
|
|
144
|
-
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
145
148
|
],
|
|
146
149
|
postBodyTags: content.bryModules.map((module) => {
|
|
147
150
|
return {
|
package/lib/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG;IACvB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE5C,eAAO,MAAM,eAAe,EAAE,YAM7B,CAAC;AAUF,wBAAgB,mBAAmB,CAAC,EAChC,WAAW,EACX,QAAQ,EACX,EAAE,4BAA4B,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG,YAAY,CAGpE"}
|
package/lib/options.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { Joi } from '@docusaurus/utils-validation';
|
|
8
8
|
export const DEFAULT_OPTIONS = {
|
|
9
|
-
brythonSrc: 'https://
|
|
10
|
-
brythonStdlibSrc: 'https://
|
|
9
|
+
brythonSrc: 'https://cdn.jsdelivr.net/npm/brython@3.12.4/brython.min.js',
|
|
10
|
+
brythonStdlibSrc: 'https://cdn.jsdelivr.net/npm/brython@3.12.4/brython_stdlib.js',
|
|
11
11
|
libDir: '/bry-libs/',
|
|
12
12
|
skipCopyAssetsToLibDir: false,
|
|
13
13
|
syncMaxOnceEvery: 1000
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
/// <reference types="@docusaurus/module-type-aliases" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
3
|
import { type Props as CodeBlockType } from '@theme-init/CodeBlock';
|
|
4
4
|
import type { WrapperProps } from '@docusaurus/types';
|
|
5
5
|
type Props = WrapperProps<typeof CodeBlockType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/CodeBlock/index.tsx"],"names":[],"mappings":";;AACA,OAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/CodeBlock/index.tsx"],"names":[],"mappings":";;AACA,OAAkB,EAAE,KAAK,KAAK,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOtD,KAAK,KAAK,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC;AAsChD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAsBlE"}
|
|
@@ -6,7 +6,12 @@ const sanitizedTitle = (id) => {
|
|
|
6
6
|
if (!id) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
-
return id
|
|
9
|
+
return id
|
|
10
|
+
.replace(/--/g, '<<HYPHEN>>')
|
|
11
|
+
.replace(/__/g, '<<UNDERSCORE>>')
|
|
12
|
+
.replace(/[-_]/g, ' ')
|
|
13
|
+
.replace(/<<UNDERSCORE>>/g, '_')
|
|
14
|
+
.replace(/<<HYPHEN>>/g, '-');
|
|
10
15
|
};
|
|
11
16
|
const extractMetaProps = (props) => {
|
|
12
17
|
const metaString = (props?.metastring || '').replace(/\s*=\s*/g, '='); // remove spaces around =
|
|
@@ -16,9 +21,12 @@ const extractMetaProps = (props) => {
|
|
|
16
21
|
return acc;
|
|
17
22
|
}
|
|
18
23
|
/** casts to booleans and numbers. When no value was provided, true is used */
|
|
19
|
-
const val = value === 'true'
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
const val = value === 'true'
|
|
25
|
+
? true
|
|
26
|
+
: value === 'false'
|
|
27
|
+
? false
|
|
28
|
+
: !Number.isNaN(Number(value))
|
|
29
|
+
? Number(value)
|
|
22
30
|
: value || true;
|
|
23
31
|
acc[key] = val;
|
|
24
32
|
return acc;
|
|
@@ -42,5 +50,5 @@ export default function CodeBlockWrapper(props) {
|
|
|
42
50
|
{props.children}
|
|
43
51
|
</ContextEditor>);
|
|
44
52
|
}
|
|
45
|
-
return
|
|
53
|
+
return <CodeBlock {...props}/>;
|
|
46
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DownloadCode.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/DownloadCode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DownloadCode.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/DownloadCode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,YAAY,UAAW;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,sBA+B7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -7,8 +7,8 @@ const DownloadCode = (props) => {
|
|
|
7
7
|
const code = useScript(store, 'code');
|
|
8
8
|
const lang = useScript(store, 'lang');
|
|
9
9
|
const id = useScript(store, 'id');
|
|
10
|
-
return (<Button icon=
|
|
11
|
-
const downloadLink = document.createElement(
|
|
10
|
+
return (<Button icon="Download" onClick={() => {
|
|
11
|
+
const downloadLink = document.createElement('a');
|
|
12
12
|
const file = new Blob([code], { type: 'text/plain;charset=utf-8' });
|
|
13
13
|
downloadLink.href = URL.createObjectURL(file);
|
|
14
14
|
const fExt = lang === 'python' ? '.py' : `.${lang}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Reset.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/Reset.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"Reset.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/Reset.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,KAAK,yBAyBV,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -16,7 +16,7 @@ const Reset = () => {
|
|
|
16
16
|
return (<Button onClick={onReset} title={translate({
|
|
17
17
|
message: 'Discard Changes',
|
|
18
18
|
description: 'Reset the code to its original state',
|
|
19
|
-
id: 'theme.CodeEditor.Header.reset'
|
|
19
|
+
id: 'theme.CodeEditor.Header.reset'
|
|
20
20
|
})} icon="Reset"/>);
|
|
21
21
|
};
|
|
22
22
|
export default Reset;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RunCode.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/RunCode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,KAAK;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,OAAO,UAAW,KAAK,
|
|
1
|
+
{"version":3,"file":"RunCode.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/RunCode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,KAAK;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,OAAO,UAAW,KAAK,sBAsB5B,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShowRaw.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/ShowRaw.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"ShowRaw.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/ShowRaw.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,OAAO,yBAsBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -6,7 +6,13 @@ const ShowRaw = () => {
|
|
|
6
6
|
const store = useStore();
|
|
7
7
|
const showRaw = useScript(store, 'showRaw');
|
|
8
8
|
return (<Button icon={showRaw ? 'EditCode' : 'Code'} onClick={() => store.setShowRaw(!showRaw)} color={showRaw ? Color.Primary : Color.Secondary} title={showRaw
|
|
9
|
-
? translate({
|
|
10
|
-
|
|
9
|
+
? translate({
|
|
10
|
+
message: 'Show edited Code',
|
|
11
|
+
id: 'theme.CodeEditor.Actions.ShowCode.showEdited'
|
|
12
|
+
})
|
|
13
|
+
: translate({
|
|
14
|
+
message: 'Show initial code',
|
|
15
|
+
id: 'theme.CodeEditor.Actions.ShowCode.showRaw'
|
|
16
|
+
})}/>);
|
|
11
17
|
};
|
|
12
18
|
export default ShowRaw;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShowSyncStatus.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/ShowSyncStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"ShowSyncStatus.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Actions/ShowSyncStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,cAAc,yBAyBnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -15,12 +15,12 @@ const ShowSyncStatus = () => {
|
|
|
15
15
|
}
|
|
16
16
|
}, [status, store]);
|
|
17
17
|
return (<>
|
|
18
|
-
{!isLoaded &&
|
|
18
|
+
{!isLoaded && <Icon icon="Sync" spin size={'1.2em'} color={Color.Primary}/>}
|
|
19
19
|
<div style={{ flexGrow: 1, flexShrink: 1, flexBasis: 0 }}></div>
|
|
20
20
|
<span style={{ minWidth: '1em' }}>
|
|
21
|
-
{status === Status.SYNCING &&
|
|
22
|
-
{status === Status.SUCCESS &&
|
|
23
|
-
{status === Status.ERROR &&
|
|
21
|
+
{status === Status.SYNCING && <Icon icon="Sync" spin size={'1.2em'} color={Color.Primary}/>}
|
|
22
|
+
{status === Status.SUCCESS && <Icon icon="Check" size={'1.2em'} color={Color.Success}/>}
|
|
23
|
+
{status === Status.ERROR && <Icon icon="Close" size={'1.2em'} color={Color.Danger}/>}
|
|
24
24
|
</span>
|
|
25
25
|
</>);
|
|
26
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrythonCommunicator.d.ts","sourceRoot":"","sources":["../../../src/theme/CodeEditor/BrythonCommunicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"BrythonCommunicator.d.ts","sourceRoot":"","sources":["../../../src/theme/CodeEditor/BrythonCommunicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,QAAA,MAAM,mBAAmB,yBAsCxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { BRYTHON_NOTIFICATION_EVENT, DOM_ELEMENT_IDS } from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BRYTHON_NOTIFICATION_EVENT, DOM_ELEMENT_IDS } from '@theme/CodeEditor/constants';
|
|
3
3
|
import { useStore, useScript } from '@theme/CodeEditor/hooks';
|
|
4
4
|
const BrythonCommunicator = () => {
|
|
5
5
|
const store = useStore();
|
|
@@ -14,15 +14,19 @@ const BrythonCommunicator = () => {
|
|
|
14
14
|
if (event.detail) {
|
|
15
15
|
const data = event.detail;
|
|
16
16
|
switch (data.type) {
|
|
17
|
-
case
|
|
17
|
+
case 'start':
|
|
18
18
|
store.clearLogMessages();
|
|
19
19
|
store.setExecuting(true);
|
|
20
20
|
break;
|
|
21
|
-
case
|
|
21
|
+
case 'done':
|
|
22
22
|
store.setExecuting(false);
|
|
23
23
|
break;
|
|
24
24
|
default:
|
|
25
|
-
store.addLogMessage({
|
|
25
|
+
store.addLogMessage({
|
|
26
|
+
type: data.type,
|
|
27
|
+
output: data.output,
|
|
28
|
+
timeStamp: data.timeStamp
|
|
29
|
+
});
|
|
26
30
|
break;
|
|
27
31
|
}
|
|
28
32
|
}
|
|
@@ -32,6 +36,6 @@ const BrythonCommunicator = () => {
|
|
|
32
36
|
current.removeEventListener(BRYTHON_NOTIFICATION_EVENT, onBryNotify);
|
|
33
37
|
};
|
|
34
38
|
}, [ref, store]);
|
|
35
|
-
return
|
|
39
|
+
return <div id={DOM_ELEMENT_IDS.communicator(codeId)} ref={ref}></div>;
|
|
36
40
|
};
|
|
37
41
|
export default BrythonCommunicator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,8BAA8B,CAAC;AAKtD,oBAAY,KAAK;IACb,OAAO,oBAAoB;IAC3B,SAAS,sBAAsB;IAC/B,OAAO,oBAAoB;IAC3B,IAAI,iBAAiB;IACrB,OAAO,oBAAoB;IAC3B,MAAM,mBAAmB;IACzB,IAAI,iBAAiB;CACxB;AACD,oBAAY,IAAI;IACZ,KAAK,eAAe;IACpB,KAAK,eAAe;CACvB;AAED,MAAM,WAAW,KAAK;IAClB,IAAI,EAAE,MAAM,OAAO,KAAK,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACrD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,8BAA8B,CAAC;AAKtD,oBAAY,KAAK;IACb,OAAO,oBAAoB;IAC3B,SAAS,sBAAsB;IAC/B,OAAO,oBAAoB;IAC3B,IAAI,iBAAiB;IACrB,OAAO,oBAAoB;IAC3B,MAAM,mBAAmB;IACzB,IAAI,iBAAiB;CACxB;AACD,oBAAY,IAAI;IACZ,KAAK,eAAe;IACpB,KAAK,eAAe;CACvB;AAED,MAAM,WAAW,KAAK;IAClB,IAAI,EAAE,MAAM,OAAO,KAAK,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACrD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,QAAA,MAAM,MAAM,UAAW,KAAK,sBAqB3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/CodeHistory/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,4BAA4B,CAAC;AAoBpC,QAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/CodeHistory/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,4BAA4B,CAAC;AAoBpC,QAAA,MAAM,WAAW,yBA2GhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -14,7 +14,7 @@ const highlightSyntax = (str) => {
|
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
return (<span dangerouslySetInnerHTML={{
|
|
17
|
-
__html: Prism.highlight(str, Prism.languages.python, 'python')
|
|
17
|
+
__html: Prism.highlight(str, Prism.languages.python, 'python')
|
|
18
18
|
}}/>);
|
|
19
19
|
};
|
|
20
20
|
const CodeHistory = () => {
|
|
@@ -30,11 +30,20 @@ const CodeHistory = () => {
|
|
|
30
30
|
<div className={clsx(styles.summary)}>
|
|
31
31
|
<span className="badge badge--secondary">
|
|
32
32
|
{versionsLoaded
|
|
33
|
-
? translate({
|
|
34
|
-
|
|
33
|
+
? translate({
|
|
34
|
+
message: '{n} Versions',
|
|
35
|
+
id: 'CodeHistory.nVersions.text'
|
|
36
|
+
}, { n: versions.length })
|
|
37
|
+
: translate({
|
|
38
|
+
message: 'Load Versions',
|
|
39
|
+
id: 'CodeHistory.LoadVersions.text'
|
|
40
|
+
})}
|
|
35
41
|
</span>
|
|
36
42
|
<span className={clsx(styles.spacer)}></span>
|
|
37
|
-
<Button icon=
|
|
43
|
+
<Button icon="Sync" title={translate({
|
|
44
|
+
message: 'Sync Versions',
|
|
45
|
+
id: 'CodeHistory.LoadVersions.text'
|
|
46
|
+
})} onClick={(e) => {
|
|
38
47
|
e.preventDefault();
|
|
39
48
|
e.stopPropagation();
|
|
40
49
|
store.loadVersions();
|
|
@@ -52,20 +61,22 @@ const CodeHistory = () => {
|
|
|
52
61
|
}
|
|
53
62
|
setVersion(c);
|
|
54
63
|
}} min={1} max={versions.length - 1} dots={versions.length < 50}/>
|
|
55
|
-
<span className="badge badge--primary">
|
|
56
|
-
V{version}
|
|
57
|
-
</span>
|
|
64
|
+
<span className="badge badge--primary">V{version}</span>
|
|
58
65
|
</div>
|
|
59
66
|
<div className={clsx(styles.diffViewer)}>
|
|
60
67
|
{versions.length > 1 && (<DiffViewer splitView oldValue={versions[version - 1].code} newValue={versions[version].code} leftTitle={<div className={clsx(styles.diffHeader)}>
|
|
61
68
|
{`V${version}`}
|
|
62
69
|
{versions[version].pasted && (<span className={clsx('badge', 'badge--danger')}>
|
|
63
|
-
<Translate id="CodeHistory.PastedBadge.Text">
|
|
70
|
+
<Translate id="CodeHistory.PastedBadge.Text">
|
|
71
|
+
Pasted
|
|
72
|
+
</Translate>
|
|
64
73
|
</span>)}
|
|
65
74
|
</div>} rightTitle={<div className={clsx(styles.diffHeader)}>
|
|
66
75
|
{`V${version}`}
|
|
67
76
|
{versions[version].pasted && (<span className={clsx('badge', 'badge--danger')}>
|
|
68
|
-
<Translate id="CodeHistory.PastedBadge.Text">
|
|
77
|
+
<Translate id="CodeHistory.PastedBadge.Text">
|
|
78
|
+
Pasted
|
|
79
|
+
</Translate>
|
|
69
80
|
</span>)}
|
|
70
81
|
</div>} renderContent={highlightSyntax}/>)}
|
|
71
82
|
</div>
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
.codeHistory
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
.codeHistory > .historyDetails {
|
|
2
|
+
cursor: pointer;
|
|
3
|
+
margin-bottom: 0;
|
|
4
|
+
border-top-left-radius: 0;
|
|
5
|
+
border-top-right-radius: 0;
|
|
6
6
|
}
|
|
7
7
|
.summary {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
10
|
}
|
|
11
11
|
.spacer {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
12
|
+
flex-grow: 1;
|
|
13
|
+
flex-shrink: 1;
|
|
14
|
+
flex-basis: 0;
|
|
15
|
+
}
|
|
16
16
|
|
|
17
17
|
.versionControl {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
padding: 1em 2em;
|
|
19
|
+
box-shadow: var(--ifm-global-shadow-lw);
|
|
20
|
+
border-radius: var(--ifm-global-radius);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.faButton {
|
|
24
|
-
|
|
24
|
+
margin-left: 1em;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.faButton:hover {
|
|
28
|
-
|
|
28
|
+
transform: scale(1.2);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.diffViewer {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
--ifm-pre-background: rgba(255, 255, 255, 0);
|
|
33
|
+
--ifm-alert-background-color: rgba(255, 255, 255, 0);
|
|
34
|
+
--ifm-alert-background-color-highlight: rgba(255, 255, 255, 0);
|
|
35
|
+
--ifm-table-stripe-background: rgba(255, 255, 255, 0);
|
|
36
|
+
font-family: monospace;
|
|
37
|
+
overflow: auto;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.diffViewer table tbody tr td {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
padding-top: 0;
|
|
42
|
+
padding-bottom: 0;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
.diffViewer table tbody tr td pre {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
padding-top: 0;
|
|
48
|
+
padding-bottom: 0;
|
|
49
|
+
line-height: 18px;
|
|
50
50
|
}
|
|
51
51
|
.diffHeader {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
52
|
+
display: flex;
|
|
53
|
+
justify-content: space-between;
|
|
54
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/ContextEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAmB,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAI/D,UAAU,KAAM,SAAQ,SAAS;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;CACtC;AAYD;;;;;GAKG;AACH,QAAA,MAAM,aAAa,UAAW,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/theme/CodeEditor/ContextEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAmB,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAI/D,UAAU,KAAM,SAAQ,SAAS;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;CACtC;AAYD;;;;;GAKG;AACH,QAAA,MAAM,aAAa,UAAW,KAAK,sBAyClC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -31,6 +31,6 @@ const ContextEditor = (props) => {
|
|
|
31
31
|
<CodeEditor code={code} lang={lang} preCode={pre} postCode={post} maxLines={props.maxLines && Number.parseInt(props.maxLines, 10)} readonly={!!props.readonly} resettable={!props.noReset} download={!props.versioned && !props.noDownload} slim={!!props.slim} showLineNumbers={!(!!props.slim && !/\n/.test(code))} versioned={!!props.versioned} noHistory={!!props.noHistory} noCompare={!!props.noCompare} title={title} className={props.className}/>
|
|
32
32
|
</ScriptContext>);
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return <CodeBlock {...props}/>;
|
|
35
35
|
};
|
|
36
36
|
export default ContextEditor;
|
|
@@ -12,7 +12,7 @@ import 'ace-builds/src-noconflict/ext-language_tools';
|
|
|
12
12
|
import 'ace-builds/webpack-resolver';
|
|
13
13
|
import { useStore, useScript } from '@theme/CodeEditor/hooks';
|
|
14
14
|
const ALIAS_LANG_MAP_ACE = {
|
|
15
|
-
mpy: 'python'
|
|
15
|
+
mpy: 'python'
|
|
16
16
|
};
|
|
17
17
|
const EditorAce = (props) => {
|
|
18
18
|
const eRef = React.useRef(null);
|
|
@@ -30,7 +30,7 @@ const EditorAce = (props) => {
|
|
|
30
30
|
// commands is array of key bindings.
|
|
31
31
|
name: 'execute',
|
|
32
32
|
bindKey: { win: 'Ctrl-Enter', mac: 'Command-Enter' },
|
|
33
|
-
exec: () => store.execScript()
|
|
33
|
+
exec: () => store.execScript()
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
node.editor.commands.addCommand({
|
|
@@ -39,7 +39,7 @@ const EditorAce = (props) => {
|
|
|
39
39
|
bindKey: { win: 'Ctrl-s', mac: 'Command-s' },
|
|
40
40
|
exec: () => {
|
|
41
41
|
store.saveNow();
|
|
42
|
-
}
|
|
42
|
+
}
|
|
43
43
|
});
|
|
44
44
|
return () => {
|
|
45
45
|
if (node && node.editor) {
|
|
@@ -73,7 +73,7 @@ const EditorAce = (props) => {
|
|
|
73
73
|
}} readOnly={showRaw} value={showRaw ? pristineCode : code} defaultValue={code || '\n'} name={DOM_ELEMENT_IDS.aceEditor(codeId)} editorProps={{ $blockScrolling: true }} setOptions={{
|
|
74
74
|
displayIndentGuides: true,
|
|
75
75
|
vScrollBarAlwaysVisible: false,
|
|
76
|
-
highlightGutterLine: false
|
|
76
|
+
highlightGutterLine: false
|
|
77
77
|
}} showPrintMargin={false} highlightActiveLine={false} enableBasicAutocompletion enableLiveAutocompletion={false} enableSnippets={false} showGutter={props.showLineNumbers}/>
|
|
78
78
|
</div>);
|
|
79
79
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/CodeEditor/Editor/Header/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,KAAK;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACtB;AAED,QAAA,MAAM,MAAM,UAAW,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/CodeEditor/Editor/Header/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,KAAK;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACtB;AAED,QAAA,MAAM,MAAM,UAAW,KAAK,sBAmB3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -15,9 +15,9 @@ const Header = (props) => {
|
|
|
15
15
|
{!props.slim && (<React.Fragment>
|
|
16
16
|
<div className={styles.title}>{props.title}</div>
|
|
17
17
|
<ShowSyncStatus />
|
|
18
|
-
{hasEdits && props.resettable &&
|
|
19
|
-
{props.download &&
|
|
20
|
-
{hasEdits && !props.noCompare &&
|
|
18
|
+
{hasEdits && props.resettable && <Reset />}
|
|
19
|
+
{props.download && <DownloadCode title={props.title}/>}
|
|
20
|
+
{hasEdits && !props.noCompare && <ShowRaw />}
|
|
21
21
|
</React.Fragment>)}
|
|
22
22
|
{lang === 'python' && <RunCode title={props.title} slim={props.slim}/>}
|
|
23
23
|
</div>);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
display: flex;
|
|
4
4
|
align-items: center;
|
|
5
5
|
letter-spacing: 0.08em;
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
z-index: calc(var(--ifm-z-index-fixed) - 2);
|
|
8
8
|
padding: 0.2em;
|
|
9
9
|
padding-left: 0.5em;
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.controls > .title {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
flex-shrink: 1;
|
|
19
|
+
flex-grow: 1;
|
|
20
|
+
overflow-x: hidden;
|
|
21
|
+
text-overflow: ellipsis;
|
|
22
|
+
white-space: nowrap;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.controls.slim {
|
|
26
26
|
padding: 0;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/CodeEditor/Editor/HiddenCode/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,KAAK;IACX,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,UAAU,UAAW,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/theme/CodeEditor/Editor/HiddenCode/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,KAAK;IACX,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,UAAU,UAAW,KAAK,sBAkC/B,CAAC;AAEF,eAAe,UAAU,CAAC"}
|