1+ import { useMemo } from "react" ;
12import { Cog } from "lucide-react" ;
23import { useSelector } from "react-redux" ;
34import { twMerge } from "tailwind-merge" ;
@@ -13,21 +14,24 @@ import { default as GridSwitch } from "./grid-switch";
1314const onCogClick = ( ) => store . dispatch ( toggleControls ( ) ) ;
1415
1516const Operations : React . FC < ISTKProps > = ( {
16- options : { showGridSwitch = true , exportButtonText, operationTriggerIcon } = { } ,
17+ options : { showGridSwitch = true , exportButtonText, operationTriggerIcon, locationInputPlaceholder } = { } ,
1718 events,
1819 ...props
1920} ) => {
2021 const location = useSelector ( ( state : any ) => state . editor . location ) ;
2122
23+ const inputPlaceholder = useMemo ( ( ) => locationInputPlaceholder ?? locationPlaceholder , [ locationInputPlaceholder ] ) ;
24+
2225 const styles = props . styles ?. operations ;
2326
2427 const OperationTriggerIcon = operationTriggerIcon ?? Cog ;
2528
2629 const onLocationChange = ( e ) => {
2730 const location = e . target . innerText ;
31+ console . log ( location ) ;
2832 if ( ! location ) {
29- document . getElementById ( "stk- location-name" ) . innerText = locationPlaceholder ;
30- return store . dispatch ( setLocation ( locationPlaceholder ) ) ;
33+ document . getElementById ( ids . location ) . innerText = inputPlaceholder ;
34+ return store . dispatch ( setLocation ( inputPlaceholder ) ) ;
3135 }
3236 store . dispatch ( setLocation ( location ) ) ;
3337 } ;
@@ -58,13 +62,13 @@ const Operations: React.FC<ISTKProps> = ({
5862 suppressContentEditableWarning = { true }
5963 className = { twMerge (
6064 "text-xl font-bold outline-none" ,
61- location === locationPlaceholder && "opacity-60" ,
65+ location === inputPlaceholder && "opacity-60" ,
6266 styles ?. input ?. className
6367 ) }
6468 style = { styles ?. input ?. properties }
6569 onInput = { onLocationChange }
6670 >
67- { locationPlaceholder }
71+ { inputPlaceholder }
6872 </ Body >
6973 < div className = "flex justify-between items-center gap-5" >
7074 { showGridSwitch && < GridSwitch className = "mr-2" /> }
0 commit comments