Skip to content

Commit 60daf80

Browse files
committed
Revert "fix: wire up annotateFilePath state for linked doc base resolution"
This reverts commit 502c324.
1 parent 502c324 commit 60daf80

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

packages/editor/App.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ const App: React.FC = () => {
393393
const [origin, setOrigin] = useState<'claude-code' | 'opencode' | 'pi' | null>(null);
394394
const [globalAttachments, setGlobalAttachments] = useState<ImageAttachment[]>([]);
395395
const [annotateMode, setAnnotateMode] = useState(false);
396-
const [annotateFilePath, setAnnotateFilePath] = useState<string | null>(null);
397396
const [isLoading, setIsLoading] = useState(true);
398397
const [isSubmitting, setIsSubmitting] = useState(false);
399398
const [submitted, setSubmitted] = useState<'approved' | 'denied' | null>(null);
@@ -510,7 +509,7 @@ const App: React.FC = () => {
510509
// Pass the current file's directory as base for relative path resolution
511510
const baseDir = linkedDocHook.filepath
512511
? linkedDocHook.filepath.replace(/\/[^/]+$/, '')
513-
: annotateFilePath ? annotateFilePath.replace(/\/[^/]+$/, '') : undefined;
512+
: imageBaseDir;
514513
if (baseDir) {
515514
linkedDocHook.open(docPath, (path) =>
516515
`/api/doc?path=${encodeURIComponent(path)}&base=${encodeURIComponent(baseDir)}`
@@ -519,7 +518,7 @@ const App: React.FC = () => {
519518
linkedDocHook.open(docPath);
520519
}
521520
}
522-
}, [vaultBrowser.activeFile, vaultPath, linkedDocHook, buildVaultDocUrl, annotateFilePath]);
521+
}, [vaultBrowser.activeFile, vaultPath, linkedDocHook, buildVaultDocUrl, imageBaseDir]);
523522

524523
// Wrap linked doc back to also clear vault active file
525524
const handleLinkedDocBack = React.useCallback(() => {
@@ -635,12 +634,11 @@ const App: React.FC = () => {
635634
if (!res.ok) throw new Error('Not in API mode');
636635
return res.json();
637636
})
638-
.then((data: { plan: string; origin?: 'claude-code' | 'opencode' | 'pi'; mode?: 'annotate'; filePath?: string; sharingEnabled?: boolean; shareBaseUrl?: string; pasteApiUrl?: string; repoInfo?: { display: string; branch?: string }; previousPlan?: string | null; versionInfo?: { version: number; totalVersions: number; project: string } }) => {
637+
.then((data: { plan: string; origin?: 'claude-code' | 'opencode' | 'pi'; mode?: 'annotate'; sharingEnabled?: boolean; shareBaseUrl?: string; pasteApiUrl?: string; repoInfo?: { display: string; branch?: string }; previousPlan?: string | null; versionInfo?: { version: number; totalVersions: number; project: string } }) => {
639638
if (data.plan) setMarkdown(data.plan);
640639
setIsApiMode(true);
641640
if (data.mode === 'annotate') {
642641
setAnnotateMode(true);
643-
if (data.filePath) setAnnotateFilePath(data.filePath);
644642
}
645643
if (data.sharingEnabled !== undefined) {
646644
setSharingEnabled(data.sharingEnabled);

0 commit comments

Comments
 (0)