aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FontIconBox/FontIconBox.tsx
diff options
context:
space:
mode:
authorGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2023-07-18 13:30:04 -0400
committerGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2023-07-18 13:30:04 -0400
commitfc0409fc2996d7666c48bbd8abf5c530262c39ae (patch)
tree48ebc66153a29d305aeb0222adae04ed7b914d7d /src/client/views/nodes/FontIconBox/FontIconBox.tsx
parentb62a751b6a16acd28b4f9a9794ded6ea14fa0de8 (diff)
fixed button click issues
and made it such that when you have no documents selected, then irrelevant buttons wont show
Diffstat (limited to 'src/client/views/nodes/FontIconBox/FontIconBox.tsx')
-rw-r--r--src/client/views/nodes/FontIconBox/FontIconBox.tsx12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/client/views/nodes/FontIconBox/FontIconBox.tsx b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
index f676641ac..3ec53beac 100644
--- a/src/client/views/nodes/FontIconBox/FontIconBox.tsx
+++ b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
@@ -376,6 +376,8 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
const color = this.props.styleProvider?.(this.rootDoc, this.props, StyleProp.Color);
const backgroundColor = this.props.styleProvider?.(this.rootDoc, this.props, StyleProp.BackgroundColor);
const tooltip: string = StrCast(this.rootDoc.toolTip);
+ const onClickScript = ScriptCast(this.rootDoc.onClick);
+ const script = ScriptCast(this.rootDoc.script);
// TODO:glr Add label of button type
let button: JSX.Element = this.defaultButton;
// prettier-ignore
@@ -400,21 +402,17 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
case ButtonType.ToggleButton: button = this.toggleButton; break;
case ButtonType.ClickButton:
case ButtonType.ToolButton:
- const script = ScriptCast(this.rootDoc.onClick);
- const checkResult = script?.script.run({ _readOnly_: true }).result;
button = (
- <IconButton tooltip={tooltip} onPointerDown={() => script?.script.run({ _readOnly_: false })} color={color} icon={this.Icon(color)!} label={this.label}/>
+ <IconButton tooltip={tooltip} onPointerDown={() => onClickScript?.script.run({ _readOnly_: false })} color={color} icon={this.Icon(color)!} label={this.label}/>
);
break;
case ButtonType.TextButton:
-
- // Script for checking the outcome of the toggle
button = (
- <Button tooltip={tooltip} color={checkResult ?? backgroundColor} icon={this.Icon(color)!} text={StrCast(this.rootDoc.buttonText)} label={this.label}/>
+ <Button tooltip={tooltip} icon={this.Icon(color)!} text={StrCast(this.rootDoc.buttonText)} label={this.label}/>
);
break;
case ButtonType.MenuButton: button = (
- <IconButton tooltip={tooltip} tooltipPlacement='right' size={Size.LARGE} color={color} icon={this.Icon(color)!} label={this.label}/>
+ <IconButton tooltip={tooltip} onPointerDown={() => onClickScript?.script.run({ self: this.rootDoc, _readOnly_: false })} tooltipPlacement='right' size={Size.LARGE} color={color} icon={this.Icon(color)!} label={this.label}/>
);
break;
}