Skip to content

Commit cc0f5bc

Browse files
committed
prep 1.1.1 release
1 parent 4db8f0b commit cc0f5bc

File tree

4 files changed

+33
-8
lines changed

4 files changed

+33
-8
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Obsidian Meta Bind Changelog
22

3+
# 1.1.1
4+
5+
Changes
6+
7+
- Better error messages especially for button configs
8+
- Renamed the `Enable JS Input Fields` setting to `Enable JavaScript` and it now also affects button actions that run JavaScript
9+
10+
Bug Fixes
11+
12+
- Fix settings save-load-loop when the same vault open multiple times [#311](https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues/311)
13+
- Fix the button to add a row to the meta bind table saying "add column" instead of "add row" [#331](https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues/331)
14+
- Fix inline buttons with icons not being correctly vertically aligned [#308](https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues/308)
15+
- Fix missing error message when using JS View fields but not having the corresponding setting enabled [#334](https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues/334)
16+
317
# 1.1.0
418

519
Changes

packages/core/src/fields/button/ButtonActionRunner.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,14 @@ export class ButtonActionRunner {
234234
}
235235

236236
async runJSAction(config: ButtonConfig | undefined, action: JSButtonAction, filePath: string): Promise<void> {
237+
if (!this.plugin.settings.enableJs) {
238+
throw new MetaBindJsError({
239+
errorLevel: ErrorLevel.CRITICAL,
240+
effect: "Can't run button action that requires JS evaluation.",
241+
cause: 'JS evaluation is disabled in the plugin settings.',
242+
});
243+
}
244+
237245
const configOverrides: Record<string, unknown> = {
238246
buttonConfig: structuredClone(config),
239247
args: structuredClone(action.args),
@@ -279,7 +287,7 @@ export class ButtonActionRunner {
279287
if (!this.plugin.settings.enableJs) {
280288
throw new MetaBindJsError({
281289
errorLevel: ErrorLevel.CRITICAL,
282-
effect: "Can't evaluate expression.",
290+
effect: "Can't run button action that requires JS evaluation.",
283291
cause: 'JS evaluation is disabled in the plugin settings.',
284292
});
285293
}
@@ -403,6 +411,14 @@ export class ButtonActionRunner {
403411
action: InlineJsButtonAction,
404412
filePath: string,
405413
): Promise<void> {
414+
if (!this.plugin.settings.enableJs) {
415+
throw new MetaBindJsError({
416+
errorLevel: ErrorLevel.CRITICAL,
417+
effect: "Can't run button action that requires JS evaluation.",
418+
cause: 'JS evaluation is disabled in the plugin settings.',
419+
});
420+
}
421+
406422
const configOverrides: Record<string, unknown> = {
407423
buttonConfig: structuredClone(config),
408424
};

tests/__mocks__/TestAPI.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { API } from 'packages/core/src/api/API';
2-
import { InputFieldMountable } from 'packages/core/src/fields/inputFields/InputFieldMountable';
3-
import { BindTargetScope } from 'packages/core/src/metadata/BindTargetScope';
4-
import { InputFieldDeclaration } from 'packages/core/src/parsers/inputFieldParser/InputFieldDeclaration';
5-
import { getUUID } from 'packages/core/src/utils/Utils';
62
import { TestPlugin } from './TestPlugin';
7-
import { RenderChildType } from 'packages/core/src/config/APIConfigs';
83

94
export class TestAPI extends API<TestPlugin> {
105
constructor(plugin: TestPlugin) {

tests/__mocks__/TestPlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { getUUID } from 'packages/core/src/utils/Utils';
2121
import { Metadata } from 'packages/core/src/metadata/MetadataSource';
2222
import { Signal } from 'packages/core/src/utils/Signal';
2323
import { parsePropPath } from 'packages/core/src/utils/prop/PropParser';
24-
import type { IMetadataSubscription } from 'packages/core/src/metadata/IMetadataSubscription';
2524
import { MountableManager } from 'packages/core/src/MountableManager';
2625
import { RenderChildType } from 'packages/core/src/config/APIConfigs';
2726

@@ -65,7 +64,8 @@ export class TestPlugin implements IPlugin {
6564

6665
this.mountableManager = new MountableManager();
6766

68-
this.settings = DEFAULT_SETTINGS;
67+
this.settings = structuredClone(DEFAULT_SETTINGS);
68+
this.settings.enableJs = true;
6969

7070
DateParser.dateFormat = this.settings.preferredDateFormat;
7171
setFirstWeekday(this.settings.firstWeekday);

0 commit comments

Comments
 (0)