This commit is contained in:
pj committed 2026-06-22 11:56:31 -04:00
1 parent 67f70473ea
commit 19c4823d3d
4 files changed
+11 -7

No files matched your search

+8 -4
View File
@@ -40,7 +40,8 @@ export function Editor({ chapterId, content, onChange, onReady }: EditorProps) {
const scroller = editor.view.dom.closest(".editor-pane") as HTMLElement | null; const scroller = editor.view.dom.closest(".editor-pane") as HTMLElement | null;
const previous = openChapter.current; const previous = openChapter.current;
if (previous !== chapterId) { const switching = previous !== chapterId;
if (switching) {
const { from, to } = editor.state.selection; const { from, to } = editor.state.selection;
positions.current.set(previous, { from, to, scroll: scroller?.scrollTop ?? 0 }); 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 saved = positions.current.get(chapterId);
const size = editor.state.doc.content.size; const size = editor.state.doc.content.size;
editor.commands.setTextSelection( const selection = saved ? { from: Math.min(saved.from, size), to: Math.min(saved.to, size) } : 0;
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) { if (scroller) {
const top = saved?.scroll ?? 0; const top = saved?.scroll ?? 0;
+1 -1
View File
@@ -26,7 +26,7 @@ export default defineConfig(async () => ({
: undefined, : undefined,
watch: { watch: {
// 3. tell Vite to ignore watching `src-tauri` // 3. tell Vite to ignore watching `src-tauri`
ignored: ["**/src-tauri/**"], ignored: ["**/src-tauri/**", "**/website/**"],
}, },
}, },
})); }));
+1 -1
View File
@@ -3,5 +3,5 @@ import { defineConfig } from "astro/config";
// The canonical URL is only used for absolute links (OG tags, sitemap). // The canonical URL is only used for absolute links (OG tags, sitemap).
// Change it to the real domain when the site goes live. // Change it to the real domain when the site goes live.
export default defineConfig({ export default defineConfig({
site: "https://margin.studio", site: "https://margin.73ai.org",
}); });
+1 -1
View File
@@ -5,7 +5,7 @@ export const site = {
tagline: "Write your book. Own every word.", tagline: "Write your book. Own every word.",
description: 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.", "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. // The regular one-time price, shown struck through during the launch offer.
price: "$10", price: "$10",