Skip to content

Commit 192a50b

Browse files
committed
fix #431
1 parent efa6f70 commit 192a50b

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
</div>
2727

2828
<ModalButtonGroup>
29-
<Button variant={ButtonStyleType.PRIMARY} onclick={() => options.onSubmit(value)}>OK</Button>
29+
<Button variant={ButtonStyleType.PRIMARY} onclick={() => options.onSubmit($state.snapshot(value))}>OK</Button>
3030
<Button onclick={() => options.onCancel()}>Cancel</Button>
3131
</ModalButtonGroup>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ Add action of type
268268
<div bind:this={buttonEl}></div>
269269

270270
<ModalButtonGroup>
271-
<Button variant={ButtonStyleType.PRIMARY} onclick={() => modal.okay(buttonConfig)}
271+
<Button variant={ButtonStyleType.PRIMARY} onclick={() => modal.okay($state.snapshot(buttonConfig))}
272272
>{modal.options.submitText}</Button
273273
>
274274
<Button variant={ButtonStyleType.DEFAULT} onclick={() => modal.cancel()}>Cancel</Button>

packages/obsidian/src/settings/buttonTemplateSetting/ButtonTemplateSettingComponent.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
function editTemplate(): void {
2121
plugin.internal.openButtonBuilderModal({
2222
submitText: 'Submit',
23-
config: structuredClone(template),
23+
config: $state.snapshot(template),
2424
onOkay: newTemplate => {
2525
template = newTemplate;
2626
},
2727
});
2828
}
2929
3030
function copyTemplate(): void {
31-
const yaml = stringifyYaml(template);
31+
const yaml = stringifyYaml($state.snapshot(template));
3232
void navigator.clipboard.writeText(yaml);
3333
new Notice('meta-bind | Copied to clipboard');
3434
}

packages/obsidian/src/settings/buttonTemplateSetting/ButtonTemplatesSettingComponent.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
}
7575
7676
function save(): void {
77-
errorCollection = modal.save(buttonConfigs);
77+
errorCollection = modal.save($state.snapshot(buttonConfigs));
7878
7979
if (errorCollection === undefined) {
8080
modal.close();

packages/obsidian/src/settings/excludedFoldersSetting/ExcludedFoldersSettingComponent.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
let {
1212
plugin,
1313
modal,
14-
excludedFolders,
14+
excludedFolders: propExcludedFolders,
1515
}: {
1616
plugin: IPlugin;
1717
modal: ExcludedFoldersSettingModal;
1818
excludedFolders: string[];
1919
} = $props();
2020
2121
let errorCollection: ErrorCollection | undefined = $state();
22+
let excludedFolders: string[] = $state(propExcludedFolders);
2223
2324
function deleteFolder(name: string): void {
2425
excludedFolders = excludedFolders.filter(x => x !== name);
@@ -29,7 +30,7 @@
2930
}
3031
3132
function save(): void {
32-
errorCollection = modal.save(excludedFolders);
33+
errorCollection = modal.save($state.snapshot(excludedFolders));
3334
3435
if (errorCollection === undefined) {
3536
modal.close();

packages/obsidian/src/settings/inputFieldTemplateSetting/InputFieldTemplatesSettingComponent.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
}
3232
3333
function save(): void {
34-
errorCollection = modal.save(inputFieldTemplates);
34+
errorCollection = modal.save($state.snapshot(inputFieldTemplates));
3535
3636
if (errorCollection === undefined) {
3737
modal.close();

0 commit comments

Comments
 (0)