Skip to content

Commit 7640f73

Browse files
committed
correct formatting
1 parent f1d234c commit 7640f73

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

src/main.ts

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
import { App, Component, debounce, MarkdownPostProcessorContext, MarkdownView, Plugin, PluginSettingTab, Setting } from "obsidian";
1+
import {
2+
App,
3+
Component,
4+
debounce,
5+
MarkdownPostProcessorContext,
6+
MarkdownView,
7+
Plugin,
8+
PluginSettingTab,
9+
Setting,
10+
} from "obsidian";
211
import { renderErrorPre } from "ui/render";
312
import { FullIndex } from "data-index/index";
413
import { parseField } from "expression/parse";
@@ -11,7 +20,11 @@ import { currentLocale } from "util/locale";
1120
import { DateTime } from "luxon";
1221
import { DataviewInlineApi } from "api/inline-api";
1322
import { replaceInlineFields } from "ui/views/inline-field";
14-
import { inlineFieldsField, replaceInlineFieldsInLivePreview, workspaceLayoutChangeEffect } from "./ui/views/inline-field-live-preview";
23+
import {
24+
inlineFieldsField,
25+
replaceInlineFieldsInLivePreview,
26+
workspaceLayoutChangeEffect,
27+
} from "./ui/views/inline-field-live-preview";
1528
import { DataviewInit } from "ui/markdown";
1629
import { inlinePlugin } from "./ui/lp-render";
1730
import { Extension } from "@codemirror/state";
@@ -124,15 +137,15 @@ export default class DataviewPlugin extends Plugin {
124137
// Mainly intended to detect when the user switches between live preview and source mode.
125138
this.registerEvent(
126139
this.app.workspace.on("layout-change", () => {
127-
this.app.workspace.iterateAllLeaves((leaf) => {
140+
this.app.workspace.iterateAllLeaves(leaf => {
128141
if (leaf.view instanceof MarkdownView && leaf.view.editor.cm) {
129142
leaf.view.editor.cm.dispatch({
130-
effects: workspaceLayoutChangeEffect.of(null)
131-
})
143+
effects: workspaceLayoutChangeEffect.of(null),
144+
});
132145
}
133-
})
146+
});
134147
})
135-
)
148+
);
136149
this.registerEditorExtension(inlineFieldsField);
137150
this.registerEditorExtension(replaceInlineFieldsInLivePreview(this.app, this.settings));
138151
}

src/typings/obsidian-ex.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ declare module "obsidian" {
2727

2828
interface Editor {
2929
/**
30-
* CodeMirror editor instance
31-
*/
32-
cm?: EditorView;
30+
* CodeMirror editor instance
31+
*/
32+
cm?: EditorView;
3333
}
3434
}
3535

src/ui/views/inline-field-live-preview.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,14 @@ export const replaceInlineFieldsInLivePreview = (app: App, settings: DataviewSet
6767

6868
this.overlappingIndices = newIndices;
6969

70-
const layoutChanged = update.transactions.some(
71-
transaction => transaction.effects.some(
72-
effect => effect.is(workspaceLayoutChangeEffect)
73-
)
70+
const layoutChanged = update.transactions.some(transaction =>
71+
transaction.effects.some(effect => effect.is(workspaceLayoutChangeEffect))
7472
);
7573

7674
if (update.state.field(editorLivePreviewField)) {
7775
if (update.docChanged || update.viewportChanged || layoutChanged || overlapChanged) {
7876
this.decorations = this.buildDecoration(update.view);
79-
}
77+
}
8078
} else {
8179
this.decorations = Decoration.none;
8280
}
@@ -179,7 +177,7 @@ class InlineFieldWidget extends WidgetType {
179177
});
180178
renderValue(
181179
parseInlineValue(this.field.value),
182-
value,
180+
value,
183181
this.sourcePath,
184182
this.parentComponent,
185183
this.settings,
@@ -192,7 +190,7 @@ class InlineFieldWidget extends WidgetType {
192190
});
193191
renderValue(
194192
parseInlineValue(this.field.value),
195-
value,
193+
value,
196194
this.sourcePath,
197195
this.parentComponent,
198196
this.settings,
@@ -226,7 +224,7 @@ export async function renderMarkdown(
226224
return null;
227225
}
228226

229-
/**
227+
/**
230228
* A state effect that represents the workspace's layout change.
231229
* Mainly intended to detect when the user switches between live preview and source mode.
232230
*/

0 commit comments

Comments
 (0)