diff --git a/src/editor/Editor.tsx b/src/editor/Editor.tsx index 1cc93cc..bde5dac 100644 --- a/src/editor/Editor.tsx +++ b/src/editor/Editor.tsx @@ -40,7 +40,8 @@ export function Editor({ chapterId, content, onChange, onReady }: EditorProps) { const scroller = editor.view.dom.closest(".editor-pane") as HTMLElement | null; const previous = openChapter.current; - if (previous !== chapterId) { + const switching = previous !== chapterId; + if (switching) { const { from, to } = editor.state.selection; positions.current.set(previous, { from, to, scroll: scroller?.scrollTop ?? 0 }); } @@ -50,9 +51,12 @@ export function Editor({ chapterId, content, onChange, onReady }: EditorProps) { const saved = positions.current.get(chapterId); const size = editor.state.doc.content.size; - editor.commands.setTextSelection( - saved ? { from: Math.min(saved.from, size), to: Math.min(saved.to, size) } : 0 - ); + const selection = saved ? { from: Math.min(saved.from, size), to: Math.min(saved.to, size) } : 0; + if (switching) { + editor.chain().setTextSelection(selection).focus(undefined, { scrollIntoView: false }).run(); + } else { + editor.commands.setTextSelection(selection); + } if (scroller) { const top = saved?.scroll ?? 0; diff --git a/vite.config.ts b/vite.config.ts index ddad22a..aed09f1 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -26,7 +26,7 @@ export default defineConfig(async () => ({ : undefined, watch: { // 3. tell Vite to ignore watching `src-tauri` - ignored: ["**/src-tauri/**"], + ignored: ["**/src-tauri/**", "**/website/**"], }, }, })); diff --git a/website/astro.config.mjs b/website/astro.config.mjs index 59cf5ac..ef24b5e 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -3,5 +3,5 @@ import { defineConfig } from "astro/config"; // The canonical URL is only used for absolute links (OG tags, sitemap). // Change it to the real domain when the site goes live. export default defineConfig({ - site: "https://margin.studio", + site: "https://margin.73ai.org", }); diff --git a/website/src/data/site.ts b/website/src/data/site.ts index 4f3ec0b..a9d00d1 100644 --- a/website/src/data/site.ts +++ b/website/src/data/site.ts @@ -5,7 +5,7 @@ export const site = { tagline: "Write your book. Own every word.", description: "Margin is a calm, offline writing studio for authors. Write your book and send it to print and to every ebook store, all from your own machine. Buy once, own it forever.", - domain: "https://margin.studio", + domain: "https://margin.73ai.org", // The regular one-time price, shown struck through during the launch offer. price: "$10",