File tree Expand file tree Collapse file tree 4 files changed +13
-4
lines changed
Expand file tree Collapse file tree 4 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -391,18 +391,18 @@ export default function NewScratchForm({
391391 valueVersion = { valueVersion }
392392 onChange = { setAsm }
393393 extensions = { basicSetup }
394+ placeholder = "Place your GAS-compatible assembly code here."
394395 />
395396 </ div >
396397 < div className = "flex h-[200px] flex-col" >
397- < FormLabel small = "(any typedefs, structs, and declarations you would like to include go here; typically generated with m2ctx.py)" >
398- Context
399- </ FormLabel >
398+ < FormLabel small = "(optional)" > Context</ FormLabel >
400399 < CodeMirror
401400 className = "w-full flex-1 overflow-hidden rounded border border-[color:var(--g500)] bg-[color:var(--g200)] [&_.cm-editor]:h-full"
402401 value = { context }
403402 valueVersion = { valueVersion }
404403 onChange = { setContext }
405404 extensions = { [ basicSetup , cpp ( ) ] }
405+ placeholder = "Add any typedefs, structs, and declarations here."
406406 />
407407 </ div >
408408
Original file line number Diff line number Diff line change 1313 cursor : text ;
1414 }
1515
16+ :global(.cm-placeholder ) {
17+ font-style : italic ;
18+ }
19+
1620 :global(.cm-gutters ),
1721 :global(.cm-content ),
1822 :global(.cm-tooltip-hover ) {
Original file line number Diff line number Diff line change 77} from "react" ;
88
99import { type Extension , EditorState } from "@codemirror/state" ;
10- import { EditorView } from "@codemirror/view" ;
10+ import { EditorView , placeholder } from "@codemirror/view" ;
1111import clsx from "clsx" ;
1212import { useDebouncedCallback } from "use-debounce" ;
1313
@@ -49,6 +49,7 @@ export interface Props {
4949 className ?: string ;
5050 viewRef ?: RefObject < EditorView | null > ;
5151 extensions : Extension ; // const
52+ placeholder ?: string ;
5253}
5354
5455export default function CodeMirror ( {
@@ -60,6 +61,7 @@ export default function CodeMirror({
6061 className,
6162 viewRef : viewRefProp ,
6263 extensions,
64+ placeholder : placeholderText ,
6365} : Props ) {
6466 const { ref : el , width } = useSize < HTMLDivElement > ( ) ;
6567
@@ -96,6 +98,7 @@ export default function CodeMirror({
9698 state : EditorState . create ( {
9799 doc : valueRef . current ,
98100 extensions : [
101+ placeholder ( placeholderText || "" ) ,
99102 EditorState . transactionExtender . of (
100103 ( { docChanged, newDoc, newSelection } ) => {
101104 // value / onChange
Original file line number Diff line number Diff line change @@ -298,6 +298,7 @@ export default function Scratch({
298298 } }
299299 onSelectedLineChange = { setSelectedSourceLine }
300300 extensions = { cmExtensionsSource }
301+ placeholder = "Write the code for the function you are matching here."
301302 />
302303 </ Tab >
303304 ) ;
@@ -322,6 +323,7 @@ export default function Scratch({
322323 setScratch ( { context : value } ) ;
323324 } }
324325 extensions = { cmExtensionsContext }
326+ placeholder = "Add your typedefs, structs, and declarations here."
325327 />
326328 </ Tab >
327329 ) ;
You can’t perform that action at this time.
0 commit comments