toJson() => {
+ 'email': email.toJson(),
+ 'emailTypes': ?emailTypes?.map((e) => e.toJson()).toList(),
+ };
}
enum AdminStatsScope {
diff --git a/Server/internal/api/api.gen.go b/Server/internal/api/api.gen.go
index d26a24d..9fc9bf0 100644
--- a/Server/internal/api/api.gen.go
+++ b/Server/internal/api/api.gen.go
@@ -1233,6 +1233,9 @@ type NotificationList struct {
type NotificationSettings struct {
// Email Unread notifications by email every few minutes
Email NotificationSettingsEmail `json:"email"`
+
+ // EmailTypes The notification types the email digest includes (the others only reach the inbox). Always sent back; leave it out when saving to keep it as it is.
+ EmailTypes *[]NotificationType `json:"emailTypes,omitempty"`
}
// NotificationSettingsEmail Unread notifications by email every few minutes
diff --git a/Server/internal/convert/docx_export.go b/Server/internal/convert/docx_export.go
index b92ac2d..ac5ecf2 100644
--- a/Server/internal/convert/docx_export.go
+++ b/Server/internal/convert/docx_export.go
@@ -385,13 +385,10 @@ func (w *docxWriter) block(n Node, ctx blockCtx) {
w.para(paraProps{}, func() { w.text(label, runProps{italic: true, href: w.link(n.attr("src"))}) })
case "fileAttachment":
w.para(paraProps{}, func() { w.text(n.attr("name"), runProps{href: w.link(n.attr("url"))}) })
- case "embed", "linkCard":
- title := n.attr("title")
- if title == "" {
- title = n.attr("url")
- }
+ case "embed", "linkCard", "syncedPage":
+ href, title := n.card()
w.para(paraProps{}, func() {
- w.text(title, runProps{href: w.link(n.attr("url"))})
+ w.text(title, runProps{href: w.link(href)})
if d := n.attr("description"); d != "" {
w.b.WriteString("")
w.text(d, runProps{color: "787878"})
diff --git a/Server/internal/convert/export.go b/Server/internal/convert/export.go
index 5372621..f5fb90b 100644
--- a/Server/internal/convert/export.go
+++ b/Server/internal/convert/export.go
@@ -180,15 +180,12 @@ func writeHTML(b *strings.Builder, n Node, o Options) {
}
}
b.WriteString("\n")
- case "embed", "linkCard":
- href := n.attr("url")
+ case "embed", "linkCard", "syncedPage":
+ href, title := n.card()
+ href = o.file(href)
if !safeURL.MatchString(href) {
return
}
- title := n.attr("title")
- if title == "" {
- title = href
- }
fmt.Fprintf(b, "%s", html.EscapeString(href), html.EscapeString(title))
if d := n.attr("description"); d != "" {
fmt.Fprintf(b, "
%s", html.EscapeString(d))
@@ -407,15 +404,12 @@ func (w *mdWriter) block(n Node, first, rest string) {
}
w.b.WriteString(strings.TrimRight(rest, " ") + "\n")
w.lines("", rest, rest)
- case "embed", "linkCard":
- href := n.attr("url")
+ case "embed", "linkCard", "syncedPage":
+ href, title := n.card()
+ href = w.o.file(href)
if !safeURL.MatchString(href) {
return
}
- title := n.attr("title")
- if title == "" {
- title = href
- }
line := "[" + escapeMD(title) + "](" + mdURL(href) + ")"
if d := n.attr("description"); d != "" {
line += " — " + escapeMD(d)
diff --git a/Server/internal/convert/export_test.go b/Server/internal/convert/export_test.go
index fa87404..9ed91be 100644
--- a/Server/internal/convert/export_test.go
+++ b/Server/internal/convert/export_test.go
@@ -81,3 +81,28 @@ func TestTogglesEmbedsAndPageLinks(t *testing.T) {
t.Fatalf("details did not round-trip: %+v", d)
}
}
+
+func TestSyncedPageExportsAsPageLink(t *testing.T) {
+ doc, err := Parse([]byte(`{"type":"doc","content":[
+ {"type":"syncedPage","attrs":{"page":"abc123","title":"Plan","icon":"📋"}},
+ {"type":"syncedPage","attrs":{"page":"def456"}}]}`))
+ if err != nil {
+ t.Fatal(err)
+ }
+ o := Options{PageURL: func(id, frag string) string { return "../" + id + ".md" + frag }}
+ md := Markdown(doc, o)
+ for _, want := range []string{"[📋 Plan](../abc123.md)", "[Synced page](../def456.md)"} {
+ if !strings.Contains(md, want) {
+ t.Errorf("markdown lacks %q:\n%s", want, md)
+ }
+ }
+ if h := HTML(doc, Options{}); !strings.Contains(h, `📋 Plan`) {
+ t.Errorf("html lacks the page link:\n%s", h)
+ }
+ if _, err := PDF("T", doc, PDFOptions{}); err != nil {
+ t.Errorf("pdf: %v", err)
+ }
+ if _, err := DOCX("T", doc, DOCXOptions{}); err != nil {
+ t.Errorf("docx: %v", err)
+ }
+}
diff --git a/Server/internal/convert/node.go b/Server/internal/convert/node.go
index c0ea9a3..e1d48c8 100644
--- a/Server/internal/convert/node.go
+++ b/Server/internal/convert/node.go
@@ -42,6 +42,27 @@ func (n Node) attr(key string) string {
return ""
}
+// card is the address and title of a block that links somewhere: an embed,
+// a link card, or a synced page (shown as a link to the page it shows).
+func (n Node) card() (href, title string) {
+ if n.Type == "syncedPage" {
+ href = "/p/" + n.attr("page")
+ title = n.attr("title")
+ if icon := n.attr("icon"); icon != "" && title != "" {
+ title = icon + " " + title
+ }
+ if title == "" {
+ title = "Synced page"
+ }
+ return href, title
+ }
+ href, title = n.attr("url"), n.attr("title")
+ if title == "" {
+ title = href
+ }
+ return href, title
+}
+
func (n Node) intAttr(key string, def int) int {
if v, ok := n.Attrs[key].(float64); ok {
return int(v)
diff --git a/Server/internal/convert/pdf.go b/Server/internal/convert/pdf.go
index 29a75d9..2148b32 100644
--- a/Server/internal/convert/pdf.go
+++ b/Server/internal/convert/pdf.go
@@ -325,12 +325,9 @@ func (w *pdfWriter) block(n Node, indent, gap float64) {
w.inline(n.Content, "B", pdfBody)
w.f.Ln(pdfLine)
w.f.Ln(pdfTightGap)
- case "embed", "linkCard":
- title := n.attr("title")
- if title == "" {
- title = n.attr("url")
- }
- w.note(title, n.attr("url"), indent)
+ case "embed", "linkCard", "syncedPage":
+ href, title := n.card()
+ w.note(title, href, indent)
if d := n.attr("description"); d != "" {
w.at(indent)
w.f.SetFont("go", "", 10)
diff --git a/Server/internal/directory/notify.go b/Server/internal/directory/notify.go
index fad12b1..c69d5c9 100644
--- a/Server/internal/directory/notify.go
+++ b/Server/internal/directory/notify.go
@@ -8,6 +8,7 @@ import (
"fmt"
"log/slog"
"net/url"
+ "slices"
"sort"
"strings"
"time"
@@ -502,29 +503,64 @@ func (s *Service) MarkNotificationsRead(ctx context.Context, c access.Caller, id
type NotificationSettings struct {
// Email is "digest" (unread notifications by email every few minutes) or "off".
Email string `json:"email"`
+ // EmailTypes are the notification types the digest includes; the others
+ // only reach the inbox. Nil when setting means "leave as it is".
+ EmailTypes []string `json:"emailTypes"`
+}
+
+// notificationTypes are every type a notification can have, in menu order.
+var notificationTypes = []string{"mention", "comment", "reply", "resolved", "share", "reminder"}
+
+// emailTypes is every notification type except the ones turned off.
+func emailTypes(off []string) []string {
+ out := []string{}
+ for _, t := range notificationTypes {
+ if !slices.Contains(off, t) {
+ out = append(out, t)
+ }
+ }
+ return out
+}
+
+type notifyPrefs struct {
+ NotifyEmail string `json:"notify_email"`
+ NotifyEmailOff []string `json:"notify_email_off"`
}
func (s *Service) GetNotificationSettings(ctx context.Context, c access.Caller) (NotificationSettings, error) {
- r, err := pocketbase.Get[struct {
- NotifyEmail string `json:"notify_email"`
- }](ctx, s.pb, "users", c.ID)
+ r, err := pocketbase.Get[notifyPrefs](ctx, s.pb, "users", c.ID)
if err != nil {
return NotificationSettings{}, mapPB(err, "user not found")
}
if r.NotifyEmail != "off" {
r.NotifyEmail = "digest"
}
- return NotificationSettings{Email: r.NotifyEmail}, nil
+ return NotificationSettings{Email: r.NotifyEmail, EmailTypes: emailTypes(r.NotifyEmailOff)}, nil
}
func (s *Service) SetNotificationSettings(ctx context.Context, c access.Caller, in NotificationSettings) (NotificationSettings, error) {
if in.Email != "digest" && in.Email != "off" {
return NotificationSettings{}, apperr.InvalidFields(map[string]string{"email": "Choose digest or off."})
}
- if _, err := pocketbase.Update[struct{}](ctx, s.pb, "users", c.ID, map[string]any{"notify_email": in.Email}); err != nil {
+ patch := map[string]any{"notify_email": in.Email}
+ if in.EmailTypes != nil {
+ off := []string{}
+ for _, t := range in.EmailTypes {
+ if !slices.Contains(notificationTypes, t) {
+ return NotificationSettings{}, apperr.InvalidFields(map[string]string{"emailTypes": "Unknown notification type " + t + "."})
+ }
+ }
+ for _, t := range notificationTypes {
+ if !slices.Contains(in.EmailTypes, t) {
+ off = append(off, t)
+ }
+ }
+ patch["notify_email_off"] = off
+ }
+ if _, err := pocketbase.Update[struct{}](ctx, s.pb, "users", c.ID, patch); err != nil {
return NotificationSettings{}, mapPB(err, "user not found")
}
- return in, nil
+ return s.GetNotificationSettings(ctx, c)
}
// ---- Email digest ----------------------------------------------------------
@@ -601,14 +637,19 @@ func (s *Service) SendDigests(ctx context.Context) error {
var firstErr error
for userID, list := range byUser {
u, err := pocketbase.Get[struct {
- Email string `json:"email"`
- Name string `json:"name"`
- Status string `json:"status"`
- NotifyEmail string `json:"notify_email"`
+ Email string `json:"email"`
+ Name string `json:"name"`
+ Status string `json:"status"`
+ NotifyEmail string `json:"notify_email"`
+ NotifyEmailOff []string `json:"notify_email_off"`
}](ctx, s.pb, "users", userID)
if err == nil && u.NotifyEmail != "off" && u.Status != "disabled" {
var items []digestItem
for _, n := range list {
+ // Types turned off stay in the inbox only (and are marked below).
+ if slices.Contains(u.NotifyEmailOff, n.Type) {
+ continue
+ }
if it, ok := s.digestLine(ctx, n, who); ok {
items = append(items, it)
}
diff --git a/Server/internal/directory/notify_test.go b/Server/internal/directory/notify_test.go
index 9772724..35060e4 100644
--- a/Server/internal/directory/notify_test.go
+++ b/Server/internal/directory/notify_test.go
@@ -67,3 +67,14 @@ func TestLinkIDs(t *testing.T) {
t.Fatalf("empty document should give an empty list, got %v", ids)
}
}
+
+func TestEmailTypesLeaveOutTheOnesTurnedOff(t *testing.T) {
+ got := emailTypes([]string{"comment", "share"})
+ want := []string{"mention", "reply", "resolved", "reminder"}
+ if strings.Join(got, ",") != strings.Join(want, ",") {
+ t.Errorf("emailTypes = %v, want %v", got, want)
+ }
+ if len(emailTypes(nil)) != len(notificationTypes) {
+ t.Error("nothing turned off should email every type")
+ }
+}
diff --git a/Server/internal/pbschema/schema.json b/Server/internal/pbschema/schema.json
index 06daf7f..7e6e2c0 100644
--- a/Server/internal/pbschema/schema.json
+++ b/Server/internal/pbschema/schema.json
@@ -307,6 +307,17 @@
"required": false,
"system": false,
"type": "json"
+ },
+ {
+ "help": "",
+ "hidden": false,
+ "id": "json3607448351",
+ "maxSize": 2000,
+ "name": "notify_email_off",
+ "presentable": false,
+ "required": false,
+ "system": false,
+ "type": "json"
}
],
"fileToken": {
diff --git a/Web-App/frontend/src/App.vue b/Web-App/frontend/src/App.vue
index 9dfc7d3..ec01774 100644
--- a/Web-App/frontend/src/App.vue
+++ b/Web-App/frontend/src/App.vue
@@ -1,11 +1,24 @@
diff --git a/Web-App/frontend/src/components/AppLayout.vue b/Web-App/frontend/src/components/AppLayout.vue
index 54cff3c..0692a2a 100644
--- a/Web-App/frontend/src/components/AppLayout.vue
+++ b/Web-App/frontend/src/components/AppLayout.vue
@@ -7,6 +7,8 @@ import { useRoute, useRouter } from "vue-router";
import { clearFileToken } from "../composables/useFiles";
import { useFormErrors } from "../composables/useFormErrors";
import { onCommand } from "../lib/commands";
+import { pageOfHref, useSplit } from "../composables/useSplit";
+import PageView from "../views/page/PageView.vue";
import { SIDEBAR_DEFAULT, clampWidth, useSidebar } from "../composables/useSidebar";
import { useAuthStore } from "../stores/auth";
import { useFavoritesStore } from "../stores/favorites";
@@ -61,7 +63,8 @@ watch(
() => (sidebar.mobileOpen.value = false),
);
-// Ctrl+/ (Cmd+/ on macOS) folds the sidebar, as in other editors; Ctrl+K searches.
+// Ctrl+/ (Cmd+/ on macOS) folds the sidebar, as in other editors; Ctrl+K
+// searches. (Back and forward are in App.vue.)
function onKey(e: KeyboardEvent) {
if ((e.ctrlKey || e.metaKey) && e.key === "/") {
e.preventDefault();
@@ -74,6 +77,37 @@ function onKey(e: KeyboardEvent) {
onMounted(() => document.addEventListener("keydown", onKey));
onBeforeUnmount(() => document.removeEventListener("keydown", onKey));
+// Split view: Alt+click (Option on macOS) on any link to a page opens it
+// beside the main view, on screens wide enough for two pages.
+const split = useSplit();
+const wide = ref(true);
+let wideQuery: MediaQueryList | null = null;
+const onWide = () => (wide.value = !!wideQuery?.matches);
+function onLinkClick(e: MouseEvent) {
+ if (!e.altKey || e.button !== 0 || !wide.value) return;
+ const a = (e.target as Element | null)?.closest?.("a[href]");
+ const id = a ? pageOfHref(a.getAttribute("href") ?? "") : "";
+ if (!id) return;
+ e.preventDefault();
+ e.stopPropagation();
+ split.open(id);
+}
+onMounted(() => {
+ wideQuery = window.matchMedia("(min-width: 1024px)");
+ onWide();
+ wideQuery.addEventListener("change", onWide);
+ document.addEventListener("click", onLinkClick, true);
+});
+onBeforeUnmount(() => {
+ wideQuery?.removeEventListener("change", onWide);
+ document.removeEventListener("click", onLinkClick, true);
+});
+function openSplitHere() {
+ const id = split.page.value;
+ split.close();
+ router.push({ name: "page", params: { id } });
+}
+
// The desktop app's menu bar sends the same actions.
const stopCommands = onCommand((c) => {
if (c === "search") searchOpen.value = true;
@@ -487,8 +521,41 @@ function signOut() {
/>
-
diff --git a/Web-App/frontend/src/composables/useSplit.ts b/Web-App/frontend/src/composables/useSplit.ts
new file mode 100644
index 0000000..d22b69e
--- /dev/null
+++ b/Web-App/frontend/src/composables/useSplit.ts
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import { ref } from "vue";
+
+const key = "docwell.split";
+function remembered(): string {
+ try {
+ return sessionStorage.getItem(key) ?? "";
+ } catch {
+ return "";
+ }
+}
+
+// One split pane for the whole app, kept while navigating the main view
+// and across reloads of the tab.
+const page = ref(remembered());
+
+/** The page shown beside the main view (split view), if any. */
+export function useSplit() {
+ function set(id: string) {
+ page.value = id;
+ try {
+ if (id) sessionStorage.setItem(key, id);
+ else sessionStorage.removeItem(key);
+ } catch {
+ // per-tab convenience only
+ }
+ }
+ return { page, open: (id: string) => set(id), close: () => set("") };
+}
+
+/** The page id of an app link like "/p/" (with an optional #block), or "". */
+export function pageOfHref(href: string): string {
+ return /^\/p\/([A-Za-z0-9_-]+)\/?(?:[?#].*)?$/.exec(href)?.[1] ?? "";
+}
diff --git a/Web-App/frontend/src/locales/de.json b/Web-App/frontend/src/locales/de.json
index eecff74..bec6391 100644
--- a/Web-App/frontend/src/locales/de.json
+++ b/Web-App/frontend/src/locales/de.json
@@ -301,7 +301,9 @@
"unarchive": "Aus dem Archiv holen",
"archived": "Diese Seite ist archiviert. Sie ist schreibgeschützt, bis jemand sie aus dem Archiv holt.",
"parentArchived": "Eine übergeordnete Seite ist archiviert, daher ist diese Seite schreibgeschützt.",
- "linkCopied": "Link kopiert"
+ "linkCopied": "Link kopiert",
+ "openNewTab": "In neuem Tab öffnen",
+ "openBeside": "Daneben öffnen"
},
"trash": {
"hint": "Unterseiten einer gelöschten Seite kommen mit zurück, wenn du sie wiederherstellst.",
@@ -549,6 +551,10 @@
"now": {
"label": "Jetzt",
"description": "Datum und Uhrzeit einfügen"
+ },
+ "syncedPage": {
+ "label": "Synchronisierte Seite",
+ "description": "Eine andere Seite hier zeigen, immer aktuell"
}
},
"format": {
@@ -598,7 +604,14 @@
"calloutEmoji": "Emoji ändern",
"calloutColor": "Farbe ändern",
"pdfLoading": "PDF wird geladen…",
- "pdfPage": "Seite {n}"
+ "pdfPage": "Seite {n}",
+ "syncedPage": "Synchronisierte Seite",
+ "syncedOpen": "Öffnen",
+ "syncedFold": "Einklappen",
+ "syncedUnfold": "Ausklappen",
+ "syncedLoading": "Seite wird geladen…",
+ "syncedDenied": "Du kannst diese Seite nicht öffnen.",
+ "syncedSelf": "Eine Seite kann sich nicht selbst zeigen."
},
"colors": {
"gray": "Grau",
@@ -682,7 +695,16 @@
"emailDigestHint": "Alle paar Minuten eine Zusammenfassung, nur zu dem, was du in der App noch nicht gesehen hast.",
"watchHint": "Du beobachtest Seiten, die du erstellst oder kommentierst. Über das Seitenmenü beobachtest oder stummschaltest du eine Seite.",
"watch": "Seite beobachten",
- "unwatch": "Nicht mehr beobachten"
+ "unwatch": "Nicht mehr beobachten",
+ "emailTypesHint": "Per E-Mail benachrichtigen bei",
+ "emailTypes": {
+ "mention": "Erwähnungen",
+ "comment": "Kommentaren auf beobachteten Seiten",
+ "reply": "Antworten",
+ "resolved": "Erledigten Threads",
+ "share": "Mit mir geteilten Seiten",
+ "reminder": "Erinnerungen"
+ }
},
"templates": {
"mark": "Als Vorlage verwenden",
@@ -733,6 +755,21 @@
"expiresOn": "läuft am {date} ab",
"revoke": "Widerrufen",
"none": "Noch keine Tokens."
+ },
+ "editor": {
+ "title": "Editor",
+ "hint": "Wie Seiten auf diesem Gerät aussehen und beginnen.",
+ "textSize": "Textgröße",
+ "sizes": {
+ "sm": "Klein",
+ "md": "Standard",
+ "lg": "Groß"
+ },
+ "newPageFullWidth": "Neue Seiten nutzen die volle Breite",
+ "dateTitles": "Neue Seiten mit dem heutigen Datum betiteln",
+ "showProperties": "Eigenschaften unter dem Titel zeigen",
+ "showBacklinks": "Seiten zeigen, die hierher verlinken",
+ "codeLineNumbers": "Zeilennummern in Codeblöcken"
}
},
"webhooks": {
@@ -962,5 +999,10 @@
"noTemplate": "Einer leeren Seite",
"opening": "Journal wird geöffnet…",
"failed": "Das Journal konnte nicht geöffnet werden."
+ },
+ "split": {
+ "label": "Seite daneben",
+ "openHere": "Als Hauptseite öffnen",
+ "close": "Seite daneben schließen"
}
}
diff --git a/Web-App/frontend/src/locales/en.json b/Web-App/frontend/src/locales/en.json
index fa9f705..a699654 100644
--- a/Web-App/frontend/src/locales/en.json
+++ b/Web-App/frontend/src/locales/en.json
@@ -301,7 +301,9 @@
"unarchive": "Unarchive",
"archived": "This page is archived. It is read-only until someone unarchives it.",
"parentArchived": "A page above this one is archived, so this page is read-only.",
- "linkCopied": "Link copied"
+ "linkCopied": "Link copied",
+ "openNewTab": "Open in new tab",
+ "openBeside": "Open beside"
},
"trash": {
"hint": "Pages inside a trashed page come back when you restore it.",
@@ -549,6 +551,10 @@
"now": {
"label": "Now",
"description": "Insert the date and time"
+ },
+ "syncedPage": {
+ "label": "Synced page",
+ "description": "Show another page here, always up to date"
}
},
"format": {
@@ -598,7 +604,14 @@
"calloutEmoji": "Change emoji",
"calloutColor": "Change colour",
"pdfLoading": "Loading PDF…",
- "pdfPage": "Page {n}"
+ "pdfPage": "Page {n}",
+ "syncedPage": "Synced page",
+ "syncedOpen": "Open",
+ "syncedFold": "Fold",
+ "syncedUnfold": "Unfold",
+ "syncedLoading": "Loading the page…",
+ "syncedDenied": "You can't open this page.",
+ "syncedSelf": "A page can't show itself."
},
"colors": {
"gray": "Grey",
@@ -682,7 +695,16 @@
"emailDigestHint": "A summary every few minutes, only for what you have not seen in the app.",
"watchHint": "You watch pages you create or comment on. Use the page menu to watch or mute a page.",
"watch": "Watch page",
- "unwatch": "Stop watching"
+ "unwatch": "Stop watching",
+ "emailTypesHint": "Email me about",
+ "emailTypes": {
+ "mention": "Mentions",
+ "comment": "Comments on pages I watch",
+ "reply": "Replies",
+ "resolved": "Resolved threads",
+ "share": "Pages shared with me",
+ "reminder": "Reminders"
+ }
},
"templates": {
"mark": "Use as template",
@@ -733,6 +755,21 @@
"expiresOn": "expires {date}",
"revoke": "Revoke",
"none": "No tokens yet."
+ },
+ "editor": {
+ "title": "Editor",
+ "hint": "How pages read and start out on this device.",
+ "textSize": "Text size",
+ "sizes": {
+ "sm": "Small",
+ "md": "Default",
+ "lg": "Large"
+ },
+ "newPageFullWidth": "New pages use the full width",
+ "dateTitles": "Title new pages with today's date",
+ "showProperties": "Show properties under the title",
+ "showBacklinks": "Show the pages that link here",
+ "codeLineNumbers": "Line numbers in code blocks"
}
},
"webhooks": {
@@ -962,5 +999,10 @@
"noTemplate": "An empty page",
"opening": "Opening the journal…",
"failed": "The journal could not be opened."
+ },
+ "split": {
+ "label": "Page beside",
+ "openHere": "Open as the main page",
+ "close": "Close the side page"
}
}
diff --git a/Web-App/frontend/src/locales/es.json b/Web-App/frontend/src/locales/es.json
index a0b0bce..4c1aab4 100644
--- a/Web-App/frontend/src/locales/es.json
+++ b/Web-App/frontend/src/locales/es.json
@@ -301,7 +301,9 @@
"unarchive": "Desarchivar",
"archived": "Esta página está archivada. Es de solo lectura hasta que alguien la desarchive.",
"parentArchived": "Una página superior está archivada, así que esta página es de solo lectura.",
- "linkCopied": "Enlace copiado"
+ "linkCopied": "Enlace copiado",
+ "openNewTab": "Abrir en una pestaña nueva",
+ "openBeside": "Abrir al lado"
},
"trash": {
"hint": "Las subpáginas de una página eliminada vuelven cuando la restauras.",
@@ -549,6 +551,10 @@
"now": {
"label": "Ahora",
"description": "Insertar la fecha y la hora"
+ },
+ "syncedPage": {
+ "label": "Página sincronizada",
+ "description": "Muestra otra página aquí, siempre al día"
}
},
"format": {
@@ -598,7 +604,14 @@
"calloutEmoji": "Cambiar emoji",
"calloutColor": "Cambiar color",
"pdfLoading": "Cargando PDF…",
- "pdfPage": "Página {n}"
+ "pdfPage": "Página {n}",
+ "syncedPage": "Página sincronizada",
+ "syncedOpen": "Abrir",
+ "syncedFold": "Plegar",
+ "syncedUnfold": "Desplegar",
+ "syncedLoading": "Cargando la página…",
+ "syncedDenied": "No puedes abrir esta página.",
+ "syncedSelf": "Una página no puede mostrarse a sí misma."
},
"colors": {
"gray": "Gris",
@@ -682,7 +695,16 @@
"emailDigestHint": "Un resumen cada pocos minutos, solo de lo que no has visto en la app.",
"watchHint": "Sigues las páginas que creas o comentas. Usa el menú de la página para seguirla o silenciarla.",
"watch": "Seguir página",
- "unwatch": "Dejar de seguir"
+ "unwatch": "Dejar de seguir",
+ "emailTypesHint": "Avisarme por correo de",
+ "emailTypes": {
+ "mention": "Menciones",
+ "comment": "Comentarios en páginas que sigo",
+ "reply": "Respuestas",
+ "resolved": "Hilos resueltos",
+ "share": "Páginas compartidas conmigo",
+ "reminder": "Recordatorios"
+ }
},
"templates": {
"mark": "Usar como plantilla",
@@ -733,6 +755,21 @@
"expiresOn": "caduca el {date}",
"revoke": "Revocar",
"none": "Aún no hay tokens."
+ },
+ "editor": {
+ "title": "Editor",
+ "hint": "Cómo se leen y empiezan las páginas en este dispositivo.",
+ "textSize": "Tamaño del texto",
+ "sizes": {
+ "sm": "Pequeño",
+ "md": "Normal",
+ "lg": "Grande"
+ },
+ "newPageFullWidth": "Las páginas nuevas usan todo el ancho",
+ "dateTitles": "Titular las páginas nuevas con la fecha de hoy",
+ "showProperties": "Mostrar las propiedades bajo el título",
+ "showBacklinks": "Mostrar las páginas que enlazan aquí",
+ "codeLineNumbers": "Números de línea en los bloques de código"
}
},
"webhooks": {
@@ -962,5 +999,10 @@
"noTemplate": "Una página vacía",
"opening": "Abriendo el diario…",
"failed": "No se pudo abrir el diario."
+ },
+ "split": {
+ "label": "Página al lado",
+ "openHere": "Abrir como página principal",
+ "close": "Cerrar la página de al lado"
}
}
diff --git a/Web-App/frontend/src/locales/fr.json b/Web-App/frontend/src/locales/fr.json
index bb62167..a1bd346 100644
--- a/Web-App/frontend/src/locales/fr.json
+++ b/Web-App/frontend/src/locales/fr.json
@@ -301,7 +301,9 @@
"unarchive": "Désarchiver",
"archived": "Cette page est archivée. Elle est en lecture seule jusqu’à ce que quelqu’un la désarchive.",
"parentArchived": "Une page parente est archivée, cette page est donc en lecture seule.",
- "linkCopied": "Lien copié"
+ "linkCopied": "Lien copié",
+ "openNewTab": "Ouvrir dans un nouvel onglet",
+ "openBeside": "Ouvrir à côté"
},
"trash": {
"hint": "Les sous-pages d’une page supprimée reviennent quand vous la restaurez.",
@@ -549,6 +551,10 @@
"now": {
"label": "Maintenant",
"description": "Insérer la date et l'heure"
+ },
+ "syncedPage": {
+ "label": "Page synchronisée",
+ "description": "Afficher une autre page ici, toujours à jour"
}
},
"format": {
@@ -598,7 +604,14 @@
"calloutEmoji": "Changer l'emoji",
"calloutColor": "Changer la couleur",
"pdfLoading": "Chargement du PDF…",
- "pdfPage": "Page {n}"
+ "pdfPage": "Page {n}",
+ "syncedPage": "Page synchronisée",
+ "syncedOpen": "Ouvrir",
+ "syncedFold": "Replier",
+ "syncedUnfold": "Déplier",
+ "syncedLoading": "Chargement de la page…",
+ "syncedDenied": "Vous ne pouvez pas ouvrir cette page.",
+ "syncedSelf": "Une page ne peut pas s’afficher elle-même."
},
"colors": {
"gray": "Gris",
@@ -682,7 +695,16 @@
"emailDigestHint": "Un résumé toutes les quelques minutes, seulement pour ce que vous n’avez pas vu dans l’app.",
"watchHint": "Vous suivez les pages que vous créez ou commentez. Utilisez le menu de la page pour suivre une page ou la mettre en sourdine.",
"watch": "Suivre la page",
- "unwatch": "Ne plus suivre"
+ "unwatch": "Ne plus suivre",
+ "emailTypesHint": "M’écrire pour",
+ "emailTypes": {
+ "mention": "Les mentions",
+ "comment": "Les commentaires sur les pages suivies",
+ "reply": "Les réponses",
+ "resolved": "Les fils résolus",
+ "share": "Les pages partagées avec moi",
+ "reminder": "Les rappels"
+ }
},
"templates": {
"mark": "Utiliser comme modèle",
@@ -733,6 +755,21 @@
"expiresOn": "expire le {date}",
"revoke": "Révoquer",
"none": "Aucun jeton pour l’instant."
+ },
+ "editor": {
+ "title": "Éditeur",
+ "hint": "L’aspect et le départ des pages sur cet appareil.",
+ "textSize": "Taille du texte",
+ "sizes": {
+ "sm": "Petite",
+ "md": "Normale",
+ "lg": "Grande"
+ },
+ "newPageFullWidth": "Les nouvelles pages prennent toute la largeur",
+ "dateTitles": "Titrer les nouvelles pages avec la date du jour",
+ "showProperties": "Afficher les propriétés sous le titre",
+ "showBacklinks": "Afficher les pages qui pointent ici",
+ "codeLineNumbers": "Numéros de ligne dans les blocs de code"
}
},
"webhooks": {
@@ -962,5 +999,10 @@
"noTemplate": "Une page vide",
"opening": "Ouverture du journal…",
"failed": "Le journal n’a pas pu être ouvert."
+ },
+ "split": {
+ "label": "Page à côté",
+ "openHere": "Ouvrir comme page principale",
+ "close": "Fermer la page à côté"
}
}
diff --git a/Web-App/frontend/src/locales/pl.json b/Web-App/frontend/src/locales/pl.json
index 81022cf..07622cc 100644
--- a/Web-App/frontend/src/locales/pl.json
+++ b/Web-App/frontend/src/locales/pl.json
@@ -301,7 +301,9 @@
"unarchive": "Przywróć z archiwum",
"archived": "Ta strona jest zarchiwizowana. Jest tylko do odczytu, dopóki ktoś jej nie przywróci.",
"parentArchived": "Strona nadrzędna jest zarchiwizowana, więc ta strona jest tylko do odczytu.",
- "linkCopied": "Skopiowano link"
+ "linkCopied": "Skopiowano link",
+ "openNewTab": "Otwórz w nowej karcie",
+ "openBeside": "Otwórz obok"
},
"trash": {
"hint": "Strony wewnątrz przywróconej strony wracają razem z nią.",
@@ -549,6 +551,10 @@
"now": {
"label": "Teraz",
"description": "Wstaw datę i godzinę"
+ },
+ "syncedPage": {
+ "label": "Strona synchronizowana",
+ "description": "Pokaż tu inną stronę, zawsze aktualną"
}
},
"format": {
@@ -598,7 +604,14 @@
"calloutEmoji": "Zmień emoji",
"calloutColor": "Zmień kolor",
"pdfLoading": "Wczytywanie PDF…",
- "pdfPage": "Strona {n}"
+ "pdfPage": "Strona {n}",
+ "syncedPage": "Strona synchronizowana",
+ "syncedOpen": "Otwórz",
+ "syncedFold": "Zwiń",
+ "syncedUnfold": "Rozwiń",
+ "syncedLoading": "Wczytywanie strony…",
+ "syncedDenied": "Nie możesz otworzyć tej strony.",
+ "syncedSelf": "Strona nie może pokazać samej siebie."
},
"colors": {
"gray": "Szary",
@@ -682,7 +695,16 @@
"emailDigestHint": "Podsumowanie co kilka minut, tylko o tym, czego nie widzisz w aplikacji.",
"watchHint": "Obserwujesz strony, które tworzysz lub komentujesz. Menu strony pozwala obserwować lub wyciszyć stronę.",
"watch": "Obserwuj stronę",
- "unwatch": "Przestań obserwować"
+ "unwatch": "Przestań obserwować",
+ "emailTypesHint": "Wysyłaj e-mail o",
+ "emailTypes": {
+ "mention": "Wzmiankach",
+ "comment": "Komentarzach na obserwowanych stronach",
+ "reply": "Odpowiedziach",
+ "resolved": "Rozwiązanych wątkach",
+ "share": "Stronach mi udostępnionych",
+ "reminder": "Przypomnieniach"
+ }
},
"templates": {
"mark": "Użyj jako szablonu",
@@ -733,6 +755,21 @@
"expiresOn": "wygasa {date}",
"revoke": "Unieważnij",
"none": "Brak tokenów."
+ },
+ "editor": {
+ "title": "Edytor",
+ "hint": "Jak strony wyglądają i zaczynają się na tym urządzeniu.",
+ "textSize": "Rozmiar tekstu",
+ "sizes": {
+ "sm": "Mały",
+ "md": "Domyślny",
+ "lg": "Duży"
+ },
+ "newPageFullWidth": "Nowe strony mają pełną szerokość",
+ "dateTitles": "Tytułuj nowe strony dzisiejszą datą",
+ "showProperties": "Pokazuj właściwości pod tytułem",
+ "showBacklinks": "Pokazuj strony, które tu linkują",
+ "codeLineNumbers": "Numery wierszy w blokach kodu"
}
},
"webhooks": {
@@ -962,5 +999,10 @@
"noTemplate": "Pustej strony",
"opening": "Otwieranie dziennika…",
"failed": "Nie udało się otworzyć dziennika."
+ },
+ "split": {
+ "label": "Strona obok",
+ "openHere": "Otwórz jako główną",
+ "close": "Zamknij stronę obok"
}
}
diff --git a/Web-App/frontend/src/stores/preferences.ts b/Web-App/frontend/src/stores/preferences.ts
new file mode 100644
index 0000000..87afa72
--- /dev/null
+++ b/Web-App/frontend/src/stores/preferences.ts
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import { effectScope, reactive, watch } from "vue";
+
+/** How pages read and start out on this device (account settings → Editor). */
+export interface EditorPrefs {
+ /** The body text size: small, default or large. */
+ textSize: "sm" | "md" | "lg";
+ /** New pages start full width instead of in the reading column. */
+ newPageFullWidth: boolean;
+ /** New pages are titled with today's date. */
+ dateTitles: boolean;
+ /** The properties list under each page title. */
+ showProperties: boolean;
+ /** The list of pages that link to the page, under its text. */
+ showBacklinks: boolean;
+ /** Code blocks show line numbers unless one was switched on or off itself. */
+ codeLineNumbers: boolean;
+}
+
+const key = "docwell.editorPrefs";
+export const defaultEditorPrefs: EditorPrefs = {
+ textSize: "md",
+ newPageFullWidth: false,
+ dateTitles: false,
+ showProperties: true,
+ showBacklinks: true,
+ codeLineNumbers: false,
+};
+
+function read(): EditorPrefs {
+ try {
+ return { ...defaultEditorPrefs, ...(JSON.parse(localStorage.getItem(key) ?? "{}") as Partial) };
+ } catch {
+ return { ...defaultEditorPrefs };
+ }
+}
+
+let prefs: EditorPrefs | null = null;
+
+/** The editor preferences, shared by every view and saved as they change. */
+export function useEditorPrefs(): EditorPrefs {
+ if (!prefs) {
+ const p = reactive(read());
+ prefs = p;
+ // Detached from the component that asked first, so saving outlives it.
+ effectScope(true).run(() =>
+ watch(
+ p,
+ (v) => {
+ try {
+ localStorage.setItem(key, JSON.stringify(v));
+ } catch {
+ // per-device convenience only
+ }
+ },
+ { deep: true },
+ ),
+ );
+ }
+ return prefs;
+}
diff --git a/Web-App/frontend/src/stores/spaces.ts b/Web-App/frontend/src/stores/spaces.ts
index 3af455d..8072548 100644
--- a/Web-App/frontend/src/stores/spaces.ts
+++ b/Web-App/frontend/src/stores/spaces.ts
@@ -5,6 +5,7 @@ import { defineStore } from "pinia";
import { computed, ref } from "vue";
import { useApi } from "../api";
import { applyMove, childrenByParent } from "../lib/tree";
+import { useEditorPrefs } from "./preferences";
const rank: Record = { viewer: 1, commenter: 2, editor: 3, admin: 4 };
@@ -100,8 +101,15 @@ export const useSpacesStore = defineStore("spaces", () => {
for (let p = parentOf.get(pageId); p; p = parentOf.get(p)) setExpanded(p, true);
}
+ /** Makes a page; the editor preferences can title it with today's date and make it full width. */
async function createPage(spaceId: string, parent = "", title?: string) {
- const page = await api.spaces.createPage(spaceId, title ? { parent, title } : { parent });
+ const prefs = useEditorPrefs();
+ if (!title && prefs.dateTitles) {
+ const lang = document.documentElement.lang || undefined;
+ title = new Intl.DateTimeFormat(lang, { dateStyle: "long" }).format(new Date());
+ }
+ let page = await api.spaces.createPage(spaceId, title ? { parent, title } : { parent });
+ if (prefs.newPageFullWidth) page = await api.pages.update(page.id, { fullWidth: true });
if (parent) setExpanded(parent, true);
await loadTree(spaceId);
return page;
diff --git a/Web-App/frontend/src/views/NotificationsView.vue b/Web-App/frontend/src/views/NotificationsView.vue
index a7fcd4c..12377f6 100644
--- a/Web-App/frontend/src/views/NotificationsView.vue
+++ b/Web-App/frontend/src/views/NotificationsView.vue
@@ -1,6 +1,6 @@
-
+
{{ $t("page.collab.denied") }}
{{ $t("page.collab.offline") }}
@@ -550,7 +590,7 @@ const purge = () =>
>
-
+
@click="historyOpen = !historyOpen"
>
- {{ $t("page.history.title") }}
+ {{ $t("page.history.title") }}
data-testid="info-toggle"
@click="infoOpen = !infoOpen"
>
- {{ $t("properties.info") }}
+ {{ $t("properties.info") }}
data-testid="comments-toggle"
@click="commentsOpen = !commentsOpen"
>
- {{ $t("comments.title") }}
+ {{ $t("comments.title") }}
{{ openThreads.length }}
-
- {{ $t("share.button") }}
+
+ {{ $t("share.button") }}
@@ -607,7 +647,11 @@ const purge = () =>
{{ $t("page.notFound") }}
@@ -668,7 +712,7 @@ const purge = () =>
{{ $t("page.readOnly") }}
-
+