Skip to content

Studio document-editor layout, typography, and writing features#5

Closed
bnz183 wants to merge 1 commit into
split/03-launch-docsfrom
split/04-studio-editor
Closed

Studio document-editor layout, typography, and writing features#5
bnz183 wants to merge 1 commit into
split/03-launch-docsfrom
split/04-studio-editor

Conversation

@bnz183

@bnz183 bnz183 commented Jun 9, 2026

Copy link
Copy Markdown
Owner

PR 4 of 11. Document-editor refactor, IBM Plex, autosave, toolbar, post list, media library, internal linking.

res.status(result.status).json(result.body);
});

app.get("/api/media", requireAuth, async (_req, res) => {

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be22b69b60

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/studio/src/App.tsx
Comment on lines +185 to +188
} = useDocumentAutosave({
snapshot: documentSnapshot,
publishing,
enabled: authenticated && view === "editor",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Rebaseline autosave after loading project config

When the project config loads, the effect above can replace the initial fallback form with createInitialFormState(config.categories[0]), but this autosave hook has already captured its baseline from the fallback snapshot. In any project whose first configured category differs from the fallback Guides, an untouched editor becomes dirty immediately, triggers the beforeunload warning, and writes a blank local draft/restore prompt after the debounce. Defer enabling autosave until the config-backed form is established or call commitBaseline when applying the loaded config.

Useful? React with 👍 / 👎.


files.push({
repoPath: safe.path,
publicPath: joinPublicMediaPath(env.publicMediaPath, filename),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve subfolders when building media URLs

When the media library includes files inside subdirectories of mediaDir, publisher.listFiles recurses into those directories but this line builds the public URL from only the basename. For example, public/images/posts/photo.png is shown/inserted as /images/photo.png instead of /images/posts/photo.png, so choosing existing nested media creates broken cover images or Markdown links. Build the public path from the path relative to mediaDir, not just filename.

Useful? React with 👍 / 👎.

Comment on lines +97 to +99
const path =
latestImagePath?.trim() ||
window.prompt("Image path (public URL or repo path)", "/images/")?.trim() ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope cached image paths to the current post

After any image upload, the toolbar silently prefers latestImagePath over prompting. If a writer uploads an image for one post, then opens or creates another post in the same session and clicks the Image toolbar button, it inserts the previous post's image without confirmation. Clear this cached path when switching documents or require the user to confirm/select the image before insertion.

Useful? React with 👍 / 👎.

Comment thread apps/studio/src/App.tsx
Comment on lines +408 to +409
onOpenSettings={() =>
setView((current) => (current === "settings" ? "editor" : "settings"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep draft protection active in Settings

If a writer has unsaved editor changes and opens Settings, this view switch disables useDocumentAutosave because it is only enabled for view === "editor"; that removes the beforeunload guard and can also cancel the pending debounce. Closing or reloading the tab from Settings then loses recent edits without warning, even though the draft is still in memory. Keep autosave/unload protection enabled while Settings is open or flush the draft before switching views.

Useful? React with 👍 / 👎.

@bnz183

bnz183 commented Jun 9, 2026

Copy link
Copy Markdown
Owner Author

Closing retroactive split-stack review PR. Continuing from protected main with scoped feature PRs.

@bnz183 bnz183 closed this Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants