MCPcopy Create free account
hub / github.com/AlexErrant/Pentive / QueryEditor

Function QueryEditor

app/src/components/queryEditor.tsx:65–90  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

63 // We usually ignore changes to `value` to prevent unnecessary `view.setState` calls
64 externalValue: string
65}> = (props) => {
66 let ref!: HTMLDivElement
67 onMount(() => {
68 const [theme] = useThemeContext()
69 const view = new EditorView({
70 parent: ref,
71 })
72 createEffect(
73 on(theme, (t) => {
74 view.setState(createEditorState(view, props.value, t, props.setValue))
75 }),
76 )
77 createEffect(
78 on(
79 () => props.externalValue,
80 (v) => {
81 view.setState(createEditorState(view, v, theme(), props.setValue))
82 },
83 ),
84 )
85 onCleanup(() => {
86 view.destroy()
87 })
88 })
89 return <div class='query-editor max-h-40 flex-1 overflow-auto' ref={ref} />
90}
91
92export default QueryEditor
93

Callers

nothing calls this directly

Calls 3

useThemeContextFunction · 0.90
createEditorStateFunction · 0.70
destroyMethod · 0.45

Tested by

no test coverage detected