Skip to content

Commit 6b704d1

Browse files
committed
fix #206
1 parent 9730601 commit 6b704d1

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

packages/core/src/modals/modalContents/ButtonBuilderModalComponent.svelte

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@
112112
return 'Update Metadata';
113113
} else if (actionType === ButtonActionType.CREATE_NOTE) {
114114
return 'Create a New Note';
115+
} else if (actionType === ButtonActionType.REPLACE_IN_NOTE) {
116+
return 'Replace Text in Note';
117+
} else if (actionType === ButtonActionType.REGEXP_REPLACE_IN_NOTE) {
118+
return 'Replace Text in Note using Regexp';
119+
} else if (actionType === ButtonActionType.REPLACE_SELF) {
120+
return 'Replace Button with Text';
121+
} else if (actionType === ButtonActionType.INSERT_INTO_NOTE) {
122+
return 'Insert Text into the Note';
115123
}
116124
117125
return 'CHANGE ME';
@@ -287,6 +295,59 @@ Add action of type
287295
<Toggle bind:checked={action.openNote}></Toggle>
288296
</SettingComponent>
289297
{/if}
298+
299+
{#if action.type === ButtonActionType.REPLACE_IN_NOTE}
300+
<Button variant={ButtonStyleType.DESTRUCTIVE} on:click={() => removeAction(i)}>Remove Action</Button>
301+
302+
<SettingComponent name="Line From" description="The line that marks the start of the area to replace.">
303+
<input type="number" bind:value={action.fromLine} placeholder="0" />
304+
</SettingComponent>
305+
306+
<SettingComponent name="Line To" description="The line that marks the end of the area to replace.">
307+
<input type="number" bind:value={action.toLine} placeholder="0" />
308+
</SettingComponent>
309+
310+
<SettingComponent name="Replacement Text" description="The text to replace the note section."
311+
></SettingComponent>
312+
<div class="meta-bind-full-width meta-bind-high">
313+
<textarea bind:value={action.replacement}></textarea>
314+
</div>
315+
{/if}
316+
317+
{#if action.type === ButtonActionType.REGEXP_REPLACE_IN_NOTE}
318+
<Button variant={ButtonStyleType.DESTRUCTIVE} on:click={() => removeAction(i)}>Remove Action</Button>
319+
320+
<SettingComponent name="Regexp" description="The regexp to find replacements.">
321+
<input type="text" bind:value={action.regexp} />
322+
</SettingComponent>
323+
324+
<SettingComponent name="Replacement Text" description="The text to replace the button with."></SettingComponent>
325+
<div class="meta-bind-full-width meta-bind-high">
326+
<textarea bind:value={action.replacement}></textarea>
327+
</div>
328+
{/if}
329+
330+
{#if action.type === ButtonActionType.REPLACE_SELF}
331+
<Button variant={ButtonStyleType.DESTRUCTIVE} on:click={() => removeAction(i)}>Remove Action</Button>
332+
333+
<SettingComponent name="Replacement Text" description="The text to replace the match with."></SettingComponent>
334+
<div class="meta-bind-full-width meta-bind-high">
335+
<textarea bind:value={action.replacement}></textarea>
336+
</div>
337+
{/if}
338+
339+
{#if action.type === ButtonActionType.INSERT_INTO_NOTE}
340+
<Button variant={ButtonStyleType.DESTRUCTIVE} on:click={() => removeAction(i)}>Remove Action</Button>
341+
342+
<SettingComponent name="Line" description="The line number to insert at.">
343+
<input type="number" bind:value={action.line} placeholder="0" />
344+
</SettingComponent>
345+
346+
<SettingComponent name="Text to Insert" description="The text to insert into the note."></SettingComponent>
347+
<div class="meta-bind-full-width meta-bind-high">
348+
<textarea bind:value={action.value}></textarea>
349+
</div>
350+
{/if}
290351
{/each}
291352

292353
<h4>Preview</h4>

0 commit comments

Comments
 (0)