Skip to content

Commit 70ec2e6

Browse files
committed
chore(capture): apply review polish
1 parent d852c29 commit 70ec2e6

File tree

5 files changed

+3
-44
lines changed

5 files changed

+3
-44
lines changed

src/engine/canvasCapture.test.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { describe, expect, it } from "vitest";
22
import type { App } from "obsidian";
33
import {
4-
applyCaptureToCanvasTextNode,
54
getCanvasActionUnsupportedReason,
65
getCanvasTextCaptureContent,
76
mergeCanvasTextAtBottom,
@@ -260,28 +259,6 @@ describe("canvasCapture", () => {
260259
expect(mergeCanvasTextAtBottom("line1\n", "line2")).toBe("line1\nline2");
261260
});
262261

263-
it("applies capture to text nodes via setText when available", () => {
264-
let lastValue = "";
265-
const target = {
266-
kind: "text",
267-
source: "active",
268-
canvas: {
269-
requestSave: () => {},
270-
},
271-
canvasFile: { path: "Canvas.canvas", basename: "Canvas" },
272-
node: {
273-
type: "text",
274-
text: "existing",
275-
setText: (value: string) => {
276-
lastValue = value;
277-
},
278-
},
279-
nodeData: null,
280-
} as const;
281-
282-
applyCaptureToCanvasTextNode(target as any, "capture", "activeFileTop");
283-
expect(lastValue).toBe("capture\nexisting");
284-
});
285262

286263
it("reports unsupported reasons by action", () => {
287264
expect(

src/engine/canvasCapture.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -436,22 +436,3 @@ export function mergeCanvasTextAtBottom(
436436
return `${existingText}${needsSeparator ? "\n" : ""}${captureContent}`;
437437
}
438438

439-
export function applyCaptureToCanvasTextNode(
440-
target: Extract<CanvasCaptureTarget, { kind: "text" }>,
441-
captureContent: string,
442-
action: CaptureAction,
443-
): void {
444-
const existingText = getCanvasTextCaptureContent(target);
445-
const nextText =
446-
action === "activeFileTop"
447-
? mergeCanvasTextAtTop(existingText, captureContent)
448-
: mergeCanvasTextAtBottom(existingText, captureContent);
449-
450-
if (typeof target.node.setText === "function") {
451-
target.node.setText(nextText);
452-
} else {
453-
target.node.text = nextText;
454-
}
455-
456-
target.canvas.requestSave?.();
457-
}

src/formatters/captureChoiceFormatter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ export class CaptureChoiceFormatter extends CompleteFormatter {
120120
const formattedContentIsEmpty = formatted.trim() === "";
121121
if (formattedContentIsEmpty) return this.fileContent;
122122

123+
// Historical note: `prepend` is a legacy flag name that means
124+
// append-to-bottom behavior.
123125
const shouldAppendToBottom =
124126
this.choice.prepend ||
125127
(this.choice.captureToActiveFile &&

src/gui/ChoiceBuilder/captureChoiceBuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ export class CaptureChoiceBuilder extends ChoiceBuilder {
440440
const canvasFile = this.resolveStaticCanvasTargetFile(canvasTargetPath);
441441
if (!canvasFile) {
442442
renderEmpty(
443-
"Node picker works for direct .canvas file paths that exist in your vault.",
443+
"Node picker works for direct .canvas paths that already exist in your vault. Format syntax paths cannot be listed here.",
444444
);
445445
return;
446446
}

src/styles.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@
209209
background: var(--background-primary);
210210
}
211211

212-
213212
.checkboxRowContainer {
214213
margin: 30px 0px;
215214
display: grid;

0 commit comments

Comments
 (0)