1
1
import { Classes } from '@blueprintjs/core' ;
2
2
import { IconNames } from '@blueprintjs/icons' ;
3
3
import { Octokit } from '@octokit/rest' ;
4
- import { Ace , Range } from 'ace-builds' ;
5
4
import { FSModule } from 'browserfs/dist/node/core/FS' ;
6
5
import classNames from 'classnames' ;
7
6
import { Chapter , Variant } from 'js-slang/dist/types' ;
@@ -109,7 +108,6 @@ import MobileWorkspace, {
109
108
} from '../../commons/mobileWorkspace/MobileWorkspace' ;
110
109
import { SideBarTab } from '../../commons/sideBar/SideBar' ;
111
110
import { SideContentTab , SideContentType } from '../../commons/sideContent/SideContentTypes' ;
112
- import { Links } from '../../commons/utils/Constants' ;
113
111
import { generateSourceIntroduction } from '../../commons/utils/IntroductionHelper' ;
114
112
import { convertParamToBoolean , convertParamToInt } from '../../commons/utils/ParamParseHelper' ;
115
113
import { IParsedQuery , parseQuery } from '../../commons/utils/QueryHelper' ;
@@ -142,7 +140,6 @@ export type PlaygroundProps = OwnProps &
142
140
} ;
143
141
144
142
export type OwnProps = {
145
- isSicpEditor ?: boolean ;
146
143
initialEditorValueHash ?: string ;
147
144
prependLength ?: number ;
148
145
handleCloseEditor ?: ( ) => void ;
@@ -271,7 +268,6 @@ export async function handleHash(
271
268
}
272
269
273
270
const Playground : React . FC < PlaygroundProps > = ( { workspaceLocation = 'playground' , ...props } ) => {
274
- const { isSicpEditor } = props ;
275
271
const { isMobileBreakpoint } = useResponsive ( ) ;
276
272
const propsRef = React . useRef ( props ) ;
277
273
propsRef . current = props ;
@@ -316,8 +312,7 @@ const Playground: React.FC<PlaygroundProps> = ({ workspaceLocation = 'playground
316
312
[ deviceSecret ]
317
313
) ;
318
314
319
- const usingRemoteExecution =
320
- useTypedSelector ( state => ! ! state . session . remoteExecutionSession ) && ! isSicpEditor ;
315
+ const usingRemoteExecution = useTypedSelector ( state => ! ! state . session . remoteExecutionSession ) ;
321
316
// this is still used by remote execution (EV3)
322
317
// specifically, for the editor Ctrl+B to work
323
318
const externalLibraryName = useTypedSelector (
@@ -335,7 +330,7 @@ const Playground: React.FC<PlaygroundProps> = ({ workspaceLocation = 'playground
335
330
) ;
336
331
} , [ props . editorSessionId ] ) ;
337
332
338
- const hash = isSicpEditor ? props . initialEditorValueHash : props . location . hash ;
333
+ const hash = props . location . hash ;
339
334
340
335
React . useEffect ( ( ) => {
341
336
if ( ! hash ) {
@@ -667,21 +662,19 @@ const Playground: React.FC<PlaygroundProps> = ({ workspaceLocation = 'playground
667
662
) ;
668
663
669
664
const shareButton = React . useMemo ( ( ) => {
670
- const queryString = isSicpEditor
671
- ? Links . playground + '#' + props . initialEditorValueHash
672
- : props . queryString ;
665
+ const queryString = props . queryString ;
673
666
return (
674
667
< ControlBarShareButton
675
668
handleGenerateLz = { ( ) => dispatch ( generateLzString ( ) ) }
676
669
handleShortenURL = { s => dispatch ( shortenURL ( s ) ) }
677
670
handleUpdateShortURL = { s => dispatch ( updateShortURL ( s ) ) }
678
671
queryString = { queryString }
679
672
shortURL = { props . shortURL }
680
- isSicp = { isSicpEditor }
673
+ isSicp = { false }
681
674
key = "share"
682
675
/>
683
676
) ;
684
- } , [ dispatch , isSicpEditor , props . initialEditorValueHash , props . queryString , props . shortURL ] ) ;
677
+ } , [ dispatch , props . queryString , props . shortURL ] ) ;
685
678
686
679
const toggleFolderModeButton = React . useMemo ( ( ) => {
687
680
return (
@@ -757,17 +750,14 @@ const Playground: React.FC<PlaygroundProps> = ({ workspaceLocation = 'playground
757
750
}
758
751
}
759
752
760
- if ( ! isSicpEditor ) {
761
- tabs . push ( remoteExecutionTab ) ;
762
- }
753
+ tabs . push ( remoteExecutionTab ) ;
763
754
764
755
return tabs ;
765
756
} , [
766
757
playgroundIntroductionTab ,
767
758
props . playgroundSourceChapter ,
768
759
props . output ,
769
760
usingRemoteExecution ,
770
- isSicpEditor ,
771
761
dispatch ,
772
762
workspaceLocation ,
773
763
shouldShowDataVisualizer ,
@@ -779,18 +769,6 @@ const Playground: React.FC<PlaygroundProps> = ({ workspaceLocation = 'playground
779
769
// Remove Intro and Remote Execution tabs for mobile
780
770
const mobileTabs = [ ...tabs ] . filter ( ( { id } ) => ! ( id && desktopOnlyTabIds . includes ( id ) ) ) ;
781
771
782
- const onLoadMethod = React . useCallback (
783
- ( editor : Ace . Editor ) => {
784
- const addFold = ( ) => {
785
- editor . getSession ( ) . addFold ( ' ' , new Range ( 1 , 0 , props . prependLength ! , 0 ) ) ;
786
- editor . renderer . off ( 'afterRender' , addFold ) ;
787
- } ;
788
-
789
- editor . renderer . on ( 'afterRender' , addFold ) ;
790
- } ,
791
- [ props . prependLength ]
792
- ) ;
793
-
794
772
const onChangeMethod = React . useCallback (
795
773
( newCode : string , delta : CodeDelta ) => {
796
774
const input : Input = {
@@ -911,7 +889,6 @@ const Playground: React.FC<PlaygroundProps> = ({ workspaceLocation = 'playground
911
889
onChange : onChangeMethod ,
912
890
onCursorChange : onCursorChangeMethod ,
913
891
onSelectionChange : onSelectionChangeMethod ,
914
- onLoad : isSicpEditor && props . prependLength ? onLoadMethod : undefined ,
915
892
sourceChapter : props . playgroundSourceChapter ,
916
893
externalLibraryName,
917
894
sourceVariant : props . playgroundSourceVariant ,
@@ -941,7 +918,7 @@ const Playground: React.FC<PlaygroundProps> = ({ workspaceLocation = 'playground
941
918
selectedTab === SideContentType . envVisualizer ,
942
919
inputHidden : replDisabled ,
943
920
replButtons : [ replDisabled ? null : evalButton , clearButton ] ,
944
- disableScrolling : isSicpEditor
921
+ disableScrolling : false
945
922
} ;
946
923
947
924
const sideBarProps : { tabs : SideBarTab [ ] } = React . useMemo ( ( ) => {
@@ -978,7 +955,7 @@ const Playground: React.FC<PlaygroundProps> = ({ workspaceLocation = 'playground
978
955
autorunButtons ,
979
956
props . playgroundSourceChapter === Chapter . FULL_JS ? null : shareButton ,
980
957
chapterSelect ,
981
- isSicpEditor ? null : sessionButtons ,
958
+ sessionButtons ,
982
959
languageConfig . supports . multiFile ? toggleFolderModeButton : null ,
983
960
persistenceButtons ,
984
961
githubButtons ,
@@ -1004,7 +981,7 @@ const Playground: React.FC<PlaygroundProps> = ({ workspaceLocation = 'playground
1004
981
beforeDynamicTabs : tabs ,
1005
982
afterDynamicTabs : [ ]
1006
983
} ,
1007
- workspaceLocation : isSicpEditor ? 'sicp' : 'playground' ,
984
+ workspaceLocation : 'playground' ,
1008
985
sideContentHeight : props . sideContentHeight
1009
986
} ,
1010
987
sideContentIsResizeable : selectedTab !== SideContentType . substVisualizer
@@ -1020,7 +997,7 @@ const Playground: React.FC<PlaygroundProps> = ({ workspaceLocation = 'playground
1020
997
autorunButtons ,
1021
998
chapterSelect ,
1022
999
props . playgroundSourceChapter === Chapter . FULL_JS ? null : shareButton ,
1023
- isSicpEditor ? null : sessionButtons ,
1000
+ sessionButtons ,
1024
1001
languageConfig . supports . multiFile ? toggleFolderModeButton : null ,
1025
1002
persistenceButtons ,
1026
1003
githubButtons
@@ -1032,7 +1009,7 @@ const Playground: React.FC<PlaygroundProps> = ({ workspaceLocation = 'playground
1032
1009
beforeDynamicTabs : mobileTabs ,
1033
1010
afterDynamicTabs : [ ]
1034
1011
} ,
1035
- workspaceLocation : isSicpEditor ? 'sicp' : 'playground'
1012
+ workspaceLocation : 'playground'
1036
1013
}
1037
1014
} ;
1038
1015
0 commit comments