aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FontIconBox/FontIconBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/FontIconBox/FontIconBox.tsx')
-rw-r--r--src/client/views/nodes/FontIconBox/FontIconBox.tsx18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/client/views/nodes/FontIconBox/FontIconBox.tsx b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
index e98faf2a0..39be4022e 100644
--- a/src/client/views/nodes/FontIconBox/FontIconBox.tsx
+++ b/src/client/views/nodes/FontIconBox/FontIconBox.tsx
@@ -211,6 +211,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
if (selected) {
if (StrCast(selected.type) === DocumentType.COL) {
text = StrCast(selected._type_collection);
+ console.log("collection selected", text)
} else {
console.log("doc selected", selected.title);
dropdown = false;
@@ -321,7 +322,17 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
console.log(tooltip, toggleStatus);
return (
- <Toggle tooltip={`Toggle ${tooltip}`} toggleType={ToggleType.BUTTON} type={Type.PRIM} toggleStatus={toggleStatus} text={buttonText} color={color} icon={this.Icon(color)!} label={this.label}/>
+ <Toggle
+ tooltip={`Toggle ${tooltip}`}
+ toggleType={ToggleType.BUTTON}
+ type={Type.PRIM}
+ toggleStatus={toggleStatus}
+ text={buttonText}
+ color={color}
+ icon={this.Icon(color)!}
+ label={this.label}
+ onPointerDown={() => script.script.run({ self: this.rootDoc, value: !toggleStatus, _readOnly_: false })}
+ />
)
}
@@ -365,7 +376,6 @@ 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);
-
// TODO:glr Add label of button type
let button: JSX.Element = this.defaultButton;
// prettier-ignore
@@ -389,9 +399,9 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
break;
case ButtonType.ToggleButton: button = this.toggleButton; break;
case ButtonType.TextButton:
- // Script for checking the outcome of the toggle
const script = ScriptCast(this.rootDoc.script);
const checkResult = script?.script.run({ _readOnly_: true }).result;
+ // 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}/>
);
@@ -399,7 +409,7 @@ export class FontIconBox extends DocComponent<ButtonProps>() {
case ButtonType.ClickButton:
case ButtonType.ToolButton:
button = (
- <IconButton tooltip={tooltip} color={color} icon={this.Icon(color)!} label={this.label}/>
+ <IconButton tooltip={tooltip} onPointerDown={() => script?.script.run({ _readOnly_: false })} color={color} icon={this.Icon(color)!} label={this.label}/>
);
break;
case ButtonType.MenuButton: button = (