File tree Expand file tree Collapse file tree 5 files changed +14
-0
lines changed Expand file tree Collapse file tree 5 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import i18next from 'i18next';
22import apiClient from '../../../utils/apiClient' ;
33import * as ActionTypes from '../../../constants' ;
44
5+ // here, you'll need to import dispatchMessage from the dispatcher (look at actions/ide.js#startSkech() as reference)
6+ // that function should dispatch the value of the coordinate preference that's set in the UI
57function updatePreferences ( formParams , dispatch ) {
68 apiClient
79 . put ( '/preferences' , formParams )
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ import {
1919 setLinewrap
2020} from '../../actions/preferences' ;
2121
22+ // add the coordinatesVisible UI in here
23+
2224export default function Preferences ( ) {
2325 const { t } = useTranslation ( ) ;
2426
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ export const initialState = {
1313 language : 'en-US' ,
1414 autocloseBracketsQuotes : true ,
1515 autocompleteHinter : false
16+ // add the coordinatesVisible state here, which you can reference in Preferences.jsx,
17+ // and then import the action that dispatches the message in Preferences.jsx
1618} ;
1719
1820const preferences = ( state = initialState , action ) => {
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ const App = () => {
2424 const [ basePath , setBasePath ] = useState ( '' ) ;
2525 const [ textOutput , setTextOutput ] = useState ( false ) ;
2626 const [ gridOutput , setGridOutput ] = useState ( false ) ;
27+ const [ coordinatesVisible , setCoordinatesVisible ] = useState ( false ) ;
2728 registerFrame ( window . parent , getConfig ( 'EDITOR_URL' ) ) ;
2829
2930 function handleMessageEvent ( message ) {
@@ -47,6 +48,10 @@ const App = () => {
4748 case MessageTypes . EXECUTE :
4849 dispatchMessage ( payload ) ;
4950 break ;
51+ case MessageTypes . COORDINATES :
52+ // could probably just set payload to be t or f
53+ setCoordinatesVisible ( payload ) ;
54+ break ;
5055 default :
5156 break ;
5257 }
@@ -85,4 +90,6 @@ const App = () => {
8590 ) ;
8691} ;
8792
93+ // <!-- insert component that reders coordinates here, put in same folder -->
94+
8895render ( < App /> , document . getElementById ( 'root' ) ) ;
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export const MessageTypes = {
1313 REGISTER : 'REGISTER' ,
1414 EXECUTE : 'EXECUTE'
1515} ;
16+ // Add a new message type (COORDIATES)
1617
1718export function registerFrame ( newFrame , newOrigin ) {
1819 const frameId = frameIndex ;
You can’t perform that action at this time.
0 commit comments