@@ -7,10 +7,14 @@ import {
77 type CreateNoteButtonAction ,
88 type InputButtonAction ,
99 type JSButtonAction ,
10+ type ReplaceInNoteButtonAction ,
1011 type OpenButtonAction ,
1112 type SleepButtonAction ,
1213 type TemplaterCreateNoteButtonAction ,
1314 type UpdateMetadataButtonAction ,
15+ type ReplaceSelfButtonAction ,
16+ type RegexpReplaceInNoteButtonAction ,
17+ type InsertIntoNoteButtonAction ,
1418} from 'packages/core/src/config/ButtonConfig' ;
1519import { oneOf , schemaForType } from 'packages/core/src/utils/ZodUtils' ;
1620import { z } from 'zod' ;
@@ -79,6 +83,38 @@ export const V_CreateNoteButtonAction = schemaForType<CreateNoteButtonAction>()(
7983 } ) ,
8084) ;
8185
86+ export const V_ReplaceInNoteButtonAction = schemaForType < ReplaceInNoteButtonAction > ( ) (
87+ z . object ( {
88+ type : z . literal ( ButtonActionType . REPLACE_IN_NOTE ) ,
89+ fromLine : z . number ( ) ,
90+ toLine : z . number ( ) ,
91+ replacement : z . string ( ) ,
92+ } ) ,
93+ ) ;
94+
95+ export const V_ReplaceSelfButtonAction = schemaForType < ReplaceSelfButtonAction > ( ) (
96+ z . object ( {
97+ type : z . literal ( ButtonActionType . REPLACE_SELF ) ,
98+ replacement : z . string ( ) ,
99+ } ) ,
100+ ) ;
101+
102+ export const V_RegexpReplaceInNoteButtonAction = schemaForType < RegexpReplaceInNoteButtonAction > ( ) (
103+ z . object ( {
104+ type : z . literal ( ButtonActionType . REGEXP_REPLACE_IN_NOTE ) ,
105+ regexp : z . string ( ) ,
106+ replacement : z . string ( ) ,
107+ } ) ,
108+ ) ;
109+
110+ export const V_InsertIntoNoteButtonAction = schemaForType < InsertIntoNoteButtonAction > ( ) (
111+ z . object ( {
112+ type : z . literal ( ButtonActionType . INSERT_INTO_NOTE ) ,
113+ line : z . number ( ) ,
114+ value : z . string ( ) ,
115+ } ) ,
116+ ) ;
117+
82118export const V_ButtonAction = schemaForType < ButtonAction > ( ) (
83119 z . union ( [
84120 V_CommandButtonAction ,
@@ -89,6 +125,10 @@ export const V_ButtonAction = schemaForType<ButtonAction>()(
89125 V_TemplaterCreateNoteButtonAction ,
90126 V_UpdateMetadataButtonAction ,
91127 V_CreateNoteButtonAction ,
128+ V_ReplaceInNoteButtonAction ,
129+ V_ReplaceSelfButtonAction ,
130+ V_RegexpReplaceInNoteButtonAction ,
131+ V_InsertIntoNoteButtonAction ,
92132 ] ) ,
93133) ;
94134
0 commit comments