Skip to content

Commit e21434f

Browse files
committed
implement #477
1 parent da1831a commit e21434f

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

packages/core/src/api/API.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ export abstract class API<Plugin extends IPlugin> {
590590
}
591591

592592
/**
593-
* Checks if a string is any declaration and if yes returns the widget type.
593+
* Checks if a string is any declaration. If yes, it returns the widget type, otherwise undefined.
594594
*
595595
* @param str the declaration string
596596
*/
@@ -635,7 +635,7 @@ export abstract class API<Plugin extends IPlugin> {
635635
*
636636
* @param storageType the storage type (also named metadata source sometimes)
637637
* @param storagePath the storage path (usually the file path)
638-
* @param property the property path a.b.c = ['a', 'b', 'c']
638+
* @param property the property access path as an array. E.g. for the path `cache.a.b.c`, the array would be `['a', 'b', 'c']`.
639639
* @param listenToChildren whether to listen to children, only relevant for arrays and objects
640640
*/
641641
public createBindTarget(

packages/core/src/config/ButtonConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export interface InsertIntoNoteButtonAction {
123123
export interface InlineJSButtonAction {
124124
type: ButtonActionType.INLINE_JS;
125125
code: string;
126+
args?: Record<string, unknown>;
126127
}
127128

128129
export type ButtonAction =

packages/core/src/config/validators/ButtonConfigValidators.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ export const V_InlineJSButtonAction = schemaForType<InlineJSButtonAction>()(
178178
z.object({
179179
type: z.literal(ButtonActionType.INLINE_JS),
180180
code: actionFieldString('inlineJS', 'code', 'code string to run'),
181+
args: z.record(z.unknown()).optional(),
181182
}),
182183
);
183184

packages/core/src/fields/button/actions/InlineJSButtonActionConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export class InlineJSButtonActionConfig extends AbstractButtonActionConfig<Inlin
3131

3232
const configOverrides: Record<string, unknown> = {
3333
buttonConfig: structuredClone(config),
34+
args: structuredClone(action.args),
3435
buttonContext: structuredClone(context),
3536
click: structuredClone(click),
3637
};
@@ -42,6 +43,7 @@ export class InlineJSButtonActionConfig extends AbstractButtonActionConfig<Inlin
4243
return {
4344
type: ButtonActionType.INLINE_JS,
4445
code: 'console.log("Hello world")',
46+
args: {},
4547
};
4648
}
4749

0 commit comments

Comments
 (0)