@@ -10,14 +10,16 @@ import _, { isObjectLike } from 'lodash';
1010import axios from 'axios' ;
1111import Text from 'antd/lib/typography/Text' ;
1212import Paragraph from 'antd/lib/typography/Paragraph' ;
13- import ExternalLink from '../../components/ExternalLink' ;
1413import styles from './JsEvaluatorPage.module.scss' ;
1514import OutputMode from './types/OutputMode' ;
1615import CopyButton from '../../components/copyButton/CopyButton' ;
1716import { BeforeMount } from '@monaco-editor/react' ;
1817import { editor } from 'monaco-editor' ;
1918import classNames from 'classnames' ;
2019import AppEditor from '../../components/appEditor/AppEditor' ;
20+ import monacoExtraLibs from '../../utils/monaco/monacoExtraLibs' ;
21+ import moment from 'moment' ;
22+ import NpmLink from '../../components/NpmLink' ;
2123
2224interface ShowCountProps {
2325 formatter : ( args : { count : number ; maxLength ?: number } ) => string ;
@@ -34,10 +36,11 @@ const codeEditorOptions: editor.IStandaloneEditorConstructionOptions = {
3436
3537const handleCodeEditorBeforeMount : BeforeMount = ( monaco ) => {
3638 monaco . languages . typescript . javascriptDefaults . addExtraLib ( `
37- declare const $value: string;
38- declare const _;
39- declare const axios;
40- declare const pluralize;` ) ;
39+ declare const $value: string;` ) ;
40+ monacoExtraLibs . lodash ( monaco ) ;
41+ monacoExtraLibs . axios ( monaco ) ;
42+ monacoExtraLibs . pluralize ( monaco ) ;
43+ monacoExtraLibs . moment ( monaco ) ;
4144} ;
4245
4346const JsEvaluatorPage = ( ) => {
@@ -63,6 +66,7 @@ const JsEvaluatorPage = () => {
6366 _,
6467 axios,
6568 pluralize,
69+ moment,
6670 $easterEgg : '🥚'
6771 } ) ;
6872
@@ -112,18 +116,8 @@ const JsEvaluatorPage = () => {
112116 < code > $value</ code >
113117 </ label >
114118 </ Tooltip >
115- ,{ ' ' }
116- < ExternalLink href = "https://lodash.com/" >
117- < code > _</ code >
118- </ ExternalLink >
119- ,{ ' ' }
120- < ExternalLink href = "https://github.com/axios/axios" >
121- < code > axios</ code >
122- </ ExternalLink >
123- ,{ ' ' }
124- < ExternalLink href = "https://github.com/plurals/pluralize" >
125- < code > pluralize</ code >
126- </ ExternalLink >
119+ , < NpmLink packageName = "lodash" > _</ NpmLink > , < NpmLink packageName = "axios" /> ,{ ' ' }
120+ < NpmLink packageName = "pluralize" /> , < NpmLink packageName = "moment" />
127121 </ Paragraph >
128122 </ Text >
129123
@@ -134,7 +128,7 @@ const JsEvaluatorPage = () => {
134128 value = { evalValue }
135129 onChange = { setEvalValue }
136130 options = { codeEditorOptions }
137- height = "250px "
131+ height = "400px "
138132 width = "100%"
139133 beforeMount = { handleCodeEditorBeforeMount }
140134 />
@@ -157,6 +151,7 @@ const JsEvaluatorPage = () => {
157151 className = { classNames ( 'font-monospace mb-2' , styles . textarea ) }
158152 readOnly
159153 value = { evaluatedJs }
154+ rows = { 6 }
160155 />
161156 < CopyButton value = { evaluatedJs } />
162157 </ Col >
0 commit comments