From fc0409fc2996d7666c48bbd8abf5c530262c39ae Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Tue, 18 Jul 2023 13:30:04 -0400 Subject: fixed button click issues and made it such that when you have no documents selected, then irrelevant buttons wont show --- src/client/views/nodes/FontIconBox/FontIconBox.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/client/views/nodes/FontIconBox/FontIconBox.tsx') 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() { 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() { 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 = ( - script?.script.run({ _readOnly_: false })} color={color} icon={this.Icon(color)!} label={this.label}/> + 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 = ( -