Disable clickThrough for get nodes for anything thats datatype is not JS_Object (#10286)

This commit is contained in:
marthasharkey 2024-06-18 09:27:20 +01:00 committed by GitHub
parent dc7ae17fb0
commit 0fc3755d1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,6 +17,10 @@ const config = useVisualizationConfig()
type ConstructivePattern = (placeholder: Ast.Owned) => Ast.Owned
const JSON_OBJECT_TYPE = 'Standard.Base.Data.Json.JS_Object'
const isClickThroughEnabled = config.nodeType === JSON_OBJECT_TYPE
function projector(parentPattern: ConstructivePattern | undefined) {
const style = {
spaced: parentPattern !== undefined,
@ -53,7 +57,11 @@ function createProjection(path: (string | number)[][]) {
<template>
<VisualizationContainer :belowToolbar="true">
<div class="JSONVisualization">
<JsonValueWidget :data="props.data" @createProjection="createProjection" />
<JsonValueWidget
:data="props.data"
:class="{ viewonly: !isClickThroughEnabled }"
@createProjection="createProjection"
/>
</div>
</VisualizationContainer>
</template>
@ -63,4 +71,7 @@ function createProjection(path: (string | number)[][]) {
font-family: var(--font-mono);
padding: 8px;
}
.viewonly {
pointer-events: none;
}
</style>