mirror of
https://github.com/docmost/docmost.git
synced 2026-05-08 15:23:07 +08:00
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db404815b0 | |||
| d9ebeb2b85 | |||
| c3a9a52b7f | |||
| bcb004af21 | |||
| ac675e7d74 | |||
| bf89eff5e7 | |||
| 183787fa0c | |||
| 15aa04a5f7 | |||
| 79343a5d52 | |||
| 61e252918e | |||
| e98fa7f69a | |||
| 6d148a35eb | |||
| 0bbc1c35de | |||
| 47097969a0 | |||
| 13f529e064 | |||
| 8fc8422fbc | |||
| 732951a322 | |||
| 2544775266 | |||
| d59539f197 | |||
| b061df7f7d | |||
| 0fe1459864 | |||
| 6af7956889 | |||
| 3dbb957bd7 | |||
| f39a4cf2d5 | |||
| 724e01bd55 | |||
| 6e350f6746 | |||
| cb9f27da9a | |||
| d2629afff2 | |||
| 9139d393ef | |||
| ab96672ecd | |||
| 2ea3c2da58 | |||
| 9fb16bc842 | |||
| c3b350d943 | |||
| 8014ba3ab7 | |||
| ec3a04f7c7 | |||
| 04a17c9b92 | |||
| 520c07a0bc | |||
| 60a8ed6826 | |||
| f5684b792e |
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
node_modules
|
node_modules
|
||||||
.git
|
.git
|
||||||
.gitignore
|
|
||||||
dist
|
dist
|
||||||
data
|
/data
|
||||||
|
.env*
|
||||||
|
.nx
|
||||||
|
|||||||
+7
-5
@@ -1,19 +1,22 @@
|
|||||||
FROM node:22-alpine AS base
|
FROM node:22-slim AS base
|
||||||
LABEL org.opencontainers.image.source="https://github.com/docmost/docmost"
|
LABEL org.opencontainers.image.source="https://github.com/docmost/docmost"
|
||||||
|
|
||||||
|
RUN npm install -g pnpm@10.4.0
|
||||||
|
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN npm install -g pnpm@10.4.0
|
|
||||||
RUN pnpm install --frozen-lockfile
|
RUN pnpm install --frozen-lockfile
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
FROM base AS installer
|
FROM base AS installer
|
||||||
|
|
||||||
RUN apk add --no-cache curl bash
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends curl bash \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -29,12 +32,11 @@ COPY --from=builder /app/packages/editor-ext/package.json /app/packages/editor-e
|
|||||||
# Copy root package files
|
# Copy root package files
|
||||||
COPY --from=builder /app/package.json /app/package.json
|
COPY --from=builder /app/package.json /app/package.json
|
||||||
COPY --from=builder /app/pnpm*.yaml /app/
|
COPY --from=builder /app/pnpm*.yaml /app/
|
||||||
|
COPY --from=builder /app/.npmrc /app/.npmrc
|
||||||
|
|
||||||
# Copy patches
|
# Copy patches
|
||||||
COPY --from=builder /app/patches /app/patches
|
COPY --from=builder /app/patches /app/patches
|
||||||
|
|
||||||
RUN npm install -g pnpm@10.4.0
|
|
||||||
|
|
||||||
RUN chown -R node:node /app
|
RUN chown -R node:node /app
|
||||||
|
|
||||||
USER node
|
USER node
|
||||||
|
|||||||
+27
-28
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "client",
|
"name": "client",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.23.2",
|
"version": "0.24.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
@@ -10,54 +10,53 @@
|
|||||||
"format": "prettier --write \"src/**/*.tsx\" \"src/**/*.ts\""
|
"format": "prettier --write \"src/**/*.tsx\" \"src/**/*.ts\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@casl/ability": "^6.7.2",
|
|
||||||
"@casl/react": "^4.0.0",
|
"@casl/react": "^4.0.0",
|
||||||
"@docmost/editor-ext": "workspace:*",
|
"@docmost/editor-ext": "workspace:*",
|
||||||
"@emoji-mart/data": "^1.2.1",
|
"@emoji-mart/data": "^1.2.1",
|
||||||
"@emoji-mart/react": "^1.1.1",
|
"@emoji-mart/react": "^1.1.1",
|
||||||
"@excalidraw/excalidraw": "0.18.0-864353b",
|
"@excalidraw/excalidraw": "0.18.0-c158187",
|
||||||
"@mantine/core": "^8.1.3",
|
"@mantine/core": "^8.3.12",
|
||||||
"@mantine/dates": "^8.3.2",
|
"@mantine/dates": "^8.3.12",
|
||||||
"@mantine/form": "^8.1.3",
|
"@mantine/form": "^8.3.12",
|
||||||
"@mantine/hooks": "^8.1.3",
|
"@mantine/hooks": "^8.3.12",
|
||||||
"@mantine/modals": "^8.1.3",
|
"@mantine/modals": "^8.3.12",
|
||||||
"@mantine/notifications": "^8.1.3",
|
"@mantine/notifications": "^8.3.12",
|
||||||
"@mantine/spotlight": "^8.1.3",
|
"@mantine/spotlight": "^8.3.12",
|
||||||
"@tabler/icons-react": "^3.34.0",
|
"@tabler/icons-react": "^3.36.1",
|
||||||
"@tanstack/react-query": "^5.80.6",
|
"@tanstack/react-query": "^5.90.17",
|
||||||
"@tiptap/extension-character-count": "^2.10.3",
|
"@tiptap/extension-character-count": "^2.27.1",
|
||||||
"alfaaz": "^1.1.0",
|
"alfaaz": "^1.1.0",
|
||||||
"axios": "^1.9.0",
|
"axios": "^1.13.2",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"emoji-mart": "^5.6.0",
|
"emoji-mart": "^5.6.0",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"highlightjs-sap-abap": "^0.3.0",
|
"highlightjs-sap-abap": "^0.3.0",
|
||||||
"i18next": "^23.14.0",
|
"i18next": "^23.16.8",
|
||||||
"i18next-http-backend": "^2.6.1",
|
"i18next-http-backend": "^2.7.3",
|
||||||
"jotai": "^2.12.5",
|
"jotai": "^2.16.2",
|
||||||
"jotai-optics": "^0.4.0",
|
"jotai-optics": "^0.4.0",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
"katex": "0.16.22",
|
"katex": "0.16.27",
|
||||||
"lowlight": "^3.3.0",
|
"lowlight": "^3.3.0",
|
||||||
"mantine-form-zod-resolver": "^1.3.0",
|
"mantine-form-zod-resolver": "^1.3.0",
|
||||||
"mermaid": "^11.11.0",
|
"mermaid": "^11.12.2",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
"posthog-js": "^1.255.1",
|
"posthog-js": "^1.255.1",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-arborist": "3.4.0",
|
"react-arborist": "3.4.0",
|
||||||
"react-clear-modal": "^2.0.15",
|
"react-clear-modal": "^2.0.17",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-drawio": "^1.0.1",
|
"react-drawio": "^1.0.7",
|
||||||
"react-error-boundary": "^4.1.2",
|
"react-error-boundary": "^4.1.2",
|
||||||
"react-helmet-async": "^2.0.5",
|
"react-helmet-async": "^2.0.5",
|
||||||
"react-i18next": "^15.0.1",
|
"react-i18next": "^15.0.1",
|
||||||
"react-router-dom": "^7.0.1",
|
"react-router-dom": "^7.12.0",
|
||||||
"semver": "^7.7.2",
|
"semver": "^7.7.3",
|
||||||
"socket.io-client": "^4.8.1",
|
"socket.io-client": "^4.8.3",
|
||||||
"tippy.js": "^6.3.7",
|
"tippy.js": "^6.3.7",
|
||||||
"tiptap-extension-global-drag-handle": "^0.1.18",
|
"tiptap-extension-global-drag-handle": "^0.1.18",
|
||||||
"zod": "^3.25.56"
|
"zod": "^3.25.76"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.16.0",
|
"@eslint/js": "^9.16.0",
|
||||||
@@ -65,10 +64,10 @@
|
|||||||
"@types/file-saver": "^2.0.7",
|
"@types/file-saver": "^2.0.7",
|
||||||
"@types/js-cookie": "^3.0.6",
|
"@types/js-cookie": "^3.0.6",
|
||||||
"@types/katex": "^0.16.7",
|
"@types/katex": "^0.16.7",
|
||||||
"@types/node": "22.10.0",
|
"@types/node": "22.19.1",
|
||||||
"@types/react": "^18.3.12",
|
"@types/react": "^18.3.12",
|
||||||
"@types/react-dom": "^18.3.1",
|
"@types/react-dom": "^18.3.1",
|
||||||
"@vitejs/plugin-react": "^4.4.1",
|
"@vitejs/plugin-react": "^5.1.1",
|
||||||
"eslint": "^9.15.0",
|
"eslint": "^9.15.0",
|
||||||
"eslint-plugin-react": "^7.37.2",
|
"eslint-plugin-react": "^7.37.2",
|
||||||
"eslint-plugin-react-hooks": "^5.1.0",
|
"eslint-plugin-react-hooks": "^5.1.0",
|
||||||
@@ -81,6 +80,6 @@
|
|||||||
"prettier": "^3.4.1",
|
"prettier": "^3.4.1",
|
||||||
"typescript": "^5.7.2",
|
"typescript": "^5.7.2",
|
||||||
"typescript-eslint": "^8.17.0",
|
"typescript-eslint": "^8.17.0",
|
||||||
"vite": "^6.3.5"
|
"vite": "^7.2.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
"Delete group": "Gruppe löschen",
|
"Delete group": "Gruppe löschen",
|
||||||
"Are you sure you want to delete this page? This will delete its children and page history. This action is irreversible.": "Sind Sie sicher, dass Sie diese Seite löschen möchten? Dadurch werden ihre Unterseiten und die Seitengeschichte gelöscht. Diese Aktion ist unwiderruflich.",
|
"Are you sure you want to delete this page? This will delete its children and page history. This action is irreversible.": "Sind Sie sicher, dass Sie diese Seite löschen möchten? Dadurch werden ihre Unterseiten und die Seitengeschichte gelöscht. Diese Aktion ist unwiderruflich.",
|
||||||
"Description": "Beschreibung",
|
"Description": "Beschreibung",
|
||||||
"Details": "Einzelheiten",
|
"Details": "Details",
|
||||||
"e.g ACME": "z.B. ACME",
|
"e.g ACME": "z.B. ACME",
|
||||||
"e.g ACME Inc": "z.B. ACME Inc.",
|
"e.g ACME Inc": "z.B. ACME Inc.",
|
||||||
"e.g Developers": "z.B. Entwickler",
|
"e.g Developers": "z.B. Entwickler",
|
||||||
@@ -234,9 +234,7 @@
|
|||||||
"Anyone with this link can join this workspace.": "Jeder mit diesem Link kann dem Arbeitsbereich beitreten.",
|
"Anyone with this link can join this workspace.": "Jeder mit diesem Link kann dem Arbeitsbereich beitreten.",
|
||||||
"Invite link": "Einladungslink",
|
"Invite link": "Einladungslink",
|
||||||
"Copy": "Kopieren",
|
"Copy": "Kopieren",
|
||||||
"Copy to space": "In Raum kopieren",
|
|
||||||
"Copied": "Kopiert",
|
"Copied": "Kopiert",
|
||||||
"Duplicate": "Duplizieren",
|
|
||||||
"Select a user": "Benutzer auswählen",
|
"Select a user": "Benutzer auswählen",
|
||||||
"Select a group": "Gruppe auswählen",
|
"Select a group": "Gruppe auswählen",
|
||||||
"Export all pages and attachments in this space.": "Alle Seiten und Anhänge in diesem Bereich exportieren.",
|
"Export all pages and attachments in this space.": "Alle Seiten und Anhänge in diesem Bereich exportieren.",
|
||||||
@@ -527,5 +525,47 @@
|
|||||||
"Delete SSO provider": "SSO-Anbieter löschen",
|
"Delete SSO provider": "SSO-Anbieter löschen",
|
||||||
"Are you sure you want to delete this SSO provider?": "Sind Sie sicher, dass Sie diesen SSO-Anbieter löschen möchten?",
|
"Are you sure you want to delete this SSO provider?": "Sind Sie sicher, dass Sie diesen SSO-Anbieter löschen möchten?",
|
||||||
"Action": "Aktion",
|
"Action": "Aktion",
|
||||||
"{{ssoProviderType}} configuration": "{{ssoProviderType}}-Konfiguration"
|
"{{ssoProviderType}} configuration": "{{ssoProviderType}}-Konfiguration",
|
||||||
|
"Icon": "Icon",
|
||||||
|
"Upload image": "Bild hochladen",
|
||||||
|
"Remove image": "Bild entfernen",
|
||||||
|
"Failed to remove image": "Fehler beim Entfernen des Bildes",
|
||||||
|
"Image exceeds 10MB limit.": "Bild überschreitet das Limit von 10 MB.",
|
||||||
|
"Image removed successfully": "Bild erfolgreich entfernt",
|
||||||
|
"API key": "API-Schlüssel",
|
||||||
|
"API key created successfully": "API-Schlüssel erfolgreich erstellt",
|
||||||
|
"API keys": "API-Schlüssel",
|
||||||
|
"API management": "API-Verwaltung",
|
||||||
|
"Are you sure you want to revoke this API key": "Sind Sie sicher, dass Sie diesen API-Schlüssel widerrufen möchten?",
|
||||||
|
"Create API Key": "API-Schlüssel erstellen",
|
||||||
|
"Custom expiration date": "Benutzerdefiniertes Ablaufdatum",
|
||||||
|
"Enter a descriptive token name": "Geben Sie einen beschreibenden Token-Namen ein",
|
||||||
|
"Expiration": "Ablauf",
|
||||||
|
"Expired": "Abgelaufen",
|
||||||
|
"Expires": "Läuft ab",
|
||||||
|
"I've saved my API key": "Ich habe meinen API-Schlüssel gespeichert",
|
||||||
|
"Last use": "Zuletzt verwendet",
|
||||||
|
"No API keys found": "Keine API-Schlüssel gefunden",
|
||||||
|
"No expiration": "Kein Ablauf",
|
||||||
|
"Revoke API key": "API-Schlüssel widerrufen",
|
||||||
|
"Revoked successfully": "Erfolgreich widerrufen",
|
||||||
|
"Select expiration date": "Ablaufdatum wählen",
|
||||||
|
"This action cannot be undone. Any applications using this API key will stop working.": "Diese Aktion kann nicht rückgängig gemacht werden. Alle Anwendungen, die diesen API-Schlüssel verwenden, werden nicht mehr funktionieren.",
|
||||||
|
"Update API key": "API-Schlüssel aktualisieren",
|
||||||
|
"Manage API keys for all users in the workspace": "Verwalten Sie API-Schlüssel für alle Benutzer im Arbeitsbereich",
|
||||||
|
"AI settings": "KI-Einstellungen",
|
||||||
|
"AI search": "KI-Suche",
|
||||||
|
"AI Answer": "KI-Antwort",
|
||||||
|
"Ask AI": "KI fragen",
|
||||||
|
"AI is thinking...": "Die KI überlegt...",
|
||||||
|
"Ask a question...": "Fragen stellen...",
|
||||||
|
"AI-powered search (Ask AI)": "KI-gestützte Suche (KI fragen)",
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.": "Die KI-Suche verwendet Vektor-Einbettungen, um semantische Suchfunktionen in Ihrem Arbeitsbereich bereitzustellen.",
|
||||||
|
"Toggle AI search": "KI-Suche umschalten",
|
||||||
|
"Sources": "Quellen",
|
||||||
|
"Ask AI not available for attachments": "KI fragen nicht für Anhänge verfügbar",
|
||||||
|
"No answer available": "Keine Antwort verfügbar",
|
||||||
|
"Background color": "Hintergrundfarbe",
|
||||||
|
"Highlight color": "Hervorhebungsfarbe",
|
||||||
|
"Remove color": "Farbe entfernen"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -554,5 +554,20 @@
|
|||||||
"Select expiration date": "Select expiration date",
|
"Select expiration date": "Select expiration date",
|
||||||
"This action cannot be undone. Any applications using this API key will stop working.": "This action cannot be undone. Any applications using this API key will stop working.",
|
"This action cannot be undone. Any applications using this API key will stop working.": "This action cannot be undone. Any applications using this API key will stop working.",
|
||||||
"Update API key": "Update API key",
|
"Update API key": "Update API key",
|
||||||
"Manage API keys for all users in the workspace": "Manage API keys for all users in the workspace"
|
"Manage API keys for all users in the workspace": "Manage API keys for all users in the workspace",
|
||||||
|
"AI settings": "AI settings",
|
||||||
|
"AI search": "AI search",
|
||||||
|
"AI Answer": "AI Answer",
|
||||||
|
"Ask AI": "Ask AI",
|
||||||
|
"AI is thinking...": "AI is thinking...",
|
||||||
|
"Ask a question...": "Ask a question...",
|
||||||
|
"AI-powered search (Ask AI)": "AI-powered search (Ask AI)",
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.": "AI search uses vector embeddings to provide semantic search capabilities across your workspace content.",
|
||||||
|
"Toggle AI search": "Toggle AI search",
|
||||||
|
"Sources": "Sources",
|
||||||
|
"Ask AI not available for attachments": "Ask AI not available for attachments",
|
||||||
|
"No answer available": "No answer available",
|
||||||
|
"Background color": "Background color",
|
||||||
|
"Highlight color": "Highlight color",
|
||||||
|
"Remove color": "Remove color"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -527,5 +527,47 @@
|
|||||||
"Delete SSO provider": "Eliminar proveedor de SSO",
|
"Delete SSO provider": "Eliminar proveedor de SSO",
|
||||||
"Are you sure you want to delete this SSO provider?": "¿Está seguro de que desea eliminar este proveedor de SSO?",
|
"Are you sure you want to delete this SSO provider?": "¿Está seguro de que desea eliminar este proveedor de SSO?",
|
||||||
"Action": "Acción",
|
"Action": "Acción",
|
||||||
"{{ssoProviderType}} configuration": "Configuración de {{ssoProviderType}}"
|
"{{ssoProviderType}} configuration": "Configuración de {{ssoProviderType}}",
|
||||||
|
"Icon": "Icono",
|
||||||
|
"Upload image": "Subir imagen",
|
||||||
|
"Remove image": "Eliminar imagen",
|
||||||
|
"Failed to remove image": "No se ha podido eliminar la imagen",
|
||||||
|
"Image exceeds 10MB limit.": "La imagen excede del límite de 10 MB",
|
||||||
|
"Image removed successfully": "Imagen eliminada correctamente",
|
||||||
|
"API key": "Clave API",
|
||||||
|
"API key created successfully": "Clave API creada correctamente",
|
||||||
|
"API keys": "Claves API",
|
||||||
|
"API management": "Gestión de API",
|
||||||
|
"Are you sure you want to revoke this API key": "¿Está seguro de que desea revocar esta clave API? ",
|
||||||
|
"Create API Key": "Crear clave API",
|
||||||
|
"Custom expiration date": "Fecha de vencimiento personalizada",
|
||||||
|
"Enter a descriptive token name": "Introduce un nombre descriptivo del token",
|
||||||
|
"Expiration": "Vencimiento",
|
||||||
|
"Expired": "Vencido",
|
||||||
|
"Expires": "Vence",
|
||||||
|
"I've saved my API key": "He guardado mi clave API",
|
||||||
|
"Last use": "Último uso",
|
||||||
|
"No API keys found": "No se han encontrado claves API",
|
||||||
|
"No expiration": "Sin vencimiento",
|
||||||
|
"Revoke API key": "Revocar clave API",
|
||||||
|
"Revoked successfully": "Revocada correctamente",
|
||||||
|
"Select expiration date": "Seleccionar fecha de vencimiento",
|
||||||
|
"This action cannot be undone. Any applications using this API key will stop working.": "Esta acción no se puede deshacer. Las aplicaciones que utilicen esta clave API dejarán de funcionar.",
|
||||||
|
"Update API key": "Actualizar clave API",
|
||||||
|
"Manage API keys for all users in the workspace": "Gestionar claves API para todos los usuarios en el espacio de trabajo",
|
||||||
|
"AI settings": "Configuración de IA",
|
||||||
|
"AI search": "Búsqueda de IA",
|
||||||
|
"AI Answer": "Respuesta de IA",
|
||||||
|
"Ask AI": "Preguntar a IA",
|
||||||
|
"AI is thinking...": "IA está pensando...",
|
||||||
|
"Ask a question...": "Haz una pregunta...",
|
||||||
|
"AI-powered search (Ask AI)": "Búsqueda impulsada por IA (Preguntar a IA)",
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.": "La búsqueda de IA utiliza incrustaciones vectoriales para proporcionar capacidades de búsqueda semántica en todo el contenido de su espacio de trabajo.",
|
||||||
|
"Toggle AI search": "Alternar búsqueda de IA",
|
||||||
|
"Sources": "Fuentes",
|
||||||
|
"Ask AI not available for attachments": "Preguntar a IA no está disponible para adjuntos",
|
||||||
|
"No answer available": "No hay respuesta disponible",
|
||||||
|
"Background color": "Color de fondo",
|
||||||
|
"Highlight color": "Color de resaltado",
|
||||||
|
"Remove color": "Eliminar color"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -527,5 +527,47 @@
|
|||||||
"Delete SSO provider": "Supprimer le fournisseur SSO",
|
"Delete SSO provider": "Supprimer le fournisseur SSO",
|
||||||
"Are you sure you want to delete this SSO provider?": "Êtes-vous sûr de vouloir supprimer ce fournisseur SSO ?",
|
"Are you sure you want to delete this SSO provider?": "Êtes-vous sûr de vouloir supprimer ce fournisseur SSO ?",
|
||||||
"Action": "Action",
|
"Action": "Action",
|
||||||
"{{ssoProviderType}} configuration": "Configuration {{ssoProviderType}}"
|
"{{ssoProviderType}} configuration": "Configuration {{ssoProviderType}}",
|
||||||
|
"Icon": "Icône",
|
||||||
|
"Upload image": "Téléverser une image",
|
||||||
|
"Remove image": "Supprimer l'image",
|
||||||
|
"Failed to remove image": "Échec de la suppression de l'image",
|
||||||
|
"Image exceeds 10MB limit.": "L'image dépasse la limite de 10 Mo.",
|
||||||
|
"Image removed successfully": "Image supprimée avec succès",
|
||||||
|
"API key": "Clé API",
|
||||||
|
"API key created successfully": "Clé API créée avec succès",
|
||||||
|
"API keys": "Clés API",
|
||||||
|
"API management": "Gestion des API",
|
||||||
|
"Are you sure you want to revoke this API key": "Êtes-vous sûr de vouloir révoquer cette clé API",
|
||||||
|
"Create API Key": "Créer une clé API",
|
||||||
|
"Custom expiration date": "Date d'expiration personnalisée",
|
||||||
|
"Enter a descriptive token name": "Entrez un nom descriptif pour le jeton",
|
||||||
|
"Expiration": "Expiration",
|
||||||
|
"Expired": "Expiré(e)",
|
||||||
|
"Expires": "Expire",
|
||||||
|
"I've saved my API key": "J'ai enregistré ma clé API",
|
||||||
|
"Last use": "Dernière utilisation",
|
||||||
|
"No API keys found": "Aucune clé API trouvée",
|
||||||
|
"No expiration": "Pas d'expiration",
|
||||||
|
"Revoke API key": "Révoquer la clé API",
|
||||||
|
"Revoked successfully": "Révoqué(e) avec succès",
|
||||||
|
"Select expiration date": "Sélectionnez la date d'expiration",
|
||||||
|
"This action cannot be undone. Any applications using this API key will stop working.": "Cette action ne peut pas être annulée. Toutes les applications utilisant cette clé API cesseront de fonctionner.",
|
||||||
|
"Update API key": "Mettre à jour la clé API",
|
||||||
|
"Manage API keys for all users in the workspace": "Gérer les clés API pour tous les utilisateurs dans l'espace de travail",
|
||||||
|
"AI settings": "Paramètres de l'IA",
|
||||||
|
"AI search": "Recherche IA",
|
||||||
|
"AI Answer": "Réponse IA",
|
||||||
|
"Ask AI": "Demander à l'IA",
|
||||||
|
"AI is thinking...": "L'IA réfléchit...",
|
||||||
|
"Ask a question...": "Posez une question...",
|
||||||
|
"AI-powered search (Ask AI)": "Recherche assistée par l'IA (Demander à l'IA)",
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.": "La recherche IA utilise des incorporations vectorielles pour fournir des capacités de recherche sémantique à travers le contenu de votre espace de travail.",
|
||||||
|
"Toggle AI search": "Basculer la recherche IA",
|
||||||
|
"Sources": "Sources",
|
||||||
|
"Ask AI not available for attachments": "Demande à l'IA non disponible pour les pièces jointes",
|
||||||
|
"No answer available": "Pas de réponse disponible",
|
||||||
|
"Background color": "Couleur de fond",
|
||||||
|
"Highlight color": "Couleur de surbrillance",
|
||||||
|
"Remove color": "Supprimer la couleur"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -527,5 +527,47 @@
|
|||||||
"Delete SSO provider": "Elimina provider SSO",
|
"Delete SSO provider": "Elimina provider SSO",
|
||||||
"Are you sure you want to delete this SSO provider?": "Sei sicuro di voler eliminare questo provider SSO?",
|
"Are you sure you want to delete this SSO provider?": "Sei sicuro di voler eliminare questo provider SSO?",
|
||||||
"Action": "Azione",
|
"Action": "Azione",
|
||||||
"{{ssoProviderType}} configuration": "Configurazione {{ssoProviderType}}"
|
"{{ssoProviderType}} configuration": "Configurazione {{ssoProviderType}}",
|
||||||
|
"Icon": "Icona",
|
||||||
|
"Upload image": "Carica immagine",
|
||||||
|
"Remove image": "Rimuovi immagine",
|
||||||
|
"Failed to remove image": "Rimozione immagine fallita",
|
||||||
|
"Image exceeds 10MB limit.": "L'immagine supera il limite di 10MB.",
|
||||||
|
"Image removed successfully": "Immagine rimossa con successo",
|
||||||
|
"API key": "Chiave API",
|
||||||
|
"API key created successfully": "Chiave API creata con successo",
|
||||||
|
"API keys": "Chiavi API",
|
||||||
|
"API management": "Gestione API",
|
||||||
|
"Are you sure you want to revoke this API key": "Sei sicuro di voler revocare questa chiave API",
|
||||||
|
"Create API Key": "Crea Chiave API",
|
||||||
|
"Custom expiration date": "Data di scadenza personalizzata",
|
||||||
|
"Enter a descriptive token name": "Inserisci un nome descrittivo del token",
|
||||||
|
"Expiration": "Scadenza",
|
||||||
|
"Expired": "Scaduto",
|
||||||
|
"Expires": "Scade",
|
||||||
|
"I've saved my API key": "Ho salvato la mia chiave API",
|
||||||
|
"Last use": "Ultimo utilizzo",
|
||||||
|
"No API keys found": "Nessuna chiave API trovata",
|
||||||
|
"No expiration": "Nessuna scadenza",
|
||||||
|
"Revoke API key": "Revoca chiave API",
|
||||||
|
"Revoked successfully": "Revocata con successo",
|
||||||
|
"Select expiration date": "Seleziona la data di scadenza",
|
||||||
|
"This action cannot be undone. Any applications using this API key will stop working.": "Questa azione non può essere annullata. Qualsiasi applicazione che utilizza questa chiave API smetterà di funzionare.",
|
||||||
|
"Update API key": "Aggiorna chiave API",
|
||||||
|
"Manage API keys for all users in the workspace": "Gestisci le chiavi API per tutti gli utenti nell'area di lavoro",
|
||||||
|
"AI settings": "Impostazioni AI",
|
||||||
|
"AI search": "Ricerca AI",
|
||||||
|
"AI Answer": "Risposta AI",
|
||||||
|
"Ask AI": "Chiedi all'AI",
|
||||||
|
"AI is thinking...": "L'AI sta pensando...",
|
||||||
|
"Ask a question...": "Fai una domanda...",
|
||||||
|
"AI-powered search (Ask AI)": "Ricerca potenziata dall'AI (Chiedi all'AI)",
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.": "La ricerca AI utilizza embeddings vettoriali per fornire capacità di ricerca semantica nel contenuto della tua area di lavoro.",
|
||||||
|
"Toggle AI search": "Attiva/disattiva ricerca AI",
|
||||||
|
"Sources": "Fonti",
|
||||||
|
"Ask AI not available for attachments": "Chiedere all'AI non è disponibile per gli allegati",
|
||||||
|
"No answer available": "Nessuna risposta disponibile",
|
||||||
|
"Background color": "Colore di sfondo",
|
||||||
|
"Highlight color": "Colore evidenziato",
|
||||||
|
"Remove color": "Rimuovi colore"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,21 +13,21 @@
|
|||||||
"Are you sure you want to remove this user from the group? The user will lose access to resources this group has access to.": "このユーザをグループから削除してもよろしいですか? ユーザはこのグループがアクセス権を持つリソースにアクセスできなくなります。",
|
"Are you sure you want to remove this user from the group? The user will lose access to resources this group has access to.": "このユーザをグループから削除してもよろしいですか? ユーザはこのグループがアクセス権を持つリソースにアクセスできなくなります。",
|
||||||
"Are you sure you want to remove this user from the space? The user will lose all access to this space.": "このユーザをスペースから削除してもよろしいですか? ユーザはこのスペースへのアクセス権をすべて失います。",
|
"Are you sure you want to remove this user from the space? The user will lose all access to this space.": "このユーザをスペースから削除してもよろしいですか? ユーザはこのスペースへのアクセス権をすべて失います。",
|
||||||
"Are you sure you want to restore this version? Any changes not versioned will be lost.": "このバージョンを復元してもよろしいですか? バージョン管理されていない変更は失われます。",
|
"Are you sure you want to restore this version? Any changes not versioned will be lost.": "このバージョンを復元してもよろしいですか? バージョン管理されていない変更は失われます。",
|
||||||
"Can become members of groups and spaces in workspace": "ワークスペース内のグループやスペースのメンバーになることができます",
|
"Can become members of groups and spaces in workspace": "ワークスペース内のグループやスペースのメンバーになれます",
|
||||||
"Can create and edit pages in space.": "スペース内のページを作成および編集できます。",
|
"Can create and edit pages in space.": "スペース内のページを作成・編集できます",
|
||||||
"Can edit": "編集可能",
|
"Can edit": "編集可能",
|
||||||
"Can manage workspace": "ワークスペースを管理できます",
|
"Can manage workspace": "ワークスペースを管理できます",
|
||||||
"Can manage workspace but cannot delete it": "ワークスペースを管理できますが、削除はできません",
|
"Can manage workspace but cannot delete it": "ワークスペースを管理できますが削除はできません",
|
||||||
"Can view": "閲覧可能",
|
"Can view": "閲覧可能",
|
||||||
"Can view pages in space but not edit.": "スペース内のページを閲覧できますが、編集はできません。",
|
"Can view pages in space but not edit.": "スペース内のページを閲覧できますが編集はできません",
|
||||||
"Cancel": "キャンセル",
|
"Cancel": "キャンセル",
|
||||||
"Change email": "メールアドレスの変更",
|
"Change email": "メールアドレスの変更",
|
||||||
"Change password": "パスワードの変更",
|
"Change password": "パスワードの変更",
|
||||||
"Change photo": "画像の変更",
|
"Change photo": "画像の変更",
|
||||||
"Choose a role": "ロールを選んでください",
|
"Choose a role": "ロールを選んでください",
|
||||||
"Choose your preferred color scheme.": "お好みのカラースキームを選択してください。",
|
"Choose your preferred color scheme.": "お好みのカラースキームを選択してください",
|
||||||
"Choose your preferred interface language.": "お好みのインターフェース言語を選択してください。",
|
"Choose your preferred interface language.": "お好みの言語を選択してください",
|
||||||
"Choose your preferred page width.": "左右の余白を縮小する場合はオンにしてください。",
|
"Choose your preferred page width.": "お好みのページ幅を選択してください",
|
||||||
"Confirm": "確認",
|
"Confirm": "確認",
|
||||||
"Copy link": "リンクをコピー",
|
"Copy link": "リンクをコピー",
|
||||||
"Create": "新規作成",
|
"Create": "新規作成",
|
||||||
@@ -40,24 +40,24 @@
|
|||||||
"Date": "日付",
|
"Date": "日付",
|
||||||
"Delete": "削除",
|
"Delete": "削除",
|
||||||
"Delete group": "グループを削除",
|
"Delete group": "グループを削除",
|
||||||
"Are you sure you want to delete this page? This will delete its children and page history. This action is irreversible.": "このページを削除してもよろしいですか?この操作により、子ページおよびページ履歴が削除されます。この操作は元に戻せません。",
|
"Are you sure you want to delete this page? This will delete its children and page history. This action is irreversible.": "このページを削除してもよろしいですか?子ページとページ履歴も削除されます。この操作は取り消せません。",
|
||||||
"Description": "説明",
|
"Description": "説明",
|
||||||
"Details": "詳細",
|
"Details": "詳細",
|
||||||
"e.g ACME": "例: 山田太郎",
|
"e.g ACME": "例: 山田太郎",
|
||||||
"e.g ACME Inc": "例: 株式会社サンプル",
|
"e.g ACME Inc": "例: 株式会社サンプル",
|
||||||
"e.g Developers": "例: エンジニア",
|
"e.g Developers": "例: エンジニア",
|
||||||
"e.g Group for developers": "例: エンジニアグループ",
|
"e.g Group for developers": "例: 開発チーム",
|
||||||
"e.g product": "例: product",
|
"e.g product": "例: product",
|
||||||
"e.g Product Team": "例: 製品チーム",
|
"e.g Product Team": "例: プロダクトチーム",
|
||||||
"e.g Sales": "例: 営業",
|
"e.g Sales": "例: 営業部",
|
||||||
"e.g Space for product team": "例: 製品チームのスペース",
|
"e.g Space for product team": "例: プロダクトチーム用スペース",
|
||||||
"e.g Space for sales team to collaborate": "例: 営業チーム連携用スペース",
|
"e.g Space for sales team to collaborate": "例: 営業チーム用スペース",
|
||||||
"Edit": "編集",
|
"Edit": "編集",
|
||||||
"Read": "読む",
|
"Read": "閲覧",
|
||||||
"Edit group": "グループを編集",
|
"Edit group": "グループを編集",
|
||||||
"Email": "メールアドレス",
|
"Email": "メールアドレス",
|
||||||
"Enter a strong password": "強力なパスワードを入力してください",
|
"Enter a strong password": "強力なパスワードを入力してください",
|
||||||
"Enter valid email addresses separated by comma or space max_50": "有効なメールアドレスをカンマまたはスペースで区切って入力してください(最大 50 個)",
|
"Enter valid email addresses separated by comma or space max_50": "メールアドレスをカンマまたはスペース区切りで入力(最大50件)",
|
||||||
"enter valid emails addresses": "有効なメールアドレスを入力してください",
|
"enter valid emails addresses": "有効なメールアドレスを入力してください",
|
||||||
"Enter your current password": "現在のパスワードを入力してください",
|
"Enter your current password": "現在のパスワードを入力してください",
|
||||||
"enter your full name": "氏名を入力してください",
|
"enter your full name": "氏名を入力してください",
|
||||||
@@ -81,18 +81,18 @@
|
|||||||
"Group description": "グループ説明",
|
"Group description": "グループ説明",
|
||||||
"Group name": "グループ名",
|
"Group name": "グループ名",
|
||||||
"Groups": "グループ",
|
"Groups": "グループ",
|
||||||
"Has full access to space settings and pages.": "スペース設定とページにフルアクセスできます。",
|
"Has full access to space settings and pages.": "スペース設定とページにフルアクセスできます",
|
||||||
"Home": "ホーム",
|
"Home": "ホーム",
|
||||||
"Import pages": "ページをインポート",
|
"Import pages": "ページをインポート",
|
||||||
"Import pages & space settings": "ページとスペース設定をインポート",
|
"Import pages & space settings": "ページとスペース設定をインポート",
|
||||||
"Importing pages": "ページをインポートしています",
|
"Importing pages": "ページをインポートしています",
|
||||||
"invalid invitation link": "招待リンクが間違っています",
|
"invalid invitation link": "無効な招待リンクです",
|
||||||
"Invitation signup": "招待登録",
|
"Invitation signup": "招待登録",
|
||||||
"Invite by email": "メールアドレスで招待する",
|
"Invite by email": "メールアドレスで招待する",
|
||||||
"Invite members": "メンバーを招待する",
|
"Invite members": "メンバーを招待する",
|
||||||
"Invite new members": "新しいメンバーを招待する",
|
"Invite new members": "新しいメンバーを招待する",
|
||||||
"Invited members who are yet to accept their invitation will appear here.": "招待をまだ承諾していないメンバーはここに表示されます。",
|
"Invited members who are yet to accept their invitation will appear here.": "招待を承諾していないメンバーがここに表示されます",
|
||||||
"Invited members will be granted access to spaces the groups can access": "招待されたメンバーは、グループがアクセスできるスペースにアクセス権が付与されます",
|
"Invited members will be granted access to spaces the groups can access": "招待されたメンバーはグループがアクセスできるスペースにアクセスできます",
|
||||||
"Join the workspace": "ワークスペースに参加",
|
"Join the workspace": "ワークスペースに参加",
|
||||||
"Language": "言語",
|
"Language": "言語",
|
||||||
"Light": "ライト",
|
"Light": "ライト",
|
||||||
@@ -113,20 +113,20 @@
|
|||||||
"New page": "新規ページ",
|
"New page": "新規ページ",
|
||||||
"New password": "新しいパスワード",
|
"New password": "新しいパスワード",
|
||||||
"No group found": "グループが見つかりません",
|
"No group found": "グループが見つかりません",
|
||||||
"No page history saved yet.": "まだページの履歴が保存されていません。",
|
"No page history saved yet.": "ページ履歴がありません",
|
||||||
"No pages yet": "ページがありません",
|
"No pages yet": "ページがありません",
|
||||||
"No results found...": "結果が見つかりませんでした...",
|
"No results found...": "結果が見つかりません",
|
||||||
"No user found": "ユーザがいません",
|
"No user found": "ユーザーが見つかりません",
|
||||||
"Overview": "概要",
|
"Overview": "概要",
|
||||||
"Owner": "所有者",
|
"Owner": "所有者",
|
||||||
"page": "ページ",
|
"page": "ページ",
|
||||||
"Page deleted successfully": "ページが正常に削除されました",
|
"Page deleted successfully": "ページを削除しました",
|
||||||
"Page history": "ページの履歴",
|
"Page history": "ページ履歴",
|
||||||
"Page import is in progress. Please do not close this tab.": "ページのインポートが進行中です。このタブを閉じないでください。",
|
"Page import is in progress. Please do not close this tab.": "ページをインポート中です。このタブを閉じないでください",
|
||||||
"Pages": "ページ",
|
"Pages": "ページ",
|
||||||
"pages": "ページ",
|
"pages": "ページ",
|
||||||
"Password": "パスワード",
|
"Password": "パスワード",
|
||||||
"Password changed successfully": "パスワードが正常に変更されました",
|
"Password changed successfully": "パスワードを変更しました",
|
||||||
"Pending": "保留中",
|
"Pending": "保留中",
|
||||||
"Please confirm your action": "アクションを確認してください",
|
"Please confirm your action": "アクションを確認してください",
|
||||||
"Preferences": "設定",
|
"Preferences": "設定",
|
||||||
@@ -143,95 +143,95 @@
|
|||||||
"Search for groups": "グループを検索",
|
"Search for groups": "グループを検索",
|
||||||
"Search for users": "ユーザーを検索",
|
"Search for users": "ユーザーを検索",
|
||||||
"Search for users and groups": "ユーザーとグループを検索",
|
"Search for users and groups": "ユーザーとグループを検索",
|
||||||
"Search...": "検索する語句を入力",
|
"Search...": "検索",
|
||||||
"Select language": "言語を選択",
|
"Select language": "言語を選択",
|
||||||
"Select role": "ロールを選択",
|
"Select role": "ロールを選択",
|
||||||
"Select role to assign to all invited members": "招待されたすべてのメンバーに割り当てるロールを選択してください",
|
"Select role to assign to all invited members": "招待するメンバーに割り当てるロールを選択",
|
||||||
"Select theme": "テーマを選択",
|
"Select theme": "テーマを選択",
|
||||||
"Send invitation": "招待を送る",
|
"Send invitation": "招待を送る",
|
||||||
"Invitation sent": "招待が送信されました",
|
"Invitation sent": "招待を送信しました",
|
||||||
"Settings": "設定",
|
"Settings": "設定",
|
||||||
"Setup workspace": "ワークスペースを設定する",
|
"Setup workspace": "ワークスペースを設定する",
|
||||||
"Sign In": "サインイン",
|
"Sign In": "サインイン",
|
||||||
"Sign Up": "アカウント登録",
|
"Sign Up": "新規登録",
|
||||||
"Slug": "Slug (URL用文字列)",
|
"Slug": "スラッグ(URL識別子)",
|
||||||
"Space": "スペース",
|
"Space": "スペース",
|
||||||
"Space description": "スペース説明",
|
"Space description": "スペース説明",
|
||||||
"Space menu": "スペースメニュー",
|
"Space menu": "スペースメニュー",
|
||||||
"Space name": "スペース名",
|
"Space name": "スペース名",
|
||||||
"Space settings": "スペース設定",
|
"Space settings": "スペース設定",
|
||||||
"Space slug": "スペースのSlug (URL用文字列)",
|
"Space slug": "スペースのスラッグ(URL識別子)",
|
||||||
"Spaces": "スペース",
|
"Spaces": "スペース",
|
||||||
"Spaces you belong to": "所属しているスペース",
|
"Spaces you belong to": "所属しているスペース",
|
||||||
"No space found": "スペースが見つかりません",
|
"No space found": "スペースが見つかりません",
|
||||||
"Search for spaces": "スペースを検索",
|
"Search for spaces": "スペースを検索",
|
||||||
"Start typing to search...": "検索を開始するには入力してください...",
|
"Start typing to search...": "入力して検索",
|
||||||
"Status": "ステータス",
|
"Status": "ステータス",
|
||||||
"Successfully imported": "インポートに成功しました",
|
"Successfully imported": "インポートしました",
|
||||||
"Successfully restored": "正常に復元されました",
|
"Successfully restored": "復元しました",
|
||||||
"System settings": "システム設定",
|
"System settings": "システム設定",
|
||||||
"Theme": "テーマ",
|
"Theme": "テーマ",
|
||||||
"To change your email, you have to enter your password and new email.": "メールアドレスを変更するには、パスワードと新しいメールアドレスを入力する必要があります。",
|
"To change your email, you have to enter your password and new email.": "メールアドレスを変更するには、パスワードと新しいメールアドレスを入力してください",
|
||||||
"Toggle full page width": "ページ幅を切り替える",
|
"Toggle full page width": "ページ幅を切り替え",
|
||||||
"Unable to import pages. Please try again.": "ページをインポートできません。もう一度お試しください。",
|
"Unable to import pages. Please try again.": "ページをインポートできませんでした。もう一度お試しください",
|
||||||
"untitled": "無題",
|
"untitled": "無題",
|
||||||
"Untitled": "無題",
|
"Untitled": "無題",
|
||||||
"Updated successfully": "正常に更新されました",
|
"Updated successfully": "更新しました",
|
||||||
"User": "ユーザー",
|
"User": "ユーザー",
|
||||||
"Workspace": "ワークスペース",
|
"Workspace": "ワークスペース",
|
||||||
"Workspace Name": "ワークスペース名",
|
"Workspace Name": "ワークスペース名",
|
||||||
"Workspace settings": "ワークスペース設定",
|
"Workspace settings": "ワークスペース設定",
|
||||||
"You can change your password here.": "パスワードを変更できます。",
|
"You can change your password here.": "パスワードを変更できます",
|
||||||
"Your Email": "メールアドレス",
|
"Your Email": "メールアドレス",
|
||||||
"Your import is complete.": "インポートが完了しました。",
|
"Your import is complete.": "インポートが完了しました",
|
||||||
"Your name": "名前",
|
"Your name": "名前",
|
||||||
"Your Name": "名前",
|
"Your Name": "名前",
|
||||||
"Your password": "パスワード",
|
"Your password": "パスワード",
|
||||||
"Your password must be a minimum of 8 characters.": "パスワードは最低 8 文字必要です。",
|
"Your password must be a minimum of 8 characters.": "パスワードは8文字以上にしてください",
|
||||||
"Sidebar toggle": "サイドバー切り替え",
|
"Sidebar toggle": "サイドバー切り替え",
|
||||||
"Comments": "コメント",
|
"Comments": "コメント",
|
||||||
"404 page not found": "404 ページが見つかりません",
|
"404 page not found": "404 ページが見つかりません",
|
||||||
"Sorry, we can't find the page you are looking for.": "お探しのページが見つかりません。",
|
"Sorry, we can't find the page you are looking for.": "お探しのページが見つかりません",
|
||||||
"Take me back to homepage": "ホームに戻る",
|
"Take me back to homepage": "ホームに戻る",
|
||||||
"Forgot password": "パスワードを忘れた",
|
"Forgot password": "パスワードを忘れた",
|
||||||
"Forgot your password?": "パスワードを忘れましたか?",
|
"Forgot your password?": "パスワードを忘れましたか?",
|
||||||
"A password reset link has been sent to your email. Please check your inbox.": "パスワードリセットリンクがあなたのメールアドレスに送信されました。受信箱を確認してください。",
|
"A password reset link has been sent to your email. Please check your inbox.": "パスワードリセット用のリンクをメールに送信しました。受信トレイを確認してください",
|
||||||
"Send reset link": "リセットリンクを送る",
|
"Send reset link": "リセットリンクを送信",
|
||||||
"Password reset": "パスワードリセット",
|
"Password reset": "パスワードリセット",
|
||||||
"Your new password": "新しいパスワード",
|
"Your new password": "新しいパスワード",
|
||||||
"Set password": "パスワードを設定",
|
"Set password": "パスワードを設定",
|
||||||
"Write a comment": "コメントを書く",
|
"Write a comment": "コメントを書く",
|
||||||
"Reply...": "返信...",
|
"Reply...": "返信...",
|
||||||
"Error loading comments.": "コメントの読み込み中にエラーが発生しました。",
|
"Error loading comments.": "コメントの読み込みに失敗しました",
|
||||||
"No comments yet.": "コメントがありません。",
|
"No comments yet.": "コメントがありません",
|
||||||
"Edit comment": "コメントを編集する",
|
"Edit comment": "コメントを編集する",
|
||||||
"Delete comment": "コメントを削除する",
|
"Delete comment": "コメントを削除する",
|
||||||
"Are you sure you want to delete this comment?": "このコメントを削除してもよろしいですか?",
|
"Are you sure you want to delete this comment?": "このコメントを削除してもよろしいですか?",
|
||||||
"Comment created successfully": "コメントが作成されました",
|
"Comment created successfully": "コメントを作成しました",
|
||||||
"Error creating comment": "コメントの作成中にエラーが発生しました",
|
"Error creating comment": "コメントの作成に失敗しました",
|
||||||
"Comment updated successfully": "コメントが更新されました",
|
"Comment updated successfully": "コメントを更新しました",
|
||||||
"Failed to update comment": "コメントの更新に失敗しました",
|
"Failed to update comment": "コメントの更新に失敗しました",
|
||||||
"Comment deleted successfully": "コメントが削除されました",
|
"Comment deleted successfully": "コメントを削除しました",
|
||||||
"Failed to delete comment": "コメントの削除に失敗しました",
|
"Failed to delete comment": "コメントの削除に失敗しました",
|
||||||
"Comment resolved successfully": "コメントが解決されました",
|
"Comment resolved successfully": "コメントを解決しました",
|
||||||
"Comment re-opened successfully": "コメントが再開されました",
|
"Comment re-opened successfully": "コメントを再開しました",
|
||||||
"Comment unresolved successfully": "コメントが再解決されました",
|
"Comment unresolved successfully": "コメントを未解決に戻しました",
|
||||||
"Failed to resolve comment": "コメントの解決に失敗しました",
|
"Failed to resolve comment": "コメントの解決に失敗しました",
|
||||||
"Resolve comment": "コメントを解決",
|
"Resolve comment": "コメントを解決",
|
||||||
"Unresolve comment": "コメントを再解決",
|
"Unresolve comment": "コメントを未解決に戻す",
|
||||||
"Resolve Comment Thread": "コメントスレッドを解決",
|
"Resolve Comment Thread": "コメントスレッドを解決",
|
||||||
"Unresolve Comment Thread": "コメントスレッドを再解決",
|
"Unresolve Comment Thread": "コメントスレッドを未解決に戻す",
|
||||||
"Are you sure you want to resolve this comment thread? This will mark it as completed.": "このコメントスレッドを解決しますか? これにより完了としてマークされます。",
|
"Are you sure you want to resolve this comment thread? This will mark it as completed.": "このコメントスレッドを解決しますか?完了としてマークされます",
|
||||||
"Are you sure you want to unresolve this comment thread?": "このコメントスレッドを再解決しますか?",
|
"Are you sure you want to unresolve this comment thread?": "このコメントスレッドを未解決に戻しますか?",
|
||||||
"Resolved": "解決済",
|
"Resolved": "解決済",
|
||||||
"No active comments.": "アクティブなコメントはありません。",
|
"No active comments.": "アクティブなコメントはありません",
|
||||||
"No resolved comments.": "解決されたコメントはありません。",
|
"No resolved comments.": "解決済みのコメントはありません",
|
||||||
"Revoke invitation": "招待を取り消す",
|
"Revoke invitation": "招待を取り消す",
|
||||||
"Revoke": "取り消す",
|
"Revoke": "取り消す",
|
||||||
"Don't": "取り消さない",
|
"Don't": "取り消さない",
|
||||||
"Are you sure you want to revoke this invitation? The user will not be able to join the workspace.": "この招待を取り消してもよろしいですか? ユーザはワークスペースに参加できなくなります。",
|
"Are you sure you want to revoke this invitation? The user will not be able to join the workspace.": "この招待を取り消してもよろしいですか?ユーザーはワークスペースに参加できなくなります",
|
||||||
"Resend invitation": "招待を再度送る",
|
"Resend invitation": "招待を再度送る",
|
||||||
"Anyone with this link can join this workspace.": "このリンクを持っている人は誰でもこのワークスペースに参加できます。",
|
"Anyone with this link can join this workspace.": "このリンクを知っている人は誰でもワークスペースに参加できます",
|
||||||
"Invite link": "招待リンク",
|
"Invite link": "招待リンク",
|
||||||
"Copy": "コピー",
|
"Copy": "コピー",
|
||||||
"Copy to space": "スペースにコピー",
|
"Copy to space": "スペースにコピー",
|
||||||
@@ -239,13 +239,13 @@
|
|||||||
"Duplicate": "複製",
|
"Duplicate": "複製",
|
||||||
"Select a user": "ユーザを選択",
|
"Select a user": "ユーザを選択",
|
||||||
"Select a group": "グループを選択",
|
"Select a group": "グループを選択",
|
||||||
"Export all pages and attachments in this space.": "このスペースのすべてのページと添付ファイルをエクスポートします。",
|
"Export all pages and attachments in this space.": "このスペースのすべてのページと添付ファイルをエクスポートします",
|
||||||
"Delete space": "スペースを削除",
|
"Delete space": "スペースを削除",
|
||||||
"Are you sure you want to delete this space?": "このスペースを削除してもよろしいですか?",
|
"Are you sure you want to delete this space?": "このスペースを削除してもよろしいですか?",
|
||||||
"Delete this space with all its pages and data.": "このスペースおよびスペース内のすべてのページとデータを削除します。",
|
"Delete this space with all its pages and data.": "このスペースとすべてのページ、データを削除します",
|
||||||
"All pages, comments, attachments and permissions in this space will be deleted irreversibly.": "このスペース内のすべてのページ、コメント、添付ファイル、および権限は完全に削除されます。",
|
"All pages, comments, attachments and permissions in this space will be deleted irreversibly.": "スペース内のすべてのページ、コメント、添付ファイル、権限が完全に削除されます",
|
||||||
"Confirm space name": "スペース名を確認する",
|
"Confirm space name": "スペース名を確認する",
|
||||||
"Type the space name <b>{{spaceName}}</b> to confirm your action.": "アクションを確認するためにスペース名 <b>{{spaceName}}</b> を入力してください。",
|
"Type the space name <b>{{spaceName}}</b> to confirm your action.": "確認のためスペース名 <b>{{spaceName}}</b> を入力してください",
|
||||||
"Format": "フォーマット",
|
"Format": "フォーマット",
|
||||||
"Include subpages": "サブページを含める",
|
"Include subpages": "サブページを含める",
|
||||||
"Include attachments": "添付ファイルを含める",
|
"Include attachments": "添付ファイルを含める",
|
||||||
@@ -273,12 +273,12 @@
|
|||||||
"Success": "成功",
|
"Success": "成功",
|
||||||
"Warning": "警告",
|
"Warning": "警告",
|
||||||
"Danger": "危険",
|
"Danger": "危険",
|
||||||
"Mermaid diagram error:": "Mermaid コードエラー",
|
"Mermaid diagram error:": "Mermaid ダイアグラムエラー:",
|
||||||
"Invalid Mermaid diagram": "無効な Mermaid コードです",
|
"Invalid Mermaid diagram": "無効な Mermaid ダイアグラムです",
|
||||||
"Double-click to edit Draw.io diagram": "ダブルクリックしてDraw.ioの図を編集",
|
"Double-click to edit Draw.io diagram": "ダブルクリックして Draw.io 図を編集",
|
||||||
"Exit": "終了",
|
"Exit": "終了",
|
||||||
"Save & Exit": "保存して終了",
|
"Save & Exit": "保存して終了",
|
||||||
"Double-click to edit Excalidraw diagram": "ダブルクリックしてExcalidraw図を編集",
|
"Double-click to edit Excalidraw diagram": "ダブルクリックして Excalidraw 図を編集",
|
||||||
"Paste link": "リンクを貼り付け",
|
"Paste link": "リンクを貼り付け",
|
||||||
"Edit link": "リンクを編集",
|
"Edit link": "リンクを編集",
|
||||||
"Remove link": "リンクを削除",
|
"Remove link": "リンクを削除",
|
||||||
@@ -315,22 +315,22 @@
|
|||||||
"Bullet List": "箇条書きリスト",
|
"Bullet List": "箇条書きリスト",
|
||||||
"Numbered List": "番号付きリスト",
|
"Numbered List": "番号付きリスト",
|
||||||
"Blockquote": "引用",
|
"Blockquote": "引用",
|
||||||
"Just start typing with plain text.": "すぐに文章を書き始められます。",
|
"Just start typing with plain text.": "プレーンテキストを入力します",
|
||||||
"Track tasks with a to-do list.": "Todoリストでタスクを追跡します。",
|
"Track tasks with a to-do list.": "Todo リストでタスクを管理します",
|
||||||
"Big section heading.": "大きいフォントのセクション見出しです。",
|
"Big section heading.": "大見出し",
|
||||||
"Medium section heading.": "中くらいのフォントのセクション見出しです。",
|
"Medium section heading.": "中見出し",
|
||||||
"Small section heading.": "小さいフォントのセクション見出しです。",
|
"Small section heading.": "小見出し",
|
||||||
"Create a simple bullet list.": "シンプルな箇条書きのリストを作成します。",
|
"Create a simple bullet list.": "箇条書きリストを作成します",
|
||||||
"Create a list with numbering.": "番号付きのリストを作成します。",
|
"Create a list with numbering.": "番号付きリストを作成します",
|
||||||
"Create block quote.": "引用文を作成します。",
|
"Create block quote.": "引用ブロックを作成します",
|
||||||
"Insert code snippet.": "コードスニペットを入力します。",
|
"Insert code snippet.": "コードスニペットを挿入します",
|
||||||
"Insert horizontal rule divider": "水平線を挿入します。",
|
"Insert horizontal rule divider": "区切り線を挿入します",
|
||||||
"Upload any image from your device.": "画像をアップロードします。",
|
"Upload any image from your device.": "デバイスから画像をアップロードします",
|
||||||
"Upload any video from your device.": "動画をアップロードします。",
|
"Upload any video from your device.": "デバイスから動画をアップロードします",
|
||||||
"Upload any file from your device.": "ファイルをアップロードします。",
|
"Upload any file from your device.": "デバイスからファイルをアップロードします",
|
||||||
"Table": "テーブル",
|
"Table": "テーブル",
|
||||||
"Insert a table.": "表を挿入します。",
|
"Insert a table.": "テーブルを挿入します",
|
||||||
"Insert collapsible block.": "折りたたみ可能なブロックを挿入します。",
|
"Insert collapsible block.": "折りたたみブロックを挿入します",
|
||||||
"Video": "動画",
|
"Video": "動画",
|
||||||
"Divider": "区切り線",
|
"Divider": "区切り線",
|
||||||
"Quote": "引用",
|
"Quote": "引用",
|
||||||
@@ -338,16 +338,16 @@
|
|||||||
"File attachment": "ファイル添付",
|
"File attachment": "ファイル添付",
|
||||||
"Toggle block": "ブロックを切り替える",
|
"Toggle block": "ブロックを切り替える",
|
||||||
"Callout": "コールアウト",
|
"Callout": "コールアウト",
|
||||||
"Insert callout notice.": "コールアウトブロックを挿入します。",
|
"Insert callout notice.": "コールアウトを挿入します",
|
||||||
"Math inline": "インライン数式",
|
"Math inline": "インライン数式",
|
||||||
"Insert inline math equation.": "インライン数式を挿入します。",
|
"Insert inline math equation.": "インライン数式を挿入します",
|
||||||
"Math block": "数式ブロック",
|
"Math block": "数式ブロック",
|
||||||
"Insert math equation": "数式を挿入します",
|
"Insert math equation": "数式を挿入します",
|
||||||
"Mermaid diagram": "Mermaidコード",
|
"Mermaid diagram": "Mermaid ダイアグラム",
|
||||||
"Insert mermaid diagram": "Mermaidコードを記述して図を挿入します",
|
"Insert mermaid diagram": "Mermaid ダイアグラムを挿入します",
|
||||||
"Insert and design Drawio diagrams": "Drawioの図を挿入してデザインします",
|
"Insert and design Drawio diagrams": "Draw.io 図を挿入・編集します",
|
||||||
"Insert current date": "今日の日付を挿入します",
|
"Insert current date": "現在の日付を挿入します",
|
||||||
"Draw and sketch excalidraw diagrams": "Excalidrawの図を埋め込みます",
|
"Draw and sketch excalidraw diagrams": "Excalidraw 図を挿入します",
|
||||||
"Multiple": "複数",
|
"Multiple": "複数",
|
||||||
"Heading {{level}}": "見出し {{level}}",
|
"Heading {{level}}": "見出し {{level}}",
|
||||||
"Toggle title": "タイトルの表示/非表示を切り替える",
|
"Toggle title": "タイトルの表示/非表示を切り替える",
|
||||||
@@ -357,29 +357,29 @@
|
|||||||
"Yesterday, {{time}}": "昨日、{{time}}",
|
"Yesterday, {{time}}": "昨日、{{time}}",
|
||||||
"Space created successfully": "スペースを作成しました",
|
"Space created successfully": "スペースを作成しました",
|
||||||
"Space updated successfully": "スペースを更新しました",
|
"Space updated successfully": "スペースを更新しました",
|
||||||
"Space deleted successfully": "スペースが削除されました",
|
"Space deleted successfully": "スペースを削除しました",
|
||||||
"Members added successfully": "メンバーを追加しました",
|
"Members added successfully": "メンバーを追加しました",
|
||||||
"Member removed successfully": "メンバーが削除されました",
|
"Member removed successfully": "メンバーを削除しました",
|
||||||
"Member role updated successfully": "メンバーのロールを更新しました",
|
"Member role updated successfully": "メンバーのロールを更新しました",
|
||||||
"Created by: <b>{{creatorName}}</b>": "作成者: <b>{{creatorName}}</b>",
|
"Created by: <b>{{creatorName}}</b>": "作成者: <b>{{creatorName}}</b>",
|
||||||
"Created at: {{time}}": "が作成しました:{{time}}",
|
"Created at: {{time}}": "作成日: {{time}}",
|
||||||
"Edited by {{name}} {{time}}": "最終編集: {{name}} {{time}}",
|
"Edited by {{name}} {{time}}": "最終編集: {{name}} {{time}}",
|
||||||
"Word count: {{wordCount}}": "ワード数: {{wordCount}}",
|
"Word count: {{wordCount}}": "単語数: {{wordCount}}",
|
||||||
"Character count: {{characterCount}}": "文字数: {{characterCount}}",
|
"Character count: {{characterCount}}": "文字数: {{characterCount}}",
|
||||||
"New update": "新規更新",
|
"New update": "新規更新",
|
||||||
"{{latestVersion}} is available": "{{latestVersion}}は利用可能です",
|
"{{latestVersion}} is available": "{{latestVersion}} が利用可能です",
|
||||||
"Default page edit mode": "デフォルトのページ編集モード",
|
"Default page edit mode": "デフォルトのページ編集モード",
|
||||||
"Choose your preferred page edit mode. Avoid accidental edits.": "希望のページ編集モードを選択してください。誤って編集を防ぎます。",
|
"Choose your preferred page edit mode. Avoid accidental edits.": "お好みのページ編集モードを選択してください(誤編集を防止します)",
|
||||||
"Reading": "読み取り",
|
"Reading": "読み取り",
|
||||||
"Delete member": "メンバーを削除する",
|
"Delete member": "メンバーを削除する",
|
||||||
"Member deleted successfully": "メンバーが削除されました",
|
"Member deleted successfully": "メンバーを削除しました",
|
||||||
"Are you sure you want to delete this workspace member? This action is irreversible.": "ワークスペースメンバーを削除してもよろしいですか?この操作は元に戻せません。",
|
"Are you sure you want to delete this workspace member? This action is irreversible.": "このメンバーを削除してもよろしいですか?この操作は取り消せません",
|
||||||
"Move": "移動",
|
"Move": "移動",
|
||||||
"Move page": "ページを移動",
|
"Move page": "ページを移動",
|
||||||
"Move page to a different space.": "ページを別のスペースに移動します。",
|
"Move page to a different space.": "ページを別のスペースに移動します",
|
||||||
"Real-time editor connection lost. Retrying...": "リアルタイムエディターの接続が失われました。再試行しています…",
|
"Real-time editor connection lost. Retrying...": "リアルタイム編集の接続が切断されました。再接続中...",
|
||||||
"Table of contents": "目次",
|
"Table of contents": "目次",
|
||||||
"Add headings (H1, H2, H3) to generate a table of contents.": "見出し(H1、H2、H3)を追加して目次を生成します。",
|
"Add headings (H1, H2, H3) to generate a table of contents.": "見出し(H1、H2、H3)を追加すると目次が生成されます",
|
||||||
"Share": "共有",
|
"Share": "共有",
|
||||||
"Public sharing": "公開共有",
|
"Public sharing": "公開共有",
|
||||||
"Shared by": "共有者",
|
"Shared by": "共有者",
|
||||||
@@ -398,13 +398,13 @@
|
|||||||
"Delete share": "共有を削除",
|
"Delete share": "共有を削除",
|
||||||
"Are you sure you want to delete this shared link?": "この共有リンクを削除してもよろしいですか?",
|
"Are you sure you want to delete this shared link?": "この共有リンクを削除してもよろしいですか?",
|
||||||
"Publicly shared pages from spaces you are a member of will appear here": "メンバーであるスペースからの公開ページがここに表示されます",
|
"Publicly shared pages from spaces you are a member of will appear here": "メンバーであるスペースからの公開ページがここに表示されます",
|
||||||
"Share deleted successfully": "共有が正常に削除されました",
|
"Share deleted successfully": "共有を削除しました",
|
||||||
"Share not found": "共有が見つかりません",
|
"Share not found": "共有が見つかりません",
|
||||||
"Failed to share page": "ページの共有に失敗しました",
|
"Failed to share page": "ページの共有に失敗しました",
|
||||||
"Copy page": "ページをコピー",
|
"Copy page": "ページをコピー",
|
||||||
"Copy page to a different space.": "ページを別のスペースにコピーします。",
|
"Copy page to a different space.": "ページを別のスペースにコピーします",
|
||||||
"Page copied successfully": "ページのコピーに成功しました",
|
"Page copied successfully": "ページをコピーしました",
|
||||||
"Page duplicated successfully": "ページが正常に複製されました",
|
"Page duplicated successfully": "ページを複製しました",
|
||||||
"Find": "検索",
|
"Find": "検索",
|
||||||
"Not found": "見つかりません",
|
"Not found": "見つかりません",
|
||||||
"Previous Match (Shift+Enter)": "前の一致 (Shift+Enter)",
|
"Previous Match (Shift+Enter)": "前の一致 (Shift+Enter)",
|
||||||
@@ -419,26 +419,26 @@
|
|||||||
"Error": "エラー",
|
"Error": "エラー",
|
||||||
"Failed to disable MFA": "MFAの無効化に失敗しました",
|
"Failed to disable MFA": "MFAの無効化に失敗しました",
|
||||||
"Disable two-factor authentication": "二要素認証を無効化",
|
"Disable two-factor authentication": "二要素認証を無効化",
|
||||||
"Disabling two-factor authentication will make your account less secure. You'll only need your password to sign in.": "二要素認証を無効化すると、アカウントのセキュリティが低下します。サインインにはパスワードのみが必要になります。",
|
"Disabling two-factor authentication will make your account less secure. You'll only need your password to sign in.": "二要素認証を無効にすると、アカウントのセキュリティが低下します。サインインにはパスワードのみが必要になります",
|
||||||
"Please enter your password to disable two-factor authentication:": "二要素認証を無効化するにはパスワードを入力してください:",
|
"Please enter your password to disable two-factor authentication:": "二要素認証を無効にするにはパスワードを入力してください",
|
||||||
"Two-factor authentication has been enabled": "二要素認証が有効になりました",
|
"Two-factor authentication has been enabled": "二要素認証を有効にしました",
|
||||||
"Two-factor authentication has been disabled": "二要素認証が無効になりました",
|
"Two-factor authentication has been disabled": "二要素認証を無効にしました",
|
||||||
"2-step verification": "2段階確認",
|
"2-step verification": "2段階認証",
|
||||||
"Protect your account with an additional verification layer when signing in.": "サインイン時に追加の認証レイヤーでアカウントを保護します。",
|
"Protect your account with an additional verification layer when signing in.": "サインイン時に追加の認証でアカウントを保護します",
|
||||||
"Two-factor authentication is active on your account.": "二要素認証がアカウントで有効です。",
|
"Two-factor authentication is active on your account.": "二要素認証が有効です",
|
||||||
"Add 2FA method": "2FAメソッドを追加",
|
"Add 2FA method": "2FAメソッドを追加",
|
||||||
"Backup codes": "バックアップコード",
|
"Backup codes": "バックアップコード",
|
||||||
"Disable": "無効にする",
|
"Disable": "無効にする",
|
||||||
"Invalid verification code": "無効な認証コード",
|
"Invalid verification code": "無効な認証コード",
|
||||||
"New backup codes have been generated": "新しいバックアップコードが生成されました",
|
"New backup codes have been generated": "新しいバックアップコードを生成しました",
|
||||||
"Failed to regenerate backup codes": "バックアップコードの再生成に失敗しました",
|
"Failed to regenerate backup codes": "バックアップコードの再生成に失敗しました",
|
||||||
"About backup codes": "バックアップコードについて",
|
"About backup codes": "バックアップコードについて",
|
||||||
"Backup codes can be used to access your account if you lose access to your authenticator app. Each code can only be used once.": "バックアップコードは、認証アプリへのアクセスを失った場合にアカウントにアクセスするために使用できます。各コードは一度しか使用できません。",
|
"Backup codes can be used to access your account if you lose access to your authenticator app. Each code can only be used once.": "認証アプリにアクセスできない場合、バックアップコードでアカウントにアクセスできます。各コードは1回のみ使用可能です",
|
||||||
"You can regenerate new backup codes at any time. This will invalidate all existing codes.": "いつでも新しいバックアップコードを再生成できます。これにより、既存のすべてのコードが無効になります。",
|
"You can regenerate new backup codes at any time. This will invalidate all existing codes.": "新しいバックアップコードはいつでも再生成できます。既存のコードはすべて無効になります",
|
||||||
"Confirm password": "パスワードを確認",
|
"Confirm password": "パスワードを確認",
|
||||||
"Generate new backup codes": "新しいバックアップコードを生成",
|
"Generate new backup codes": "新しいバックアップコードを生成",
|
||||||
"Save your new backup codes": "新しいバックアップコードを保存",
|
"Save your new backup codes": "新しいバックアップコードを保存",
|
||||||
"Make sure to save these codes in a secure place. Your old backup codes are no longer valid.": "これらのコードを安全な場所に保存してください。古いバックアップコードは無効です。",
|
"Make sure to save these codes in a secure place. Your old backup codes are no longer valid.": "これらのコードを安全な場所に保存してください。古いバックアップコードは無効になりました",
|
||||||
"Your new backup codes": "新しいバックアップコード",
|
"Your new backup codes": "新しいバックアップコード",
|
||||||
"I've saved my backup codes": "バックアップコードを保存しました",
|
"I've saved my backup codes": "バックアップコードを保存しました",
|
||||||
"Failed to setup MFA": "MFAの設定に失敗しました",
|
"Failed to setup MFA": "MFAの設定に失敗しました",
|
||||||
@@ -449,51 +449,51 @@
|
|||||||
"Enter this code manually in your authenticator app:": "このコードを認証アプリに手動で入力してください:",
|
"Enter this code manually in your authenticator app:": "このコードを認証アプリに手動で入力してください:",
|
||||||
"2. Enter the 6-digit code from your authenticator": "2. 認証アプリからの6桁のコードを入力してください",
|
"2. Enter the 6-digit code from your authenticator": "2. 認証アプリからの6桁のコードを入力してください",
|
||||||
"Verify and enable": "確認と有効化",
|
"Verify and enable": "確認と有効化",
|
||||||
"Failed to generate QR code. Please try again.": "QRコードの生成に失敗しました。再試行してください。",
|
"Failed to generate QR code. Please try again.": "QRコードの生成に失敗しました。もう一度お試しください",
|
||||||
"Backup": "バックアップ",
|
"Backup": "バックアップ",
|
||||||
"Save codes": "コードを保存",
|
"Save codes": "コードを保存",
|
||||||
"Save your backup codes": "バックアップコードを保存",
|
"Save your backup codes": "バックアップコードを保存",
|
||||||
"These codes can be used to access your account if you lose access to your authenticator app. Each code can only be used once.": "これらのコードは、認証アプリへのアクセスを失った場合にアカウントにアクセスするために使用できます。各コードは一度しか使用できません。",
|
"These codes can be used to access your account if you lose access to your authenticator app. Each code can only be used once.": "認証アプリにアクセスできない場合、これらのコードでアカウントにアクセスできます。各コードは1回のみ使用可能です",
|
||||||
"Print": "印刷",
|
"Print": "印刷",
|
||||||
"Two-factor authentication has been set up. Please log in again.": "二要素認証が設定されました。再度ログインしてください。",
|
"Two-factor authentication has been set up. Please log in again.": "二要素認証を設定しました。再度ログインしてください",
|
||||||
"Two-Factor authentication required": "二要素認証が必要です",
|
"Two-Factor authentication required": "二要素認証が必要です",
|
||||||
"Your workspace requires two-factor authentication for all users": "ワークスペースでは、すべてのユーザーに二要素認証が必要です",
|
"Your workspace requires two-factor authentication for all users": "このワークスペースではすべてのユーザーに二要素認証が必要です",
|
||||||
"To continue accessing your workspace, you must set up two-factor authentication. This adds an extra layer of security to your account.": "ワークスペースへのアクセスを続けるには、二要素認証を設定する必要があります。これにより、アカウントに追加のセキュリティ層が追加されます。",
|
"To continue accessing your workspace, you must set up two-factor authentication. This adds an extra layer of security to your account.": "ワークスペースにアクセスするには二要素認証を設定してください。アカウントのセキュリティが強化されます",
|
||||||
"Set up two-factor authentication": "二要素認証を設定",
|
"Set up two-factor authentication": "二要素認証を設定",
|
||||||
"Cancel and logout": "キャンセルしてログアウト",
|
"Cancel and logout": "キャンセルしてログアウト",
|
||||||
"Your workspace requires two-factor authentication. Please set it up to continue.": "ワークスペースでは二要素認証が必要です。続行するには設定してください。",
|
"Your workspace requires two-factor authentication. Please set it up to continue.": "このワークスペースでは二要素認証が必要です。続行するには設定してください",
|
||||||
"This adds an extra layer of security to your account by requiring a verification code from your authenticator app.": "これにより、認証アプリからの確認コードが必要となり、アカウントに追加のセキュリティ層が追加されます。",
|
"This adds an extra layer of security to your account by requiring a verification code from your authenticator app.": "認証アプリからの確認コードでアカウントのセキュリティが強化されます",
|
||||||
"Password is required": "パスワードが必要です",
|
"Password is required": "パスワードが必要です",
|
||||||
"Password must be at least 8 characters": "パスワードは8文字以上必要です",
|
"Password must be at least 8 characters": "パスワードは8文字以上必要です",
|
||||||
"Please enter a 6-digit code": "6桁のコードを入力してください",
|
"Please enter a 6-digit code": "6桁のコードを入力してください",
|
||||||
"Code must be exactly 6 digits": "コードは正確に6桁である必要があります",
|
"Code must be exactly 6 digits": "コードは6桁で入力してください",
|
||||||
"Enter the 6-digit code found in your authenticator app": "認証アプリに表示された6桁のコードを入力してください",
|
"Enter the 6-digit code found in your authenticator app": "認証アプリに表示された6桁のコードを入力してください",
|
||||||
"Need help authenticating?": "認証に関するヘルプが必要ですか?",
|
"Need help authenticating?": "認証に関するヘルプが必要ですか?",
|
||||||
"MFA QR Code": "MFA QRコード",
|
"MFA QR Code": "MFA QRコード",
|
||||||
"Account created successfully. Please log in to set up two-factor authentication.": "アカウントが正常に作成されました。二要素認証を設定するためにログインしてください。",
|
"Account created successfully. Please log in to set up two-factor authentication.": "アカウントを作成しました。二要素認証を設定するためにログインしてください",
|
||||||
"Password reset successful. Please log in with your new password and complete two-factor authentication.": "パスワードのリセットが成功しました。新しいパスワードでログインし、二要素認証を完了してください。",
|
"Password reset successful. Please log in with your new password and complete two-factor authentication.": "パスワードをリセットしました。新しいパスワードでログインして二要素認証を完了してください",
|
||||||
"Password reset successful. Please log in with your new password to set up two-factor authentication.": "パスワードのリセットが成功しました。二要素認証を設定するために新しいパスワードでログインしてください。",
|
"Password reset successful. Please log in with your new password to set up two-factor authentication.": "パスワードをリセットしました。新しいパスワードでログインして二要素認証を設定してください",
|
||||||
"Password reset was successful. Please log in with your new password.": "パスワードのリセットが成功しました。新しいパスワードでログインしてください。",
|
"Password reset was successful. Please log in with your new password.": "パスワードをリセットしました。新しいパスワードでログインしてください",
|
||||||
"Two-factor authentication": "二要素認証",
|
"Two-factor authentication": "二要素認証",
|
||||||
"Use authenticator app instead": "代わりに認証アプリを使用",
|
"Use authenticator app instead": "代わりに認証アプリを使用",
|
||||||
"Verify backup code": "バックアップコードを確認",
|
"Verify backup code": "バックアップコードを確認",
|
||||||
"Use backup code": "バックアップコードを使用",
|
"Use backup code": "バックアップコードを使用",
|
||||||
"Enter one of your backup codes": "バックアップコードのいずれかを入力してください",
|
"Enter one of your backup codes": "バックアップコードのいずれかを入力してください",
|
||||||
"Backup code": "バックアップコード",
|
"Backup code": "バックアップコード",
|
||||||
"Enter one of your backup codes. Each backup code can only be used once.": "バックアップコードのいずれかを入力してください。各バックアップコードは一度しか使用できません。",
|
"Enter one of your backup codes. Each backup code can only be used once.": "バックアップコードを入力してください。各コードは1回のみ使用可能です",
|
||||||
"Verify": "確認",
|
"Verify": "確認",
|
||||||
"Trash": "ごみ箱",
|
"Trash": "ごみ箱",
|
||||||
"Pages in trash will be permanently deleted after 30 days.": "ごみ箱内のページは30日後に完全に削除されます。",
|
"Pages in trash will be permanently deleted after 30 days.": "ごみ箱内のページは30日後に完全に削除されます",
|
||||||
"Deleted": "削除",
|
"Deleted": "削除",
|
||||||
"No pages in trash": "ごみ箱にページがありません",
|
"No pages in trash": "ごみ箱にページがありません",
|
||||||
"Permanently delete page?": "ページを完全に削除しますか?",
|
"Permanently delete page?": "ページを完全に削除しますか?",
|
||||||
"Are you sure you want to permanently delete '{{title}}'? This action cannot be undone.": "{{title}}』を完全に削除しますか? この操作は元に戻せません。",
|
"Are you sure you want to permanently delete '{{title}}'? This action cannot be undone.": "「{{title}}」を完全に削除しますか?この操作は取り消せません",
|
||||||
"Restore '{{title}}' and its sub-pages?": "{{title}}』とそのサブページを復元しますか?",
|
"Restore '{{title}}' and its sub-pages?": "「{{title}}」とそのサブページを復元しますか?",
|
||||||
"Move to trash": "ごみ箱に移動",
|
"Move to trash": "ごみ箱に移動",
|
||||||
"Move this page to trash?": "このページをごみ箱に移動しますか?",
|
"Move this page to trash?": "このページをごみ箱に移動しますか?",
|
||||||
"Restore page": "ページを復元",
|
"Restore page": "ページを復元",
|
||||||
"Page moved to trash": "ページがごみ箱に移動されました",
|
"Page moved to trash": "ページをごみ箱に移動しました",
|
||||||
"Page restored successfully": "ページが正常に復元されました",
|
"Page restored successfully": "ページを復元しました",
|
||||||
"Deleted by": "削除者",
|
"Deleted by": "削除者",
|
||||||
"Deleted at": "削除日時",
|
"Deleted at": "削除日時",
|
||||||
"Preview": "プレビュー",
|
"Preview": "プレビュー",
|
||||||
@@ -511,10 +511,10 @@
|
|||||||
"Enterprise": "エンタープライズ",
|
"Enterprise": "エンタープライズ",
|
||||||
"Download attachment": "添付ファイルをダウンロード",
|
"Download attachment": "添付ファイルをダウンロード",
|
||||||
"Allowed email domains": "許可されたメールドメイン",
|
"Allowed email domains": "許可されたメールドメイン",
|
||||||
"Only users with email addresses from these domains can signup via SSO.": "これらのドメインからのメールアドレスを持つユーザーのみがSSOで登録できます。",
|
"Only users with email addresses from these domains can signup via SSO.": "これらのドメインのメールアドレスを持つユーザーのみSSO経由で登録できます",
|
||||||
"Enter valid domain names separated by comma or space": "コンマまたはスペースで区切って有効なドメイン名を入力してください",
|
"Enter valid domain names separated by comma or space": "コンマまたはスペースで区切って有効なドメイン名を入力してください",
|
||||||
"Enforce two-factor authentication": "二要素認証を強制する",
|
"Enforce two-factor authentication": "二要素認証を強制する",
|
||||||
"Once enforced, all members must enable two-factor authentication to access the workspace.": "一度強制されると、すべてのメンバーはワークスペースにアクセスするために二要素認証を有効にする必要があります。",
|
"Once enforced, all members must enable two-factor authentication to access the workspace.": "有効にすると、すべてのメンバーが二要素認証を設定しないとワークスペースにアクセスできなくなります",
|
||||||
"Toggle MFA enforcement": "MFAの強制を切り替える",
|
"Toggle MFA enforcement": "MFAの強制を切り替える",
|
||||||
"Display name": "表示名",
|
"Display name": "表示名",
|
||||||
"Allow signup": "登録を許可する",
|
"Allow signup": "登録を許可する",
|
||||||
@@ -527,5 +527,47 @@
|
|||||||
"Delete SSO provider": "SSOプロバイダーを削除する",
|
"Delete SSO provider": "SSOプロバイダーを削除する",
|
||||||
"Are you sure you want to delete this SSO provider?": "このSSOプロバイダーを削除してもよろしいですか?",
|
"Are you sure you want to delete this SSO provider?": "このSSOプロバイダーを削除してもよろしいですか?",
|
||||||
"Action": "アクション",
|
"Action": "アクション",
|
||||||
"{{ssoProviderType}} configuration": "{{ssoProviderType}}の構成"
|
"{{ssoProviderType}} configuration": "{{ssoProviderType}}の構成",
|
||||||
|
"Icon": "アイコン",
|
||||||
|
"Upload image": "画像をアップロード",
|
||||||
|
"Remove image": "画像を削除",
|
||||||
|
"Failed to remove image": "画像の削除に失敗しました",
|
||||||
|
"Image exceeds 10MB limit.": "画像が10MBの制限を超えています",
|
||||||
|
"Image removed successfully": "画像を削除しました",
|
||||||
|
"API key": "APIキー",
|
||||||
|
"API key created successfully": "APIキーを作成しました",
|
||||||
|
"API keys": "APIキー",
|
||||||
|
"API management": "API管理",
|
||||||
|
"Are you sure you want to revoke this API key": "このAPIキーを無効にしてもよろしいですか",
|
||||||
|
"Create API Key": "APIキーを作成",
|
||||||
|
"Custom expiration date": "カスタム有効期限",
|
||||||
|
"Enter a descriptive token name": "説明的なトークン名を入力してください",
|
||||||
|
"Expiration": "有効期限",
|
||||||
|
"Expired": "期限切れ",
|
||||||
|
"Expires": "期限が切れます",
|
||||||
|
"I've saved my API key": "APIキーを保存しました",
|
||||||
|
"Last use": "最終使用",
|
||||||
|
"No API keys found": "APIキーが見つかりません",
|
||||||
|
"No expiration": "期限なし",
|
||||||
|
"Revoke API key": "APIキーを無効にする",
|
||||||
|
"Revoked successfully": "無効にしました",
|
||||||
|
"Select expiration date": "有効期限を選択してください",
|
||||||
|
"This action cannot be undone. Any applications using this API key will stop working.": "この操作は取り消せません。このAPIキーを使用しているアプリケーションは動作しなくなります",
|
||||||
|
"Update API key": "APIキーを更新",
|
||||||
|
"Manage API keys for all users in the workspace": "ワークスペース内のすべてのユーザーのAPIキーを管理",
|
||||||
|
"AI settings": "AI設定",
|
||||||
|
"AI search": "AI検索",
|
||||||
|
"AI Answer": "AI回答",
|
||||||
|
"Ask AI": "AIに質問する",
|
||||||
|
"AI is thinking...": "AIが考え中...",
|
||||||
|
"Ask a question...": "質問を入力...",
|
||||||
|
"AI-powered search (Ask AI)": "AIによる検索(AIに質問)",
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.": "AI検索はベクター埋め込みを使用してワークスペース全体の意味検索を実現します",
|
||||||
|
"Toggle AI search": "AI検索を切り替え",
|
||||||
|
"Sources": "ソース",
|
||||||
|
"Ask AI not available for attachments": "添付ファイルにはAI質問は利用できません",
|
||||||
|
"No answer available": "回答がありません",
|
||||||
|
"Background color": "背景色",
|
||||||
|
"Highlight color": "ハイライト色",
|
||||||
|
"Remove color": "色を削除"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -527,5 +527,47 @@
|
|||||||
"Delete SSO provider": "SSO 제공자 삭제",
|
"Delete SSO provider": "SSO 제공자 삭제",
|
||||||
"Are you sure you want to delete this SSO provider?": "이 SSO 제공자를 삭제하시겠습니까?",
|
"Are you sure you want to delete this SSO provider?": "이 SSO 제공자를 삭제하시겠습니까?",
|
||||||
"Action": "작업",
|
"Action": "작업",
|
||||||
"{{ssoProviderType}} configuration": "{{ssoProviderType}} 구성"
|
"{{ssoProviderType}} configuration": "{{ssoProviderType}} 구성",
|
||||||
|
"Icon": "아이콘",
|
||||||
|
"Upload image": "이미지 업로드",
|
||||||
|
"Remove image": "이미지 제거",
|
||||||
|
"Failed to remove image": "이미지 제거 실패",
|
||||||
|
"Image exceeds 10MB limit.": "이미지가 10MB 용량 제한을 초과합니다.",
|
||||||
|
"Image removed successfully": "이미지가 성공적으로 제거되었습니다",
|
||||||
|
"API key": "API 키",
|
||||||
|
"API key created successfully": "API 키 생성 완료",
|
||||||
|
"API keys": "API 키",
|
||||||
|
"API management": "API 관리",
|
||||||
|
"Are you sure you want to revoke this API key": "이 API 키를 취소하시겠습니까?",
|
||||||
|
"Create API Key": "API 키 생성",
|
||||||
|
"Custom expiration date": "사용자 정의 만료일",
|
||||||
|
"Enter a descriptive token name": "토큰 이름을 입력하세요",
|
||||||
|
"Expiration": "만료",
|
||||||
|
"Expired": "만료됨",
|
||||||
|
"Expires": "만료일",
|
||||||
|
"I've saved my API key": "API 키를 저장했습니다",
|
||||||
|
"Last use": "최근 사용",
|
||||||
|
"No API keys found": "API 키를 찾을 수 없습니다",
|
||||||
|
"No expiration": "유효기간 없음",
|
||||||
|
"Revoke API key": "API 키 취소",
|
||||||
|
"Revoked successfully": "성공적으로 취소되었습니다",
|
||||||
|
"Select expiration date": "만료일 선택",
|
||||||
|
"This action cannot be undone. Any applications using this API key will stop working.": "이 작업은 되돌릴 수 없습니다. 이 API 키를 사용하는 모든 응용 프로그램이 작동을 멈출 것입니다.",
|
||||||
|
"Update API key": "API 키 갱신",
|
||||||
|
"Manage API keys for all users in the workspace": "워크스페이스 내 모든 사용자의 API 키 관리",
|
||||||
|
"AI settings": "AI 설정",
|
||||||
|
"AI search": "AI 검색",
|
||||||
|
"AI Answer": "AI 답변",
|
||||||
|
"Ask AI": "AI에게 묻기",
|
||||||
|
"AI is thinking...": "AI가 생각 중입니다...",
|
||||||
|
"Ask a question...": "질문하세요...",
|
||||||
|
"AI-powered search (Ask AI)": "AI 지원 검색 (AI에게 묻기)",
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.": "AI 검색은 벡터 임베딩을 사용하여 작업공간 콘텐츠에 대한 의미 검색 기능을 제공합니다.",
|
||||||
|
"Toggle AI search": "AI 검색 전환",
|
||||||
|
"Sources": "출처",
|
||||||
|
"Ask AI not available for attachments": "AI에게 묻기 기능은 첨부 파일에 대해 사용할 수 없습니다",
|
||||||
|
"No answer available": "답변을 제공할 수 없습니다",
|
||||||
|
"Background color": "배경 색",
|
||||||
|
"Highlight color": "강조 색",
|
||||||
|
"Remove color": "색 제거"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
"Create group": "Groep aanmaken",
|
"Create group": "Groep aanmaken",
|
||||||
"Create page": "Pagina aanmaken",
|
"Create page": "Pagina aanmaken",
|
||||||
"Create space": "Ruimte aanmaken",
|
"Create space": "Ruimte aanmaken",
|
||||||
"Create workspace": "Wwerkruimte aanmaken",
|
"Create workspace": "Werkruimte aanmaken",
|
||||||
"Current password": "Huidig wachtwoord",
|
"Current password": "Huidig wachtwoord",
|
||||||
"Dark": "Donker",
|
"Dark": "Donker",
|
||||||
"Date": "Datum",
|
"Date": "Datum",
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
"Invite by email": "Uitnodigen via e-mail",
|
"Invite by email": "Uitnodigen via e-mail",
|
||||||
"Invite members": "Leden uitnodigen",
|
"Invite members": "Leden uitnodigen",
|
||||||
"Invite new members": "Nieuwe leden uitnodigen",
|
"Invite new members": "Nieuwe leden uitnodigen",
|
||||||
"Invited members who are yet to accept their invitation will appear here.": "Uigenodigde leden die hun uitnodiging nog moeten accepteren zullen hier worden getoond.",
|
"Invited members who are yet to accept their invitation will appear here.": "Uitgenodigde leden die hun uitnodiging nog moeten accepteren zullen hier worden getoond.",
|
||||||
"Invited members will be granted access to spaces the groups can access": "Uitgenodigde leden wordt toegang gegeven tot ruimtes de groepen toegang toe heeft",
|
"Invited members will be granted access to spaces the groups can access": "Uitgenodigde leden wordt toegang gegeven tot ruimtes de groepen toegang toe heeft",
|
||||||
"Join the workspace": "Word lid van de werkruimte",
|
"Join the workspace": "Word lid van de werkruimte",
|
||||||
"Language": "Taal",
|
"Language": "Taal",
|
||||||
@@ -527,5 +527,47 @@
|
|||||||
"Delete SSO provider": "Verwijder SSO-provider",
|
"Delete SSO provider": "Verwijder SSO-provider",
|
||||||
"Are you sure you want to delete this SSO provider?": "Weet u zeker dat u deze SSO-provider wilt verwijderen?",
|
"Are you sure you want to delete this SSO provider?": "Weet u zeker dat u deze SSO-provider wilt verwijderen?",
|
||||||
"Action": "Actie",
|
"Action": "Actie",
|
||||||
"{{ssoProviderType}} configuration": "{{ssoProviderType}} configuratie"
|
"{{ssoProviderType}} configuration": "{{ssoProviderType}} configuratie",
|
||||||
|
"Icon": "Icoon",
|
||||||
|
"Upload image": "Afbeelding uploaden",
|
||||||
|
"Remove image": "Afbeelding verwijderen",
|
||||||
|
"Failed to remove image": "Afbeelding verwijderen mislukt",
|
||||||
|
"Image exceeds 10MB limit.": "Afbeelding overschrijdt de limiet van 10MB.",
|
||||||
|
"Image removed successfully": "Afbeelding succesvol verwijderd",
|
||||||
|
"API key": "API-sleutel",
|
||||||
|
"API key created successfully": "API-sleutel succesvol aangemaakt",
|
||||||
|
"API keys": "API-sleutels",
|
||||||
|
"API management": "API-beheer",
|
||||||
|
"Are you sure you want to revoke this API key": "Weet u zeker dat u deze API-sleutel wilt intrekken",
|
||||||
|
"Create API Key": "API-sleutel aanmaken",
|
||||||
|
"Custom expiration date": "Aangepaste vervaldatum",
|
||||||
|
"Enter a descriptive token name": "Voer een beschrijvende tokennaam in",
|
||||||
|
"Expiration": "Vervaldatum",
|
||||||
|
"Expired": "Verlopen",
|
||||||
|
"Expires": "Verloopt",
|
||||||
|
"I've saved my API key": "Ik heb mijn API-sleutel opgeslagen",
|
||||||
|
"Last use": "Laatst gebruikt",
|
||||||
|
"No API keys found": "Geen API-sleutels gevonden",
|
||||||
|
"No expiration": "Geen vervaldatum",
|
||||||
|
"Revoke API key": "API-sleutel intrekken",
|
||||||
|
"Revoked successfully": "Succesvol ingetrokken",
|
||||||
|
"Select expiration date": "Selecteer vervaldatum",
|
||||||
|
"This action cannot be undone. Any applications using this API key will stop working.": "Deze actie kan niet ongedaan worden gemaakt. Alle toepassingen die deze API-sleutel gebruiken, zullen niet meer werken.",
|
||||||
|
"Update API key": "API-sleutel bijwerken",
|
||||||
|
"Manage API keys for all users in the workspace": "Beheer API-sleutels voor alle gebruikers in de werkruimte",
|
||||||
|
"AI settings": "AI-instellingen",
|
||||||
|
"AI search": "AI-zoekopdracht",
|
||||||
|
"AI Answer": "AI Antwoord",
|
||||||
|
"Ask AI": "Vraag AI",
|
||||||
|
"AI is thinking...": "AI is aan het nadenken...",
|
||||||
|
"Ask a question...": "Stel een vraag...",
|
||||||
|
"AI-powered search (Ask AI)": "AI-ondersteunde zoekopdracht (Vraag AI)",
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.": "AI-zoekopdracht maakt gebruik van vectorembeddings om semantische zoekmogelijkheden te bieden in uw werkruimte-inhoud.",
|
||||||
|
"Toggle AI search": "Schakel AI-zoekopdracht in/uit",
|
||||||
|
"Sources": "Bronnen",
|
||||||
|
"Ask AI not available for attachments": "Vraag AI is niet beschikbaar voor bijlages",
|
||||||
|
"No answer available": "Geen antwoord beschikbaar",
|
||||||
|
"Background color": "Achtergrondkleur",
|
||||||
|
"Highlight color": "Markeerkleur",
|
||||||
|
"Remove color": "Kleur verwijderen"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -527,5 +527,47 @@
|
|||||||
"Delete SSO provider": "Excluir provedor de SSO",
|
"Delete SSO provider": "Excluir provedor de SSO",
|
||||||
"Are you sure you want to delete this SSO provider?": "Tem certeza de que deseja excluir este provedor de SSO?",
|
"Are you sure you want to delete this SSO provider?": "Tem certeza de que deseja excluir este provedor de SSO?",
|
||||||
"Action": "Ação",
|
"Action": "Ação",
|
||||||
"{{ssoProviderType}} configuration": "Configuração de {{ssoProviderType}}"
|
"{{ssoProviderType}} configuration": "Configuração de {{ssoProviderType}}",
|
||||||
|
"Icon": "Ícone",
|
||||||
|
"Upload image": "Fazer upload da imagem",
|
||||||
|
"Remove image": "Remover imagem",
|
||||||
|
"Failed to remove image": "Falha ao remover imagem",
|
||||||
|
"Image exceeds 10MB limit.": "A imagem excede o limite de 10MB.",
|
||||||
|
"Image removed successfully": "Imagem removida com sucesso",
|
||||||
|
"API key": "Chave API",
|
||||||
|
"API key created successfully": "Chave API criada com sucesso",
|
||||||
|
"API keys": "Chaves API",
|
||||||
|
"API management": "Gestão de API",
|
||||||
|
"Are you sure you want to revoke this API key": "Tem certeza de que deseja revogar esta chave API",
|
||||||
|
"Create API Key": "Criar Chave API",
|
||||||
|
"Custom expiration date": "Data de expiração personalizada",
|
||||||
|
"Enter a descriptive token name": "Insira um nome descritivo para o token",
|
||||||
|
"Expiration": "Expiração",
|
||||||
|
"Expired": "Expirado",
|
||||||
|
"Expires": "Expira",
|
||||||
|
"I've saved my API key": "Salvei minha chave API",
|
||||||
|
"Last use": "Último uso",
|
||||||
|
"No API keys found": "Nenhuma chave API encontrada",
|
||||||
|
"No expiration": "Sem expiração",
|
||||||
|
"Revoke API key": "Revogar chave API",
|
||||||
|
"Revoked successfully": "Revogada com sucesso",
|
||||||
|
"Select expiration date": "Selecionar data de expiração",
|
||||||
|
"This action cannot be undone. Any applications using this API key will stop working.": "Esta ação não pode ser desfeita. Qualquer aplicação usando esta chave API deixará de funcionar.",
|
||||||
|
"Update API key": "Atualizar chave API",
|
||||||
|
"Manage API keys for all users in the workspace": "Gerenciar chaves API para todos os usuários no espaço de trabalho",
|
||||||
|
"AI settings": "Configurações de IA",
|
||||||
|
"AI search": "Pesquisa IA",
|
||||||
|
"AI Answer": "Resposta de IA",
|
||||||
|
"Ask AI": "Pergunte à IA",
|
||||||
|
"AI is thinking...": "IA está pensando...",
|
||||||
|
"Ask a question...": "Faça uma pergunta...",
|
||||||
|
"AI-powered search (Ask AI)": "Pesquisa com IA (Pergunte à IA)",
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.": "A pesquisa IA usa vetores de incorporação para fornecer capacidades de pesquisa semântica em todo o conteúdo do seu espaço de trabalho.",
|
||||||
|
"Toggle AI search": "Alternar pesquisa de IA",
|
||||||
|
"Sources": "Fontes",
|
||||||
|
"Ask AI not available for attachments": "Perguntar à IA não está disponível para anexos",
|
||||||
|
"No answer available": "Nenhuma resposta disponível",
|
||||||
|
"Background color": "Cor de fundo",
|
||||||
|
"Highlight color": "Cor de destaque",
|
||||||
|
"Remove color": "Remover cor"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -498,10 +498,10 @@
|
|||||||
"Deleted at": "Удалено в",
|
"Deleted at": "Удалено в",
|
||||||
"Preview": "Предпросмотр",
|
"Preview": "Предпросмотр",
|
||||||
"Subpages": "Подстраницы",
|
"Subpages": "Подстраницы",
|
||||||
"Failed to load subpages": "Не удалось загрузить подстраницы",
|
"Failed to load subpages": "Не удалось загрузить под страницы",
|
||||||
"No subpages": "Нет подстраниц",
|
"No subpages": "Нет подстраниц",
|
||||||
"Subpages (Child pages)": "Подстраницы (вложенные страницы)",
|
"Subpages (Child pages)": "Подстраницы (вложенные страницы)",
|
||||||
"List all subpages of the current page": "Показать все подстраницы текущей страницы",
|
"List all subpages of the current page": "Показать все под страницы",
|
||||||
"Attachments": "Вложения",
|
"Attachments": "Вложения",
|
||||||
"All spaces": "Все пространства",
|
"All spaces": "Все пространства",
|
||||||
"Unknown": "Неизвестно",
|
"Unknown": "Неизвестно",
|
||||||
@@ -527,5 +527,47 @@
|
|||||||
"Delete SSO provider": "Удалить поставщика SSO",
|
"Delete SSO provider": "Удалить поставщика SSO",
|
||||||
"Are you sure you want to delete this SSO provider?": "Вы уверены, что хотите удалить этого поставщика SSO?",
|
"Are you sure you want to delete this SSO provider?": "Вы уверены, что хотите удалить этого поставщика SSO?",
|
||||||
"Action": "Действие",
|
"Action": "Действие",
|
||||||
"{{ssoProviderType}} configuration": "Настройка {{ssoProviderType}}"
|
"{{ssoProviderType}} configuration": "Настройка {{ssoProviderType}}",
|
||||||
|
"Icon": "Иконка",
|
||||||
|
"Upload image": "Загрузить изображение",
|
||||||
|
"Remove image": "Удалить изображение",
|
||||||
|
"Failed to remove image": "Не удалось удалить изображение",
|
||||||
|
"Image exceeds 10MB limit.": "Изображение превышает предел 10MB.",
|
||||||
|
"Image removed successfully": "Изображение успешно удалено",
|
||||||
|
"API key": "API ключ",
|
||||||
|
"API key created successfully": "API ключ успешно создан",
|
||||||
|
"API keys": "API ключи",
|
||||||
|
"API management": "Управление API",
|
||||||
|
"Are you sure you want to revoke this API key": "Вы уверены, что хотите отозвать этот API ключ",
|
||||||
|
"Create API Key": "Создать API ключ",
|
||||||
|
"Custom expiration date": "Пользовательская дата срока действия",
|
||||||
|
"Enter a descriptive token name": "Введите понятное имя токена",
|
||||||
|
"Expiration": "Срок действия",
|
||||||
|
"Expired": "Истек",
|
||||||
|
"Expires": "Истекает",
|
||||||
|
"I've saved my API key": "Я сохранил мой API ключ",
|
||||||
|
"Last use": "Последнее использование",
|
||||||
|
"No API keys found": "API ключи не найдены",
|
||||||
|
"No expiration": "Не истекает",
|
||||||
|
"Revoke API key": "Отозвать API ключ",
|
||||||
|
"Revoked successfully": "Отозван успешно",
|
||||||
|
"Select expiration date": "Выберете срок действия",
|
||||||
|
"This action cannot be undone. Any applications using this API key will stop working.": "Это действие необратимо. Любые приложения, использующие этот API ключ, перестанут работать.",
|
||||||
|
"Update API key": "Обновить API ключ",
|
||||||
|
"Manage API keys for all users in the workspace": "Управлять API ключами для всех пользователей в рабочей области",
|
||||||
|
"AI settings": "Настройки ИИ",
|
||||||
|
"AI search": "Поиск ИИ",
|
||||||
|
"AI Answer": "Ответ ИИ",
|
||||||
|
"Ask AI": "Спросить ИИ",
|
||||||
|
"AI is thinking...": "ИИ обрабатывает запрос...",
|
||||||
|
"Ask a question...": "Задайте вопрос...",
|
||||||
|
"AI-powered search (Ask AI)": "Поиск на базе ИИ (Спросить ИИ)",
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.": "Поиск ИИ использует векторные встраивания для обеспечения семантического поиска по содержимому вашего рабочего пространства.",
|
||||||
|
"Toggle AI search": "Переключить поиск ИИ",
|
||||||
|
"Sources": "Источники",
|
||||||
|
"Ask AI not available for attachments": "Функция \"Спросить ИИ\" недоступна для вложений",
|
||||||
|
"No answer available": "Ответ недоступен",
|
||||||
|
"Background color": "Цвет фона",
|
||||||
|
"Highlight color": "Цвет выделения",
|
||||||
|
"Remove color": "Удалить цвет"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -527,5 +527,47 @@
|
|||||||
"Delete SSO provider": "Видалити постачальника SSO",
|
"Delete SSO provider": "Видалити постачальника SSO",
|
||||||
"Are you sure you want to delete this SSO provider?": "Ви впевнені, що хочете видалити цього постачальника SSO?",
|
"Are you sure you want to delete this SSO provider?": "Ви впевнені, що хочете видалити цього постачальника SSO?",
|
||||||
"Action": "Дія",
|
"Action": "Дія",
|
||||||
"{{ssoProviderType}} configuration": "Конфігурація {{ssoProviderType}}"
|
"{{ssoProviderType}} configuration": "Конфігурація {{ssoProviderType}}",
|
||||||
|
"Icon": "Іконка",
|
||||||
|
"Upload image": "Завантажити зображення",
|
||||||
|
"Remove image": "Видалити зображення",
|
||||||
|
"Failed to remove image": "Не вдалося видалити зображення",
|
||||||
|
"Image exceeds 10MB limit.": "Зображення має займати менше, ніж 10 МБ.",
|
||||||
|
"Image removed successfully": "Зображення видалено",
|
||||||
|
"API key": "Ключ API",
|
||||||
|
"API key created successfully": "Ключ API успішно створено",
|
||||||
|
"API keys": "Ключі API",
|
||||||
|
"API management": "Управління API",
|
||||||
|
"Are you sure you want to revoke this API key": "Ви впевнені, що хочете відкликати цей ключ API",
|
||||||
|
"Create API Key": "Створити ключ API",
|
||||||
|
"Custom expiration date": "Користувацька дата закінчення",
|
||||||
|
"Enter a descriptive token name": "Введіть описову назву токена",
|
||||||
|
"Expiration": "Термін дії",
|
||||||
|
"Expired": "Закінчився",
|
||||||
|
"Expires": "Закінчується",
|
||||||
|
"I've saved my API key": "Я зберіг свій ключ API",
|
||||||
|
"Last use": "Останнє використання",
|
||||||
|
"No API keys found": "Ключі API не знайдено",
|
||||||
|
"No expiration": "Без терміну дії",
|
||||||
|
"Revoke API key": "Відкликати ключ API",
|
||||||
|
"Revoked successfully": "Успішно відкликано",
|
||||||
|
"Select expiration date": "Виберіть дату закінчення",
|
||||||
|
"This action cannot be undone. Any applications using this API key will stop working.": "Цю дію не можна скасувати. Будь-які додатки, що використовують цей ключ API, перестануть працювати.",
|
||||||
|
"Update API key": "Оновити ключ API",
|
||||||
|
"Manage API keys for all users in the workspace": "Керувати ключами API для всіх користувачів у робочій області",
|
||||||
|
"AI settings": "Налаштування ШІ",
|
||||||
|
"AI search": "Пошук з ШІ",
|
||||||
|
"AI Answer": "Відповідь ШІ",
|
||||||
|
"Ask AI": "Запитати ШІ",
|
||||||
|
"AI is thinking...": "ШІ думає...",
|
||||||
|
"Ask a question...": "Задайте питання...",
|
||||||
|
"AI-powered search (Ask AI)": "Пошук на базі ШІ (Запитати ШІ)",
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.": "Пошук з ШІ використовує векторні вбудовування для надання можливостей семантичного пошуку у вашому робочому вмісті.",
|
||||||
|
"Toggle AI search": "Переключити пошук з ШІ",
|
||||||
|
"Sources": "Джерела",
|
||||||
|
"Ask AI not available for attachments": "Запитати ШІ недоступно для вкладень",
|
||||||
|
"No answer available": "Відповідь недоступна",
|
||||||
|
"Background color": "Колір фону",
|
||||||
|
"Highlight color": "Колір підсвічування",
|
||||||
|
"Remove color": "Видалити колір"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -527,5 +527,47 @@
|
|||||||
"Delete SSO provider": "删除SSO提供商",
|
"Delete SSO provider": "删除SSO提供商",
|
||||||
"Are you sure you want to delete this SSO provider?": "您确定要删除此SSO提供商吗?",
|
"Are you sure you want to delete this SSO provider?": "您确定要删除此SSO提供商吗?",
|
||||||
"Action": "操作",
|
"Action": "操作",
|
||||||
"{{ssoProviderType}} configuration": "{{ssoProviderType}} 配置"
|
"{{ssoProviderType}} configuration": "{{ssoProviderType}} 配置",
|
||||||
|
"Icon": "图标",
|
||||||
|
"Upload image": "上传图片",
|
||||||
|
"Remove image": "删除图片",
|
||||||
|
"Failed to remove image": "无法删除图片",
|
||||||
|
"Image exceeds 10MB limit.": "图片超过10MB限制。",
|
||||||
|
"Image removed successfully": "图片删除成功",
|
||||||
|
"API key": "API密钥",
|
||||||
|
"API key created successfully": "API密钥创建成功",
|
||||||
|
"API keys": "API密钥",
|
||||||
|
"API management": "API管理",
|
||||||
|
"Are you sure you want to revoke this API key": "确定要撤销此API密钥吗",
|
||||||
|
"Create API Key": "创建API密钥",
|
||||||
|
"Custom expiration date": "自定义到期日期",
|
||||||
|
"Enter a descriptive token name": "输入描述性令牌名称",
|
||||||
|
"Expiration": "到期",
|
||||||
|
"Expired": "已过期",
|
||||||
|
"Expires": "到期",
|
||||||
|
"I've saved my API key": "我已保存我的API密钥",
|
||||||
|
"Last use": "上次使用",
|
||||||
|
"No API keys found": "找不到API密钥",
|
||||||
|
"No expiration": "无到期",
|
||||||
|
"Revoke API key": "撤销API密钥",
|
||||||
|
"Revoked successfully": "撤销成功",
|
||||||
|
"Select expiration date": "选择到期日期",
|
||||||
|
"This action cannot be undone. Any applications using this API key will stop working.": "此操作无法撤销。使用此API密钥的任何应用程序将停止工作。",
|
||||||
|
"Update API key": "更新API密钥",
|
||||||
|
"Manage API keys for all users in the workspace": "管理工作空间中所有用户的API密钥",
|
||||||
|
"AI settings": "AI设置",
|
||||||
|
"AI search": "AI搜索",
|
||||||
|
"AI Answer": "AI回答",
|
||||||
|
"Ask AI": "询问AI",
|
||||||
|
"AI is thinking...": "AI正在思考...",
|
||||||
|
"Ask a question...": "提问...",
|
||||||
|
"AI-powered search (Ask AI)": "AI驱动的搜索(询问AI)",
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.": "AI搜索使用向量嵌入提供跨工作空间内容的语义搜索功能。",
|
||||||
|
"Toggle AI search": "切换AI搜索",
|
||||||
|
"Sources": "来源",
|
||||||
|
"Ask AI not available for attachments": "附件不支持询问AI",
|
||||||
|
"No answer available": "无可用答案",
|
||||||
|
"Background color": "背景颜色",
|
||||||
|
"Highlight color": "突出显示颜色",
|
||||||
|
"Remove color": "移除颜色"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import { MfaSetupRequiredPage } from "@/ee/mfa/pages/mfa-setup-required-page";
|
|||||||
import SpaceTrash from "@/pages/space/space-trash.tsx";
|
import SpaceTrash from "@/pages/space/space-trash.tsx";
|
||||||
import UserApiKeys from "@/ee/api-key/pages/user-api-keys";
|
import UserApiKeys from "@/ee/api-key/pages/user-api-keys";
|
||||||
import WorkspaceApiKeys from "@/ee/api-key/pages/workspace-api-keys";
|
import WorkspaceApiKeys from "@/ee/api-key/pages/workspace-api-keys";
|
||||||
|
import AiSettings from "@/ee/ai/pages/ai-settings.tsx";
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -107,6 +108,7 @@ export default function App() {
|
|||||||
<Route path={"spaces"} element={<Spaces />} />
|
<Route path={"spaces"} element={<Spaces />} />
|
||||||
<Route path={"sharing"} element={<Shares />} />
|
<Route path={"sharing"} element={<Shares />} />
|
||||||
<Route path={"security"} element={<Security />} />
|
<Route path={"security"} element={<Security />} />
|
||||||
|
<Route path={"ai"} element={<AiSettings />} />
|
||||||
{!isCloud() && <Route path={"license"} element={<License />} />}
|
{!isCloud() && <Route path={"license"} element={<License />} />}
|
||||||
{isCloud() && <Route path={"billing"} element={<Billing />} />}
|
{isCloud() && <Route path={"billing"} element={<Billing />} />}
|
||||||
</Route>
|
</Route>
|
||||||
|
|||||||
@@ -12,13 +12,14 @@ import {
|
|||||||
IconLock,
|
IconLock,
|
||||||
IconKey,
|
IconKey,
|
||||||
IconWorld,
|
IconWorld,
|
||||||
|
IconSparkles,
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import { Link, useLocation } from "react-router-dom";
|
import { Link, useLocation } from "react-router-dom";
|
||||||
import classes from "./settings.module.css";
|
import classes from "./settings.module.css";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { isCloud } from "@/lib/config.ts";
|
import { isCloud } from "@/lib/config.ts";
|
||||||
import useUserRole from "@/hooks/use-user-role.tsx";
|
import useUserRole from "@/hooks/use-user-role.tsx";
|
||||||
import { useAtom } from "jotai/index";
|
import { useAtom } from "jotai";
|
||||||
import { workspaceAtom } from "@/features/user/atoms/current-user-atom.ts";
|
import { workspaceAtom } from "@/features/user/atoms/current-user-atom.ts";
|
||||||
import {
|
import {
|
||||||
prefetchApiKeyManagement,
|
prefetchApiKeyManagement,
|
||||||
@@ -109,6 +110,13 @@ const groupedData: DataGroup[] = [
|
|||||||
isAdmin: true,
|
isAdmin: true,
|
||||||
showDisabledInNonEE: true,
|
showDisabledInNonEE: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "AI settings",
|
||||||
|
icon: IconSparkles,
|
||||||
|
path: "/settings/ai",
|
||||||
|
isAdmin: true,
|
||||||
|
isSelfhosted: true,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
import React, { useMemo } from "react";
|
||||||
|
import { Paper, Text, Group, Stack, Loader, Box } from "@mantine/core";
|
||||||
|
import { IconSparkles, IconFileText } from "@tabler/icons-react";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
import { IAiSearchResponse } from "../services/ai-search-service.ts";
|
||||||
|
import { buildPageUrl } from "@/features/page/page.utils.ts";
|
||||||
|
import { markdownToHtml } from "@docmost/editor-ext";
|
||||||
|
import DOMPurify from "dompurify";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
interface AiSearchResultProps {
|
||||||
|
result?: IAiSearchResponse;
|
||||||
|
isLoading?: boolean;
|
||||||
|
streamingAnswer?: string;
|
||||||
|
streamingSources?: any[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AiSearchResult({
|
||||||
|
result,
|
||||||
|
isLoading,
|
||||||
|
streamingAnswer = "",
|
||||||
|
streamingSources = [],
|
||||||
|
}: AiSearchResultProps) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
// Use streaming data if available, otherwise fall back to result
|
||||||
|
const answer = streamingAnswer || result?.answer || "";
|
||||||
|
const sources =
|
||||||
|
streamingSources.length > 0 ? streamingSources : result?.sources || [];
|
||||||
|
|
||||||
|
// Deduplicate sources by pageId, keeping the one with highest similarity
|
||||||
|
const deduplicatedSources = useMemo(() => {
|
||||||
|
if (!sources || sources.length === 0) return [];
|
||||||
|
|
||||||
|
const pageMap = new Map();
|
||||||
|
sources.forEach((source) => {
|
||||||
|
const existing = pageMap.get(source.pageId);
|
||||||
|
if (!existing || source.similarity > existing.similarity) {
|
||||||
|
pageMap.set(source.pageId, source);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return Array.from(pageMap.values());
|
||||||
|
}, [sources]);
|
||||||
|
|
||||||
|
if (isLoading && !answer) {
|
||||||
|
return (
|
||||||
|
<Paper p="md" radius="md" withBorder>
|
||||||
|
<Group>
|
||||||
|
<Loader size="sm" />
|
||||||
|
<Text size="sm">{t("AI is thinking...")}</Text>
|
||||||
|
</Group>
|
||||||
|
</Paper>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!answer && !isLoading) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Stack gap="md" p="md">
|
||||||
|
<Paper p="md" radius="md" withBorder>
|
||||||
|
<Group gap="xs" mb="sm">
|
||||||
|
<IconSparkles size={20} color="var(--mantine-color-blue-6)" />
|
||||||
|
<Text fw={600} size="sm">
|
||||||
|
{t("AI Answer")}
|
||||||
|
</Text>
|
||||||
|
{isLoading && <Loader size="xs" />}
|
||||||
|
</Group>
|
||||||
|
<div
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: DOMPurify.sanitize(markdownToHtml(answer) as string),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
|
{deduplicatedSources.length > 0 && (
|
||||||
|
<Stack gap="xs">
|
||||||
|
<Text size="xs" fw={600} c="dimmed">
|
||||||
|
{t("Sources")}
|
||||||
|
</Text>
|
||||||
|
{deduplicatedSources.map((source) => (
|
||||||
|
<Box
|
||||||
|
key={source.pageId}
|
||||||
|
component={Link}
|
||||||
|
to={buildPageUrl(source.spaceSlug, source.slugId, source.title)}
|
||||||
|
style={{
|
||||||
|
textDecoration: "none",
|
||||||
|
color: "inherit",
|
||||||
|
display: "block",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Paper
|
||||||
|
p="xs"
|
||||||
|
radius="sm"
|
||||||
|
withBorder
|
||||||
|
style={{ cursor: "pointer" }}
|
||||||
|
>
|
||||||
|
<Group gap="xs">
|
||||||
|
<IconFileText size={16} />
|
||||||
|
<Text size="sm" truncate>
|
||||||
|
{source.title}
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
</Paper>
|
||||||
|
</Box>
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
import { Group, Text, Switch, MantineSize, Title } from "@mantine/core";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
import { workspaceAtom } from "@/features/user/atoms/current-user-atom.ts";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { updateWorkspace } from "@/features/workspace/services/workspace-service.ts";
|
||||||
|
import { notifications } from "@mantine/notifications";
|
||||||
|
import { isCloud } from "@/lib/config.ts";
|
||||||
|
import useLicense from "@/ee/hooks/use-license.tsx";
|
||||||
|
|
||||||
|
export default function EnableAiSearch() {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Group justify="space-between" wrap="nowrap" gap="xl">
|
||||||
|
<div>
|
||||||
|
<Text size="md">{t("AI-powered search (Ask AI)")}</Text>
|
||||||
|
<Text size="sm" c="dimmed">
|
||||||
|
{t(
|
||||||
|
"AI search uses vector embeddings to provide semantic search capabilities across your workspace content.",
|
||||||
|
)}
|
||||||
|
</Text>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<AiSearchToggle />
|
||||||
|
</Group>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AiSearchToggleProps {
|
||||||
|
size?: MantineSize;
|
||||||
|
label?: string;
|
||||||
|
}
|
||||||
|
export function AiSearchToggle({ size, label }: AiSearchToggleProps) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [workspace, setWorkspace] = useAtom(workspaceAtom);
|
||||||
|
const [checked, setChecked] = useState(workspace?.settings?.ai?.search);
|
||||||
|
const { hasLicenseKey } = useLicense();
|
||||||
|
|
||||||
|
const hasAccess = isCloud() || (!isCloud() && hasLicenseKey);
|
||||||
|
|
||||||
|
const handleChange = async (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const value = event.currentTarget.checked;
|
||||||
|
try {
|
||||||
|
const updatedWorkspace = await updateWorkspace({ aiSearch: value });
|
||||||
|
setChecked(value);
|
||||||
|
setWorkspace(updatedWorkspace);
|
||||||
|
} catch (err) {
|
||||||
|
notifications.show({
|
||||||
|
message: err?.response?.data?.message,
|
||||||
|
color: "red",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Switch
|
||||||
|
size={size}
|
||||||
|
label={label}
|
||||||
|
labelPosition="left"
|
||||||
|
defaultChecked={checked}
|
||||||
|
onChange={handleChange}
|
||||||
|
disabled={!hasAccess}
|
||||||
|
aria-label={t("Toggle AI search")}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import { useMutation, UseMutationResult } from "@tanstack/react-query";
|
||||||
|
import { useState, useCallback } from "react";
|
||||||
|
import { askAi, IAiSearchResponse } from "@/ee/ai/services/ai-search-service.ts";
|
||||||
|
import { IPageSearchParams } from "@/features/search/types/search.types.ts";
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
interface UseAiSearchResult extends UseMutationResult<IAiSearchResponse, Error, IPageSearchParams> {
|
||||||
|
streamingAnswer: string;
|
||||||
|
streamingSources: any[];
|
||||||
|
clearStreaming: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useAiSearch(): UseAiSearchResult {
|
||||||
|
const [streamingAnswer, setStreamingAnswer] = useState("");
|
||||||
|
const [streamingSources, setStreamingSources] = useState<any[]>([]);
|
||||||
|
|
||||||
|
const clearStreaming = useCallback(() => {
|
||||||
|
setStreamingAnswer("");
|
||||||
|
setStreamingSources([]);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const mutation = useMutation({
|
||||||
|
mutationFn: async (params: IPageSearchParams & { contentType?: string }) => {
|
||||||
|
setStreamingAnswer("");
|
||||||
|
setStreamingSources([]);
|
||||||
|
|
||||||
|
const { contentType, ...apiParams } = params;
|
||||||
|
|
||||||
|
return await askAi(apiParams, (chunk) => {
|
||||||
|
if (chunk.content) {
|
||||||
|
setStreamingAnswer((prev) => prev + chunk.content);
|
||||||
|
}
|
||||||
|
if (chunk.sources) {
|
||||||
|
setStreamingSources(chunk.sources);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
...mutation,
|
||||||
|
streamingAnswer,
|
||||||
|
streamingSources,
|
||||||
|
clearStreaming,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import { useState, useCallback, useRef } from "react";
|
||||||
|
import { useAiGenerateStreamMutation } from "@/ee/ai/queries/ai-query.ts";
|
||||||
|
import { AiGenerateDto } from "@/ee/ai/types/ai.types.ts";
|
||||||
|
|
||||||
|
export function useAiStream() {
|
||||||
|
const [content, setContent] = useState("");
|
||||||
|
const [isStreaming, setIsStreaming] = useState(false);
|
||||||
|
const abortControllerRef = useRef<AbortController | null>(null);
|
||||||
|
const mutation = useAiGenerateStreamMutation();
|
||||||
|
|
||||||
|
const startStream = useCallback(
|
||||||
|
async (data: AiGenerateDto) => {
|
||||||
|
setContent("");
|
||||||
|
setIsStreaming(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const controller = await mutation.mutateAsync({
|
||||||
|
...data,
|
||||||
|
onChunk: (chunk) => {
|
||||||
|
setContent((prev) => prev + chunk.content);
|
||||||
|
},
|
||||||
|
onError: (error) => {
|
||||||
|
console.error("AI stream error:", error);
|
||||||
|
setIsStreaming(false);
|
||||||
|
},
|
||||||
|
onComplete: () => {
|
||||||
|
setIsStreaming(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
abortControllerRef.current = controller;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to start stream:", error);
|
||||||
|
setIsStreaming(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[mutation]
|
||||||
|
);
|
||||||
|
|
||||||
|
const stopStream = useCallback(() => {
|
||||||
|
if (abortControllerRef.current) {
|
||||||
|
abortControllerRef.current.abort();
|
||||||
|
abortControllerRef.current = null;
|
||||||
|
setIsStreaming(false);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const resetContent = useCallback(() => {
|
||||||
|
setContent("");
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return {
|
||||||
|
content,
|
||||||
|
isStreaming,
|
||||||
|
startStream,
|
||||||
|
stopStream,
|
||||||
|
resetContent,
|
||||||
|
isLoading: mutation.isPending,
|
||||||
|
error: mutation.error,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import { Helmet } from "react-helmet-async";
|
||||||
|
import { getAppName, isCloud } from "@/lib/config.ts";
|
||||||
|
import SettingsTitle from "@/components/settings/settings-title.tsx";
|
||||||
|
import React from "react";
|
||||||
|
import useUserRole from "@/hooks/use-user-role.tsx";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import useLicense from "@/ee/hooks/use-license.tsx";
|
||||||
|
import EnableAiSearch from "@/ee/ai/components/enable-ai-search.tsx";
|
||||||
|
import { Alert } from "@mantine/core";
|
||||||
|
import { IconInfoCircle } from "@tabler/icons-react";
|
||||||
|
|
||||||
|
export default function AiSettings() {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { isAdmin } = useUserRole();
|
||||||
|
const { hasLicenseKey } = useLicense();
|
||||||
|
|
||||||
|
if (!isAdmin) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasAccess = isCloud() || (!isCloud() && hasLicenseKey);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Helmet>
|
||||||
|
<title>AI - {getAppName()}</title>
|
||||||
|
</Helmet>
|
||||||
|
<SettingsTitle title={t("AI settings")} />
|
||||||
|
|
||||||
|
{!hasAccess && (
|
||||||
|
<Alert
|
||||||
|
icon={<IconInfoCircle />}
|
||||||
|
title={t("Enterprise feature")}
|
||||||
|
color="blue"
|
||||||
|
mb="lg"
|
||||||
|
>
|
||||||
|
{t(
|
||||||
|
"AI is only available in the Docmost enterprise edition. Contact sales@docmost.com.",
|
||||||
|
)}
|
||||||
|
</Alert>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<EnableAiSearch />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import {
|
||||||
|
useMutation,
|
||||||
|
UseMutationResult,
|
||||||
|
useQuery,
|
||||||
|
UseQueryResult,
|
||||||
|
} from "@tanstack/react-query";
|
||||||
|
import {
|
||||||
|
generateAiContent,
|
||||||
|
generateAiContentStream,
|
||||||
|
} from "@/ee/ai/services/ai-service.ts";
|
||||||
|
import {
|
||||||
|
AiConfigResponse,
|
||||||
|
AiContentResponse,
|
||||||
|
AiGenerateDto,
|
||||||
|
AiStreamChunk,
|
||||||
|
AiStreamError,
|
||||||
|
} from "@/ee/ai/types/ai.types.ts";
|
||||||
|
|
||||||
|
export function useAiGenerateMutation(): UseMutationResult<
|
||||||
|
AiContentResponse,
|
||||||
|
Error,
|
||||||
|
AiGenerateDto
|
||||||
|
> {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: (data: AiGenerateDto) => generateAiContent(data),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
interface StreamCallbacks {
|
||||||
|
onChunk: (chunk: AiStreamChunk) => void;
|
||||||
|
onError?: (error: AiStreamError) => void;
|
||||||
|
onComplete?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useAiGenerateStreamMutation(): UseMutationResult<
|
||||||
|
AbortController,
|
||||||
|
Error,
|
||||||
|
AiGenerateDto & StreamCallbacks
|
||||||
|
> {
|
||||||
|
return useMutation({
|
||||||
|
mutationFn: ({ onChunk, onError, onComplete, ...data }) =>
|
||||||
|
generateAiContentStream(data, onChunk, onError, onComplete),
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
import api from "@/lib/api-client.ts";
|
||||||
|
import { IPageSearchParams } from "@/features/search/types/search.types.ts";
|
||||||
|
|
||||||
|
export interface IAiSearchResponse {
|
||||||
|
answer: string;
|
||||||
|
sources?: Array<{
|
||||||
|
pageId: string;
|
||||||
|
title: string;
|
||||||
|
slugId: string;
|
||||||
|
spaceSlug: string;
|
||||||
|
similarity: number;
|
||||||
|
distance: number;
|
||||||
|
chunkIndex: number;
|
||||||
|
excerpt: string;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function askAi(
|
||||||
|
params: IPageSearchParams,
|
||||||
|
onChunk?: (chunk: { content?: string; sources?: any[] }) => void,
|
||||||
|
): Promise<IAiSearchResponse> {
|
||||||
|
const response = await fetch("/api/ai/ask", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
credentials: "include",
|
||||||
|
body: JSON.stringify(params),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const reader = response.body?.getReader();
|
||||||
|
const decoder = new TextDecoder();
|
||||||
|
|
||||||
|
let answer = "";
|
||||||
|
let sources: any[] = [];
|
||||||
|
let buffer = "";
|
||||||
|
|
||||||
|
if (reader) {
|
||||||
|
while (true) {
|
||||||
|
const { done, value } = await reader.read();
|
||||||
|
if (done) break;
|
||||||
|
|
||||||
|
buffer += decoder.decode(value, { stream: true });
|
||||||
|
const lines = buffer.split("\n");
|
||||||
|
|
||||||
|
// Keep the last incomplete line in the buffer
|
||||||
|
buffer = lines.pop() || "";
|
||||||
|
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.startsWith("data: ")) {
|
||||||
|
const data = line.slice(6);
|
||||||
|
if (data === "[DONE]") break;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(data);
|
||||||
|
if (parsed.error) {
|
||||||
|
throw new Error(parsed.error);
|
||||||
|
}
|
||||||
|
if (parsed.content) {
|
||||||
|
answer += parsed.content;
|
||||||
|
onChunk?.({ content: parsed.content });
|
||||||
|
}
|
||||||
|
if (parsed.sources) {
|
||||||
|
sources = parsed.sources;
|
||||||
|
onChunk?.({ sources: parsed.sources });
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
// Skip invalid JSON
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { answer, sources };
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
import api from "@/lib/api-client.ts";
|
||||||
|
import {
|
||||||
|
AiGenerateDto,
|
||||||
|
AiContentResponse,
|
||||||
|
AiStreamChunk,
|
||||||
|
AiStreamError,
|
||||||
|
} from "@/ee/ai/types/ai.types.ts";
|
||||||
|
|
||||||
|
export async function generateAiContent(
|
||||||
|
data: AiGenerateDto,
|
||||||
|
): Promise<AiContentResponse> {
|
||||||
|
const req = await api.post<AiContentResponse>("/ai/generate", data);
|
||||||
|
return req.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function generateAiContentStream(
|
||||||
|
data: AiGenerateDto,
|
||||||
|
onChunk: (chunk: AiStreamChunk) => void,
|
||||||
|
onError?: (error: AiStreamError) => void,
|
||||||
|
onComplete?: () => void,
|
||||||
|
): Promise<AbortController> {
|
||||||
|
const abortController = new AbortController();
|
||||||
|
try {
|
||||||
|
const response = await fetch("/api/ai/generate/stream", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
signal: abortController.signal,
|
||||||
|
credentials: "include", // This ensures cookies are sent, matching axios withCredentials
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const reader = response.body?.getReader();
|
||||||
|
const decoder = new TextDecoder();
|
||||||
|
|
||||||
|
if (!reader) {
|
||||||
|
throw new Error("Response body is not readable");
|
||||||
|
}
|
||||||
|
|
||||||
|
const processStream = async () => {
|
||||||
|
try {
|
||||||
|
while (true) {
|
||||||
|
const { done, value } = await reader.read();
|
||||||
|
if (done) break;
|
||||||
|
|
||||||
|
const chunk = decoder.decode(value, { stream: true });
|
||||||
|
const lines = chunk.split("\n");
|
||||||
|
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.startsWith("data: ")) {
|
||||||
|
const data = line.slice(6);
|
||||||
|
if (data === "[DONE]") {
|
||||||
|
onComplete?.();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(data);
|
||||||
|
if (parsed.error) {
|
||||||
|
onError?.(parsed);
|
||||||
|
} else {
|
||||||
|
onChunk(parsed);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore parse errors for incomplete chunks
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.name !== "AbortError") {
|
||||||
|
onError?.({ error: error.message });
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
reader.releaseLock();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
processStream();
|
||||||
|
} catch (error) {
|
||||||
|
onError?.({ error: error.message });
|
||||||
|
}
|
||||||
|
|
||||||
|
return abortController;
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
export enum AiAction {
|
||||||
|
IMPROVE_WRITING = "improve_writing",
|
||||||
|
FIX_SPELLING_GRAMMAR = "fix_spelling_grammar",
|
||||||
|
MAKE_SHORTER = "make_shorter",
|
||||||
|
MAKE_LONGER = "make_longer",
|
||||||
|
SIMPLIFY = "simplify",
|
||||||
|
CHANGE_TONE = "change_tone",
|
||||||
|
SUMMARIZE = "summarize",
|
||||||
|
CONTINUE_WRITING = "continue_writing",
|
||||||
|
TRANSLATE = "translate",
|
||||||
|
CUSTOM = "custom",
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AiGenerateDto {
|
||||||
|
action?: AiAction;
|
||||||
|
content: string;
|
||||||
|
prompt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AiContentResponse {
|
||||||
|
content: string;
|
||||||
|
usage?: {
|
||||||
|
promptTokens: number;
|
||||||
|
completionTokens: number;
|
||||||
|
totalTokens: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AiConfigResponse {
|
||||||
|
configured: boolean;
|
||||||
|
availableActions: AiAction[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AiStreamChunk {
|
||||||
|
content: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AiStreamError {
|
||||||
|
error: string;
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ export default function OssDetails() {
|
|||||||
withTableBorder
|
withTableBorder
|
||||||
>
|
>
|
||||||
<Table.Caption>
|
<Table.Caption>
|
||||||
To unlock enterprise features like SSO, MFA, Resolve comments, contact sales@docmost.com.
|
To unlock enterprise features like AI, SSO, MFA, Resolve comments, contact sales@docmost.com.
|
||||||
</Table.Caption>
|
</Table.Caption>
|
||||||
<Table.Tbody>
|
<Table.Tbody>
|
||||||
<Table.Tr>
|
<Table.Tr>
|
||||||
|
|||||||
@@ -3,3 +3,15 @@ import { atom } from 'jotai';
|
|||||||
export const showCommentPopupAtom = atom<boolean>(false);
|
export const showCommentPopupAtom = atom<boolean>(false);
|
||||||
export const activeCommentIdAtom = atom<string>('');
|
export const activeCommentIdAtom = atom<string>('');
|
||||||
export const draftCommentIdAtom = atom<string>('');
|
export const draftCommentIdAtom = atom<string>('');
|
||||||
|
|
||||||
|
// Read-only comment state
|
||||||
|
export const showReadOnlyCommentPopupAtom = atom<boolean>(false);
|
||||||
|
export type YjsSelection = {
|
||||||
|
anchor: any;
|
||||||
|
head: any;
|
||||||
|
};
|
||||||
|
export type ReadOnlyCommentData = {
|
||||||
|
yjsSelection: YjsSelection;
|
||||||
|
selectedText: string;
|
||||||
|
};
|
||||||
|
export const readOnlyCommentDataAtom = atom<ReadOnlyCommentData | null>(null);
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import {
|
|||||||
} from "@tanstack/react-query";
|
} from "@tanstack/react-query";
|
||||||
import {
|
import {
|
||||||
createComment,
|
createComment,
|
||||||
|
createReadOnlyComment,
|
||||||
|
CreateReadOnlyCommentData,
|
||||||
deleteComment,
|
deleteComment,
|
||||||
getPageComments,
|
getPageComments,
|
||||||
updateComment,
|
updateComment,
|
||||||
@@ -106,4 +108,23 @@ export function useDeleteCommentMutation(pageId?: string) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function useCreateReadOnlyCommentMutation() {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return useMutation<IComment, Error, CreateReadOnlyCommentData>({
|
||||||
|
mutationFn: (data) => createReadOnlyComment(data),
|
||||||
|
onSuccess: (data) => {
|
||||||
|
queryClient.refetchQueries({ queryKey: RQ_KEY(data.pageId) });
|
||||||
|
notifications.show({ message: t("Comment created successfully") });
|
||||||
|
},
|
||||||
|
onError: () => {
|
||||||
|
notifications.show({
|
||||||
|
message: t("Error creating comment"),
|
||||||
|
color: "red",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// EE: useResolveCommentMutation has been moved to @/ee/comment/queries/comment-query
|
// EE: useResolveCommentMutation has been moved to @/ee/comment/queries/comment-query
|
||||||
|
|||||||
@@ -40,3 +40,20 @@ export async function getPageComments(
|
|||||||
export async function deleteComment(commentId: string): Promise<void> {
|
export async function deleteComment(commentId: string): Promise<void> {
|
||||||
await api.post("/comments/delete", { commentId });
|
await api.post("/comments/delete", { commentId });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type CreateReadOnlyCommentData = {
|
||||||
|
pageId: string;
|
||||||
|
content: string;
|
||||||
|
selection?: string;
|
||||||
|
yjsSelection: {
|
||||||
|
anchor: any;
|
||||||
|
head: any;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export async function createReadOnlyComment(
|
||||||
|
data: CreateReadOnlyCommentData,
|
||||||
|
): Promise<IComment> {
|
||||||
|
const req = await api.post<IComment>("/comments/create-readonly", data);
|
||||||
|
return req.data;
|
||||||
|
}
|
||||||
|
|||||||
@@ -144,16 +144,16 @@ export const EditorBubbleMenu: FC<EditorBubbleMenuProps> = (props) => {
|
|||||||
onHide: () => {
|
onHide: () => {
|
||||||
setIsNodeSelectorOpen(false);
|
setIsNodeSelectorOpen(false);
|
||||||
setIsTextAlignmentOpen(false);
|
setIsTextAlignmentOpen(false);
|
||||||
setIsColorSelectorOpen(false);
|
|
||||||
setIsLinkSelectorOpen(false);
|
setIsLinkSelectorOpen(false);
|
||||||
|
setIsColorSelectorOpen(false);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const [isNodeSelectorOpen, setIsNodeSelectorOpen] = useState(false);
|
const [isNodeSelectorOpen, setIsNodeSelectorOpen] = useState(false);
|
||||||
const [isTextAlignmentSelectorOpen, setIsTextAlignmentOpen] = useState(false);
|
const [isTextAlignmentSelectorOpen, setIsTextAlignmentOpen] = useState(false);
|
||||||
const [isColorSelectorOpen, setIsColorSelectorOpen] = useState(false);
|
|
||||||
const [isLinkSelectorOpen, setIsLinkSelectorOpen] = useState(false);
|
const [isLinkSelectorOpen, setIsLinkSelectorOpen] = useState(false);
|
||||||
|
const [isColorSelectorOpen, setIsColorSelectorOpen] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BubbleMenu {...bubbleMenuProps}>
|
<BubbleMenu {...bubbleMenuProps}>
|
||||||
@@ -164,8 +164,8 @@ export const EditorBubbleMenu: FC<EditorBubbleMenuProps> = (props) => {
|
|||||||
setIsOpen={() => {
|
setIsOpen={() => {
|
||||||
setIsNodeSelectorOpen(!isNodeSelectorOpen);
|
setIsNodeSelectorOpen(!isNodeSelectorOpen);
|
||||||
setIsTextAlignmentOpen(false);
|
setIsTextAlignmentOpen(false);
|
||||||
setIsColorSelectorOpen(false);
|
|
||||||
setIsLinkSelectorOpen(false);
|
setIsLinkSelectorOpen(false);
|
||||||
|
setIsColorSelectorOpen(false);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -175,8 +175,8 @@ export const EditorBubbleMenu: FC<EditorBubbleMenuProps> = (props) => {
|
|||||||
setIsOpen={() => {
|
setIsOpen={() => {
|
||||||
setIsTextAlignmentOpen(!isTextAlignmentSelectorOpen);
|
setIsTextAlignmentOpen(!isTextAlignmentSelectorOpen);
|
||||||
setIsNodeSelectorOpen(false);
|
setIsNodeSelectorOpen(false);
|
||||||
setIsColorSelectorOpen(false);
|
|
||||||
setIsLinkSelectorOpen(false);
|
setIsLinkSelectorOpen(false);
|
||||||
|
setIsColorSelectorOpen(false);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Dispatch, FC, SetStateAction } from "react";
|
import React, { Dispatch, FC, SetStateAction } from "react";
|
||||||
import { IconCheck, IconPalette } from "@tabler/icons-react";
|
import { IconCheck, IconChevronDown, IconPalette } from "@tabler/icons-react";
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Button,
|
Button,
|
||||||
@@ -8,6 +8,9 @@ import {
|
|||||||
ScrollArea,
|
ScrollArea,
|
||||||
Text,
|
Text,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
|
SimpleGrid,
|
||||||
|
Box,
|
||||||
|
Stack,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import type { Editor } from "@tiptap/react";
|
import type { Editor } from "@tiptap/react";
|
||||||
import { useEditorState } from "@tiptap/react";
|
import { useEditorState } from "@tiptap/react";
|
||||||
@@ -61,9 +64,12 @@ const TEXT_COLORS: BubbleColorMenuItem[] = [
|
|||||||
name: "Gray",
|
name: "Gray",
|
||||||
color: "#A8A29E",
|
color: "#A8A29E",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Brown",
|
||||||
|
color: "#92400E",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// TODO: handle dark mode
|
|
||||||
const HIGHLIGHT_COLORS: BubbleColorMenuItem[] = [
|
const HIGHLIGHT_COLORS: BubbleColorMenuItem[] = [
|
||||||
{
|
{
|
||||||
name: "Default",
|
name: "Default",
|
||||||
@@ -71,35 +77,39 @@ const HIGHLIGHT_COLORS: BubbleColorMenuItem[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Blue",
|
name: "Blue",
|
||||||
color: "#c1ecf9",
|
color: "#98d8f2",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Green",
|
name: "Green",
|
||||||
color: "#acf79f",
|
color: "#7edb6c",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Purple",
|
name: "Purple",
|
||||||
color: "#f6f3f8",
|
color: "#e0d6ed",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Red",
|
name: "Red",
|
||||||
color: "#fdebeb",
|
color: "#ffc6c2",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Yellow",
|
name: "Yellow",
|
||||||
color: "#fbf4a2",
|
color: "#faf594",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Orange",
|
name: "Orange",
|
||||||
color: "#faebdd",
|
color: "#f5c8a9",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Pink",
|
name: "Pink",
|
||||||
color: "#faf1f5",
|
color: "#f5cfe0",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Gray",
|
name: "Gray",
|
||||||
color: "#f1f1ef",
|
color: "#dfdfd7",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Brown",
|
||||||
|
color: "#d7c4b7",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -112,17 +122,21 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
|
|||||||
|
|
||||||
const editorState = useEditorState({
|
const editorState = useEditorState({
|
||||||
editor,
|
editor,
|
||||||
selector: ctx => {
|
selector: (ctx) => {
|
||||||
if (!ctx.editor) {
|
if (!ctx.editor) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const activeColors: Record<string, boolean> = {};
|
const activeColors: Record<string, boolean> = {};
|
||||||
TEXT_COLORS.forEach(({ color }) => {
|
TEXT_COLORS.forEach(({ color }) => {
|
||||||
activeColors[`text_${color}`] = ctx.editor.isActive("textStyle", { color });
|
activeColors[`text_${color}`] = ctx.editor.isActive("textStyle", {
|
||||||
|
color,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
HIGHLIGHT_COLORS.forEach(({ color }) => {
|
HIGHLIGHT_COLORS.forEach(({ color }) => {
|
||||||
activeColors[`highlight_${color}`] = ctx.editor.isActive("highlight", { color });
|
activeColors[`highlight_${color}`] = ctx.editor.isActive("highlight", {
|
||||||
|
color,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return activeColors;
|
return activeColors;
|
||||||
@@ -133,67 +147,152 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const activeColorItem = TEXT_COLORS.find(({ color }) =>
|
const activeColorItem = TEXT_COLORS.find(
|
||||||
editorState[`text_${color}`]
|
({ color }) => editorState[`text_${color}`],
|
||||||
);
|
);
|
||||||
|
|
||||||
const activeHighlightItem = HIGHLIGHT_COLORS.find(({ color }) =>
|
const activeHighlightItem = HIGHLIGHT_COLORS.find(
|
||||||
editorState[`highlight_${color}`]
|
({ color }) => editorState[`highlight_${color}`],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover width={200} opened={isOpen} withArrow>
|
<Popover width={220} opened={isOpen} withArrow>
|
||||||
<Popover.Target>
|
<Popover.Target>
|
||||||
<Tooltip label={t("Text color")} withArrow>
|
<Tooltip label={t("Text color")} withArrow>
|
||||||
<ActionIcon
|
<Button
|
||||||
variant="default"
|
variant="default"
|
||||||
size="lg"
|
|
||||||
radius="0"
|
radius="0"
|
||||||
style={{
|
rightSection={<IconChevronDown size={16} />}
|
||||||
border: "none",
|
|
||||||
color: activeColorItem?.color,
|
|
||||||
}}
|
|
||||||
onClick={() => setIsOpen(!isOpen)}
|
onClick={() => setIsOpen(!isOpen)}
|
||||||
|
data-text-color={activeColorItem?.color || ""}
|
||||||
|
data-highlight-color={activeHighlightItem?.color || ""}
|
||||||
|
className="color-selector-trigger"
|
||||||
|
style={{
|
||||||
|
height: "34px",
|
||||||
|
border: "none",
|
||||||
|
fontWeight: 500,
|
||||||
|
fontSize: rem(16),
|
||||||
|
paddingLeft: rem(8),
|
||||||
|
paddingRight: rem(4),
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<IconPalette size={16} stroke={2} />
|
A
|
||||||
</ActionIcon>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Popover.Target>
|
</Popover.Target>
|
||||||
|
|
||||||
<Popover.Dropdown>
|
<Popover.Dropdown>
|
||||||
{/* make mah responsive */}
|
|
||||||
<ScrollArea.Autosize type="scroll" mah="400">
|
<ScrollArea.Autosize type="scroll" mah="400">
|
||||||
<Text span c="dimmed" tt="uppercase" inherit>
|
<Stack gap="md">
|
||||||
{t("Color")}
|
<Box>
|
||||||
</Text>
|
<Text size="sm" fw={600} mb="xs">
|
||||||
|
{t("Text color")}
|
||||||
|
</Text>
|
||||||
|
<SimpleGrid cols={5} spacing="xs">
|
||||||
|
{TEXT_COLORS.map(({ name, color }, index) => (
|
||||||
|
<Tooltip key={index} label={t(name)} withArrow>
|
||||||
|
<Box
|
||||||
|
onClick={() => {
|
||||||
|
if (name === "Default") {
|
||||||
|
editor.commands.unsetColor();
|
||||||
|
} else {
|
||||||
|
editor
|
||||||
|
.chain()
|
||||||
|
.focus()
|
||||||
|
.setColor(color || "")
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
setIsOpen(false);
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
width: rem(28),
|
||||||
|
height: rem(28),
|
||||||
|
borderRadius: rem(6),
|
||||||
|
border: editorState[`text_${color}`]
|
||||||
|
? "2px solid var(--mantine-color-gray-8)"
|
||||||
|
: "1px solid var(--mantine-color-gray-4)",
|
||||||
|
cursor: "pointer",
|
||||||
|
position: "relative",
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
fontSize: rem(16),
|
||||||
|
fontWeight: 600,
|
||||||
|
color: color || "var(--mantine-color-gray-8)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
A
|
||||||
|
</Box>
|
||||||
|
</Tooltip>
|
||||||
|
))}
|
||||||
|
</SimpleGrid>
|
||||||
|
</Box>
|
||||||
|
|
||||||
<Button.Group orientation="vertical">
|
<Box>
|
||||||
{TEXT_COLORS.map(({ name, color }, index) => (
|
<Text size="sm" fw={600} mb="xs">
|
||||||
<Button
|
{t("Highlight color")}
|
||||||
key={index}
|
</Text>
|
||||||
variant="default"
|
<SimpleGrid cols={5} spacing="xs">
|
||||||
leftSection={<span style={{ color }}>A</span>}
|
{HIGHLIGHT_COLORS.map(({ name, color }, index) => (
|
||||||
justify="left"
|
<Tooltip key={index} label={t(name)} withArrow>
|
||||||
fullWidth
|
<Box
|
||||||
rightSection={
|
onClick={() => {
|
||||||
editorState[`text_${color}`] && (
|
if (name === "Default") {
|
||||||
<IconCheck style={{ width: rem(16) }} />
|
editor.commands.unsetHighlight();
|
||||||
)
|
} else {
|
||||||
}
|
editor
|
||||||
onClick={() => {
|
.chain()
|
||||||
if (name === "Default") {
|
.focus()
|
||||||
editor.commands.unsetColor();
|
.toggleMark("highlight", {
|
||||||
} else {
|
color: color || "",
|
||||||
editor.chain().focus().setColor(color || "").run();
|
colorName: name.toLowerCase() || "",
|
||||||
}
|
})
|
||||||
setIsOpen(false);
|
.run();
|
||||||
}}
|
}
|
||||||
style={{ border: "none" }}
|
setIsOpen(false);
|
||||||
>
|
}}
|
||||||
{t(name)}
|
style={{
|
||||||
</Button>
|
width: rem(28),
|
||||||
))}
|
height: rem(28),
|
||||||
</Button.Group>
|
borderRadius: rem(4),
|
||||||
|
backgroundColor: color || "var(--mantine-color-gray-2)",
|
||||||
|
border: "1px solid var(--mantine-color-gray-4)",
|
||||||
|
cursor: "pointer",
|
||||||
|
position: "relative",
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
fontSize: rem(16),
|
||||||
|
fontWeight: 600,
|
||||||
|
color: "var(--mantine-color-gray-8)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{editorState[`highlight_${color}`] ? (
|
||||||
|
<IconCheck
|
||||||
|
size={16}
|
||||||
|
color="var(--mantine-color-green-7)"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
"A"
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
</Tooltip>
|
||||||
|
))}
|
||||||
|
</SimpleGrid>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
variant="default"
|
||||||
|
fullWidth
|
||||||
|
onClick={() => {
|
||||||
|
editor.commands.unsetColor();
|
||||||
|
editor.commands.unsetHighlight();
|
||||||
|
setIsOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("Remove color")}
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
</ScrollArea.Autosize>
|
</ScrollArea.Autosize>
|
||||||
</Popover.Dropdown>
|
</Popover.Dropdown>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
import {
|
||||||
|
BubbleMenu,
|
||||||
|
isNodeSelection,
|
||||||
|
isTextSelection,
|
||||||
|
useEditor,
|
||||||
|
} from "@tiptap/react";
|
||||||
|
import { FC, useEffect, useRef } from "react";
|
||||||
|
import { IconMessage } from "@tabler/icons-react";
|
||||||
|
import classes from "./bubble-menu.module.css";
|
||||||
|
import { ActionIcon, Tooltip } from "@mantine/core";
|
||||||
|
import {
|
||||||
|
readOnlyCommentDataAtom,
|
||||||
|
showReadOnlyCommentPopupAtom,
|
||||||
|
} from "@/features/comment/atoms/comment-atom";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
import { isCellSelection } from "@docmost/editor-ext";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { ySyncPluginKey } from "y-prosemirror";
|
||||||
|
import { getRelativeSelection } from "y-prosemirror";
|
||||||
|
|
||||||
|
type ReadOnlyBubbleMenuProps = {
|
||||||
|
editor: ReturnType<typeof useEditor>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const ReadOnlyBubbleMenu: FC<ReadOnlyBubbleMenuProps> = ({ editor }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [showReadOnlyCommentPopup, setShowReadOnlyCommentPopup] = useAtom(
|
||||||
|
showReadOnlyCommentPopupAtom,
|
||||||
|
);
|
||||||
|
const [, setReadOnlyCommentData] = useAtom(readOnlyCommentDataAtom);
|
||||||
|
const showPopupRef = useRef(showReadOnlyCommentPopup);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
showPopupRef.current = showReadOnlyCommentPopup;
|
||||||
|
}, [showReadOnlyCommentPopup]);
|
||||||
|
|
||||||
|
const handleCommentClick = () => {
|
||||||
|
if (!editor) return;
|
||||||
|
|
||||||
|
const view = editor.view;
|
||||||
|
const ystate = ySyncPluginKey.getState(view.state);
|
||||||
|
|
||||||
|
if (ystate?.binding) {
|
||||||
|
const selection = getRelativeSelection(ystate.binding, view.state);
|
||||||
|
const { from, to } = editor.state.selection;
|
||||||
|
const selectedText = editor.state.doc.textBetween(from, to);
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
setReadOnlyCommentData({
|
||||||
|
yjsSelection: {
|
||||||
|
anchor: selection.anchor,
|
||||||
|
head: selection.head,
|
||||||
|
},
|
||||||
|
selectedText,
|
||||||
|
});
|
||||||
|
setShowReadOnlyCommentPopup(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Don't render if editor is not available or is editable
|
||||||
|
if (!editor || editor.isEditable) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BubbleMenu
|
||||||
|
editor={editor}
|
||||||
|
pluginKey="readonly"
|
||||||
|
shouldShow={({ state, editor }) => {
|
||||||
|
// Safety check - don't show if editor became editable
|
||||||
|
if (!editor || editor.isEditable || editor.isDestroyed) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { selection } = state;
|
||||||
|
const { empty, from, to } = selection;
|
||||||
|
|
||||||
|
if (
|
||||||
|
editor.isActive("image") ||
|
||||||
|
empty ||
|
||||||
|
isNodeSelection(selection) ||
|
||||||
|
isCellSelection(selection) ||
|
||||||
|
showPopupRef?.current
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if actual text is selected (not just empty block)
|
||||||
|
const hasText = state.doc.textBetween(from, to).length > 0;
|
||||||
|
return isTextSelection(selection) && hasText;
|
||||||
|
}}
|
||||||
|
tippyOptions={{
|
||||||
|
moveTransition: "transform 0.15s ease-out",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className={classes.bubbleMenu}>
|
||||||
|
<Tooltip label={t("Comment")} withArrow>
|
||||||
|
<ActionIcon
|
||||||
|
variant="default"
|
||||||
|
size="lg"
|
||||||
|
radius="0"
|
||||||
|
aria-label={t("Comment")}
|
||||||
|
style={{ border: "none" }}
|
||||||
|
onClick={handleCommentClick}
|
||||||
|
>
|
||||||
|
<IconMessage size={16} stroke={2} />
|
||||||
|
</ActionIcon>
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
</BubbleMenu>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
import React, { useState } from "react";
|
||||||
|
import { Dialog, Group, Stack, Text } from "@mantine/core";
|
||||||
|
import { useClickOutside } from "@mantine/hooks";
|
||||||
|
import { useAtom } from "jotai";
|
||||||
|
import {
|
||||||
|
activeCommentIdAtom,
|
||||||
|
readOnlyCommentDataAtom,
|
||||||
|
showReadOnlyCommentPopupAtom,
|
||||||
|
} from "@/features/comment/atoms/comment-atom";
|
||||||
|
import CommentEditor from "@/features/comment/components/comment-editor";
|
||||||
|
import CommentActions from "@/features/comment/components/comment-actions";
|
||||||
|
import { currentUserAtom } from "@/features/user/atoms/current-user-atom";
|
||||||
|
import { useCreateReadOnlyCommentMutation } from "@/features/comment/queries/comment-query";
|
||||||
|
import { asideStateAtom } from "@/components/layouts/global/hooks/atoms/sidebar-atom";
|
||||||
|
import { useEditor } from "@tiptap/react";
|
||||||
|
import { CustomAvatar } from "@/components/ui/custom-avatar.tsx";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useQueryEmit } from "@/features/websocket/use-query-emit";
|
||||||
|
|
||||||
|
type ReadOnlyCommentDialogProps = {
|
||||||
|
editor: ReturnType<typeof useEditor>;
|
||||||
|
pageId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
function ReadOnlyCommentDialog({ editor, pageId }: ReadOnlyCommentDialogProps) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [comment, setComment] = useState("");
|
||||||
|
const [, setShowReadOnlyCommentPopup] = useAtom(showReadOnlyCommentPopupAtom);
|
||||||
|
const [, setActiveCommentId] = useAtom(activeCommentIdAtom);
|
||||||
|
const [readOnlyCommentData, setReadOnlyCommentData] = useAtom(
|
||||||
|
readOnlyCommentDataAtom,
|
||||||
|
);
|
||||||
|
const [currentUser] = useAtom(currentUserAtom);
|
||||||
|
const [, setAsideState] = useAtom(asideStateAtom);
|
||||||
|
const useClickOutsideRef = useClickOutside(() => {
|
||||||
|
handleDialogClose();
|
||||||
|
});
|
||||||
|
const createCommentMutation = useCreateReadOnlyCommentMutation();
|
||||||
|
const { isPending } = createCommentMutation;
|
||||||
|
|
||||||
|
const emit = useQueryEmit();
|
||||||
|
|
||||||
|
const handleDialogClose = () => {
|
||||||
|
setShowReadOnlyCommentPopup(false);
|
||||||
|
setReadOnlyCommentData(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAddComment = async () => {
|
||||||
|
if (!readOnlyCommentData) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const commentData = {
|
||||||
|
pageId: pageId,
|
||||||
|
content: JSON.stringify(comment),
|
||||||
|
selection: readOnlyCommentData.selectedText,
|
||||||
|
yjsSelection: readOnlyCommentData.yjsSelection,
|
||||||
|
};
|
||||||
|
|
||||||
|
const createdComment =
|
||||||
|
await createCommentMutation.mutateAsync(commentData);
|
||||||
|
|
||||||
|
setActiveCommentId(createdComment.id);
|
||||||
|
setAsideState({ tab: "comments", isAsideOpen: true });
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
const selector = `div[data-comment-id="${createdComment.id}"]`;
|
||||||
|
const commentElement = document.querySelector(selector);
|
||||||
|
commentElement?.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||||
|
}, 400);
|
||||||
|
|
||||||
|
emit({
|
||||||
|
operation: "invalidateComment",
|
||||||
|
pageId: pageId,
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setShowReadOnlyCommentPopup(false);
|
||||||
|
setReadOnlyCommentData(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCommentEditorChange = (newContent: any) => {
|
||||||
|
setComment(newContent);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog
|
||||||
|
opened={true}
|
||||||
|
onClose={handleDialogClose}
|
||||||
|
ref={useClickOutsideRef}
|
||||||
|
size="lg"
|
||||||
|
radius="md"
|
||||||
|
w={300}
|
||||||
|
position={{ bottom: 500, right: 50 }}
|
||||||
|
withCloseButton
|
||||||
|
withBorder
|
||||||
|
>
|
||||||
|
<Stack gap={2}>
|
||||||
|
<Group>
|
||||||
|
<CustomAvatar
|
||||||
|
size="sm"
|
||||||
|
avatarUrl={currentUser.user.avatarUrl}
|
||||||
|
name={currentUser.user.name}
|
||||||
|
/>
|
||||||
|
<div style={{ flex: 1 }}>
|
||||||
|
<Group justify="space-between" wrap="nowrap">
|
||||||
|
<Text size="sm" fw={500} lineClamp={1}>
|
||||||
|
{currentUser.user.name}
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
</div>
|
||||||
|
</Group>
|
||||||
|
|
||||||
|
<CommentEditor
|
||||||
|
onUpdate={handleCommentEditorChange}
|
||||||
|
onSave={handleAddComment}
|
||||||
|
placeholder={t("Write a comment")}
|
||||||
|
editable={true}
|
||||||
|
autofocus={true}
|
||||||
|
/>
|
||||||
|
<CommentActions onSave={handleAddComment} isLoading={isPending} />
|
||||||
|
</Stack>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ReadOnlyCommentDialog;
|
||||||
@@ -5,6 +5,7 @@ import { v4 as uuidv4 } from "uuid";
|
|||||||
import classes from "./code-block.module.css";
|
import classes from "./code-block.module.css";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useComputedColorScheme } from "@mantine/core";
|
import { useComputedColorScheme } from "@mantine/core";
|
||||||
|
import DOMPurify from "dompurify";
|
||||||
|
|
||||||
interface MermaidViewProps {
|
interface MermaidViewProps {
|
||||||
props: NodeViewProps;
|
props: NodeViewProps;
|
||||||
@@ -37,7 +38,7 @@ export default function MermaidView({ props }: MermaidViewProps) {
|
|||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (props.editor.isEditable) {
|
if (props.editor.isEditable) {
|
||||||
setPreview(
|
setPreview(
|
||||||
`<div class="${classes.error}">${t("Mermaid diagram error:")} ${err}</div>`,
|
`<div class="${classes.error}">${t("Mermaid diagram error:")} ${DOMPurify.sanitize(err)}</div>`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
setPreview(
|
setPreview(
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ export const handlePaste = (
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
createMentionAction(url, view, pos, creatorId);
|
const anchorId = match[6] ? match[6].split('#')[0] : undefined;
|
||||||
|
const urlWithoutAnchor = anchorId ? url.substring(0, url.indexOf("#")) : url;
|
||||||
|
createMentionAction(urlWithoutAnchor, view, pos, creatorId, anchorId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export default function DrawioView(props: NodeViewProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeViewWrapper>
|
<NodeViewWrapper data-drag-handle>
|
||||||
<Modal.Root opened={opened} onClose={close} fullScreen>
|
<Modal.Root opened={opened} onClose={close} fullScreen>
|
||||||
<Modal.Overlay />
|
<Modal.Overlay />
|
||||||
<Modal.Content style={{ overflow: "hidden" }}>
|
<Modal.Content style={{ overflow: "hidden" }}>
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ export default function EmbedView(props: NodeViewProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeViewWrapper>
|
<NodeViewWrapper data-drag-handle>
|
||||||
{embedUrl ? (
|
{embedUrl ? (
|
||||||
<ResizableWrapper
|
<ResizableWrapper
|
||||||
initialHeight={nodeHeight || 480}
|
initialHeight={nodeHeight || 480}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export default function ExcalidrawView(props: NodeViewProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeViewWrapper>
|
<NodeViewWrapper data-drag-handle>
|
||||||
<ReactClearModal
|
<ReactClearModal
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export default function ImageView(props: NodeViewProps) {
|
|||||||
}, [align]);
|
}, [align]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeViewWrapper>
|
<NodeViewWrapper data-drag-handle>
|
||||||
<Image
|
<Image
|
||||||
radius="md"
|
radius="md"
|
||||||
fit="contain"
|
fit="contain"
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export type LinkFn = (
|
|||||||
view: EditorView,
|
view: EditorView,
|
||||||
pos: number,
|
pos: number,
|
||||||
creatorId: string,
|
creatorId: string,
|
||||||
|
anchorId?: string,
|
||||||
) => void;
|
) => void;
|
||||||
|
|
||||||
export interface InternalLinkOptions {
|
export interface InternalLinkOptions {
|
||||||
@@ -18,7 +19,7 @@ export interface InternalLinkOptions {
|
|||||||
|
|
||||||
export const handleInternalLink =
|
export const handleInternalLink =
|
||||||
({ validateFn, onResolveLink }: InternalLinkOptions): LinkFn =>
|
({ validateFn, onResolveLink }: InternalLinkOptions): LinkFn =>
|
||||||
async (url: string, view, pos, creatorId) => {
|
async (url: string, view, pos, creatorId, anchorId) => {
|
||||||
const validated = validateFn(url, view);
|
const validated = validateFn(url, view);
|
||||||
if (!validated) return;
|
if (!validated) return;
|
||||||
|
|
||||||
@@ -35,6 +36,7 @@ export const handleInternalLink =
|
|||||||
entityId: page.id,
|
entityId: page.id,
|
||||||
slugId: page.slugId,
|
slugId: page.slugId,
|
||||||
creatorId: creatorId,
|
creatorId: creatorId,
|
||||||
|
anchorId: anchorId,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
import { NodeViewProps, NodeViewWrapper } from "@tiptap/react";
|
import { NodeViewProps, NodeViewWrapper } from "@tiptap/react";
|
||||||
import { ActionIcon, Anchor, Text } from "@mantine/core";
|
import { ActionIcon, Anchor, Text } from "@mantine/core";
|
||||||
import { IconFileDescription } from "@tabler/icons-react";
|
import { IconFileDescription } from "@tabler/icons-react";
|
||||||
import { Link, useLocation, useParams } from "react-router-dom";
|
import { Link, useLocation, useNavigate, useParams } from "react-router-dom";
|
||||||
import { usePageQuery } from "@/features/page/queries/page-query.ts";
|
import { usePageQuery } from "@/features/page/queries/page-query.ts";
|
||||||
import {
|
import {
|
||||||
buildPageUrl,
|
buildPageUrl,
|
||||||
buildSharedPageUrl,
|
buildSharedPageUrl,
|
||||||
} from "@/features/page/page.utils.ts";
|
} from "@/features/page/page.utils.ts";
|
||||||
|
import { extractPageSlugId } from "@/lib";
|
||||||
import classes from "./mention.module.css";
|
import classes from "./mention.module.css";
|
||||||
|
|
||||||
export default function MentionView(props: NodeViewProps) {
|
export default function MentionView(props: NodeViewProps) {
|
||||||
const { node } = props;
|
const { node } = props;
|
||||||
const { label, entityType, entityId, slugId } = node.attrs;
|
const { label, entityType, entityId, slugId, anchorId } = node.attrs;
|
||||||
const { spaceSlug } = useParams();
|
const { spaceSlug, pageSlug } = useParams();
|
||||||
const { shareId } = useParams();
|
const { shareId } = useParams();
|
||||||
|
const navigate = useNavigate();
|
||||||
const {
|
const {
|
||||||
data: page,
|
data: page,
|
||||||
isLoading,
|
isLoading,
|
||||||
@@ -23,14 +25,29 @@ export default function MentionView(props: NodeViewProps) {
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const isShareRoute = location.pathname.startsWith("/share");
|
const isShareRoute = location.pathname.startsWith("/share");
|
||||||
|
|
||||||
|
const currentPageSlugId = extractPageSlugId(pageSlug);
|
||||||
|
const isSamePage = currentPageSlugId === slugId;
|
||||||
|
|
||||||
|
const handleClick = (e: React.MouseEvent) => {
|
||||||
|
if (isSamePage && anchorId) {
|
||||||
|
e.preventDefault();
|
||||||
|
const element = document.querySelector(`[id="${anchorId}"]`);
|
||||||
|
if (element) {
|
||||||
|
element.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||||
|
navigate(`#${anchorId}`, { replace: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const shareSlugUrl = buildSharedPageUrl({
|
const shareSlugUrl = buildSharedPageUrl({
|
||||||
shareId,
|
shareId,
|
||||||
pageSlugId: slugId,
|
pageSlugId: slugId,
|
||||||
pageTitle: label,
|
pageTitle: label,
|
||||||
|
anchorId,
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeViewWrapper style={{ display: "inline" }}>
|
<NodeViewWrapper style={{ display: "inline" }} data-drag-handle>
|
||||||
{entityType === "user" && (
|
{entityType === "user" && (
|
||||||
<Text className={classes.userMention} component="span">
|
<Text className={classes.userMention} component="span">
|
||||||
@{label}
|
@{label}
|
||||||
@@ -42,8 +59,9 @@ export default function MentionView(props: NodeViewProps) {
|
|||||||
component={Link}
|
component={Link}
|
||||||
fw={500}
|
fw={500}
|
||||||
to={
|
to={
|
||||||
isShareRoute ? shareSlugUrl : buildPageUrl(spaceSlug, slugId, label)
|
isShareRoute ? shareSlugUrl : buildPageUrl(spaceSlug, slugId, label, anchorId)
|
||||||
}
|
}
|
||||||
|
onClick={handleClick}
|
||||||
underline="never"
|
underline="never"
|
||||||
className={classes.pageMentionLink}
|
className={classes.pageMentionLink}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import {
|
|||||||
IconCalendar,
|
IconCalendar,
|
||||||
IconAppWindow,
|
IconAppWindow,
|
||||||
IconSitemap,
|
IconSitemap,
|
||||||
IconAlignLeft2,
|
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import {
|
import {
|
||||||
CommandProps,
|
CommandProps,
|
||||||
@@ -154,14 +153,6 @@ const CommandGroups: SlashMenuGroupedItemsType = {
|
|||||||
command: ({ editor, range }: CommandProps) =>
|
command: ({ editor, range }: CommandProps) =>
|
||||||
editor.chain().focus().deleteRange(range).setHorizontalRule().run(),
|
editor.chain().focus().deleteRange(range).setHorizontalRule().run(),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: "Table of contents",
|
|
||||||
description: "Insert table of contents",
|
|
||||||
searchTerms: ["toc"],
|
|
||||||
icon: IconAlignLeft2,
|
|
||||||
command: ({ editor, range }: CommandProps) =>
|
|
||||||
editor.chain().focus().deleteRange(range).insertTableOfContents().run(),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: "Image",
|
title: "Image",
|
||||||
description: "Upload any image from your device.",
|
description: "Upload any image from your device.",
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default function SubpagesView(props: NodeViewProps) {
|
|||||||
|
|
||||||
if (error && !shareId) {
|
if (error && !shareId) {
|
||||||
return (
|
return (
|
||||||
<NodeViewWrapper>
|
<NodeViewWrapper data-drag-handle>
|
||||||
<Text c="dimmed" size="md" py="md">
|
<Text c="dimmed" size="md" py="md">
|
||||||
{t("Failed to load subpages")}
|
{t("Failed to load subpages")}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -62,7 +62,7 @@ export default function SubpagesView(props: NodeViewProps) {
|
|||||||
|
|
||||||
if (subpages.length === 0) {
|
if (subpages.length === 0) {
|
||||||
return (
|
return (
|
||||||
<NodeViewWrapper>
|
<NodeViewWrapper data-drag-handle>
|
||||||
<div className={classes.container}>
|
<div className={classes.container}>
|
||||||
<Text c="dimmed" size="md" py="md">
|
<Text c="dimmed" size="md" py="md">
|
||||||
{t("No subpages")}
|
{t("No subpages")}
|
||||||
@@ -73,7 +73,7 @@ export default function SubpagesView(props: NodeViewProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeViewWrapper>
|
<NodeViewWrapper data-drag-handle>
|
||||||
<div className={classes.container}>
|
<div className={classes.container}>
|
||||||
<Stack gap={5}>
|
<Stack gap={5}>
|
||||||
{subpages.map((page) => (
|
{subpages.map((page) => (
|
||||||
|
|||||||
-61
@@ -1,61 +0,0 @@
|
|||||||
.header {
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
}
|
|
||||||
|
|
||||||
.emptyState {
|
|
||||||
}
|
|
||||||
|
|
||||||
.link {
|
|
||||||
outline: none;
|
|
||||||
cursor: pointer;
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
text-align: start;
|
|
||||||
word-wrap: break-word;
|
|
||||||
background-color: transparent;
|
|
||||||
color: var(--mantine-color-text);
|
|
||||||
font-size: var(--mantine-font-size-sm);
|
|
||||||
line-height: var(--mantine-line-height-sm);
|
|
||||||
padding: 6px;
|
|
||||||
border-top-right-radius: var(--mantine-radius-sm);
|
|
||||||
border-bottom-right-radius: var(--mantine-radius-sm);
|
|
||||||
border: none;
|
|
||||||
|
|
||||||
@mixin hover {
|
|
||||||
background-color: light-dark(
|
|
||||||
var(--mantine-color-gray-2),
|
|
||||||
var(--mantine-color-dark-6)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: $mantine-breakpoint-sm) {
|
|
||||||
& {
|
|
||||||
border: none !important;
|
|
||||||
padding-left: 0px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.linkActive {
|
|
||||||
font-weight: 500;
|
|
||||||
border-left-color: light-dark(
|
|
||||||
var(--mantine-color-grey-5),
|
|
||||||
var(--mantine-color-grey-3)
|
|
||||||
);
|
|
||||||
color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1));
|
|
||||||
|
|
||||||
&,
|
|
||||||
&:hover {
|
|
||||||
background-color: light-dark(
|
|
||||||
var(--mantine-color-gray-3),
|
|
||||||
var(--mantine-color-dark-5)
|
|
||||||
) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.leftBorder {
|
|
||||||
border-left: 1px solid
|
|
||||||
light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4));
|
|
||||||
}
|
|
||||||
-55
@@ -1,55 +0,0 @@
|
|||||||
import { Editor as CoreEditor } from "@tiptap/core";
|
|
||||||
import { TableOfContentsStorage } from "@tiptap/extension-table-of-contents";
|
|
||||||
import { NodeViewWrapper, useEditorState } from "@tiptap/react";
|
|
||||||
import { memo } from "react";
|
|
||||||
import { clsx } from "clsx";
|
|
||||||
import classes from "./table-of-contents-nodeview.module.css";
|
|
||||||
|
|
||||||
export type TableOfContentsProps = {
|
|
||||||
editor: CoreEditor;
|
|
||||||
onItemClick?: () => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const TableOfContentsNodeview = memo(
|
|
||||||
({ editor, onItemClick }: TableOfContentsProps) => {
|
|
||||||
const content = useEditorState({
|
|
||||||
editor,
|
|
||||||
selector: (ctx) =>
|
|
||||||
(ctx.editor.storage.tableOfContents as TableOfContentsStorage)?.content,
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<NodeViewWrapper>
|
|
||||||
<div contentEditable={false}>
|
|
||||||
<div className={classes.header}>Table of contents</div>
|
|
||||||
{content.length > 0 ? (
|
|
||||||
<div className={classes.container}>
|
|
||||||
{content
|
|
||||||
.filter((item) => item.level <= 3)
|
|
||||||
.map((item) => (
|
|
||||||
<a
|
|
||||||
key={item.id}
|
|
||||||
href={`#${item.id}`}
|
|
||||||
style={{ marginLeft: `${1 * item.level - 1}rem` }}
|
|
||||||
onClick={onItemClick}
|
|
||||||
className={clsx(
|
|
||||||
classes.link,
|
|
||||||
item.isActive && classes.linkActive,
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{item.itemIndex}. {item.textContent}
|
|
||||||
</a>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className={classes.emptyState}>
|
|
||||||
Start adding headlines to your document …
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</NodeViewWrapper>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
TableOfContentsNodeview.displayName = "TableOfContentsNodeview";
|
|
||||||
@@ -15,7 +15,7 @@ export default function VideoView(props: NodeViewProps) {
|
|||||||
}, [align]);
|
}, [align]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeViewWrapper>
|
<NodeViewWrapper data-drag-handle>
|
||||||
<video
|
<video
|
||||||
preload="metadata"
|
preload="metadata"
|
||||||
width={width}
|
width={width}
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
import { StarterKit } from "@tiptap/starter-kit";
|
import { StarterKit } from "@tiptap/starter-kit";
|
||||||
import { Placeholder } from "@tiptap/extension-placeholder";
|
import { Placeholder } from "@tiptap/extension-placeholder";
|
||||||
import { TextAlign } from "@tiptap/extension-text-align";
|
import { TextAlign } from "@tiptap/extension-text-align";
|
||||||
|
import { CharacterCount } from "@tiptap/extension-character-count";
|
||||||
import { TaskList } from "@tiptap/extension-task-list";
|
import { TaskList } from "@tiptap/extension-task-list";
|
||||||
|
import { ListKeymap } from "@tiptap/extension-list-keymap";
|
||||||
import { TaskItem } from "@tiptap/extension-task-item";
|
import { TaskItem } from "@tiptap/extension-task-item";
|
||||||
import { Underline } from "@tiptap/extension-underline";
|
import { Underline } from "@tiptap/extension-underline";
|
||||||
import { Superscript } from "@tiptap/extension-superscript";
|
import { Superscript } from "@tiptap/extension-superscript";
|
||||||
import SubScript from "@tiptap/extension-subscript";
|
import SubScript from "@tiptap/extension-subscript";
|
||||||
import { Highlight } from "@tiptap/extension-highlight";
|
|
||||||
import { Typography } from "@tiptap/extension-typography";
|
import { Typography } from "@tiptap/extension-typography";
|
||||||
import { TextStyle } from "@tiptap/extension-text-style";
|
import { TextStyle } from "@tiptap/extension-text-style";
|
||||||
import { Color } from "@tiptap/extension-color";
|
import { Color } from "@tiptap/extension-color";
|
||||||
|
import GlobalDragHandle from "tiptap-extension-global-drag-handle";
|
||||||
|
import { Youtube } from "@tiptap/extension-youtube";
|
||||||
import SlashCommand from "@/features/editor/extensions/slash-command";
|
import SlashCommand from "@/features/editor/extensions/slash-command";
|
||||||
import { TableOfContents as TiptapTableOfContents } from "@tiptap/extension-table-of-contents";
|
import { Collaboration, isChangeOrigin } from "@tiptap/extension-collaboration";
|
||||||
import { Collaboration } from "@tiptap/extension-collaboration";
|
|
||||||
import { CollaborationCursor } from "@tiptap/extension-collaboration-cursor";
|
import { CollaborationCursor } from "@tiptap/extension-collaboration-cursor";
|
||||||
import { HocuspocusProvider } from "@hocuspocus/provider";
|
import { HocuspocusProvider } from "@hocuspocus/provider";
|
||||||
import {
|
import {
|
||||||
@@ -41,7 +43,9 @@ import {
|
|||||||
Mention,
|
Mention,
|
||||||
Subpages,
|
Subpages,
|
||||||
TableDndExtension,
|
TableDndExtension,
|
||||||
TableOfContentsNode,
|
Heading,
|
||||||
|
Highlight,
|
||||||
|
UniqueID,
|
||||||
} from "@docmost/editor-ext";
|
} from "@docmost/editor-ext";
|
||||||
import {
|
import {
|
||||||
randomElement,
|
randomElement,
|
||||||
@@ -50,11 +54,8 @@ import {
|
|||||||
import { IUser } from "@/features/user/types/user.types.ts";
|
import { IUser } from "@/features/user/types/user.types.ts";
|
||||||
import MathInlineView from "@/features/editor/components/math/math-inline.tsx";
|
import MathInlineView from "@/features/editor/components/math/math-inline.tsx";
|
||||||
import MathBlockView from "@/features/editor/components/math/math-block.tsx";
|
import MathBlockView from "@/features/editor/components/math/math-block.tsx";
|
||||||
import GlobalDragHandle from "tiptap-extension-global-drag-handle";
|
|
||||||
import { Youtube } from "@tiptap/extension-youtube";
|
|
||||||
import ImageView from "@/features/editor/components/image/image-view.tsx";
|
import ImageView from "@/features/editor/components/image/image-view.tsx";
|
||||||
import CalloutView from "@/features/editor/components/callout/callout-view.tsx";
|
import CalloutView from "@/features/editor/components/callout/callout-view.tsx";
|
||||||
import { common, createLowlight } from "lowlight";
|
|
||||||
import VideoView from "@/features/editor/components/video/video-view.tsx";
|
import VideoView from "@/features/editor/components/video/video-view.tsx";
|
||||||
import AttachmentView from "@/features/editor/components/attachment/attachment-view.tsx";
|
import AttachmentView from "@/features/editor/components/attachment/attachment-view.tsx";
|
||||||
import CodeBlockView from "@/features/editor/components/code-block/code-block-view.tsx";
|
import CodeBlockView from "@/features/editor/components/code-block/code-block-view.tsx";
|
||||||
@@ -62,6 +63,7 @@ import DrawioView from "../components/drawio/drawio-view";
|
|||||||
import ExcalidrawView from "@/features/editor/components/excalidraw/excalidraw-view.tsx";
|
import ExcalidrawView from "@/features/editor/components/excalidraw/excalidraw-view.tsx";
|
||||||
import EmbedView from "@/features/editor/components/embed/embed-view.tsx";
|
import EmbedView from "@/features/editor/components/embed/embed-view.tsx";
|
||||||
import SubpagesView from "@/features/editor/components/subpages/subpages-view.tsx";
|
import SubpagesView from "@/features/editor/components/subpages/subpages-view.tsx";
|
||||||
|
import { common, createLowlight } from "lowlight";
|
||||||
import plaintext from "highlight.js/lib/languages/plaintext";
|
import plaintext from "highlight.js/lib/languages/plaintext";
|
||||||
import powershell from "highlight.js/lib/languages/powershell";
|
import powershell from "highlight.js/lib/languages/powershell";
|
||||||
import abap from "highlightjs-sap-abap";
|
import abap from "highlightjs-sap-abap";
|
||||||
@@ -78,9 +80,7 @@ import MentionView from "@/features/editor/components/mention/mention-view.tsx";
|
|||||||
import i18n from "@/i18n.ts";
|
import i18n from "@/i18n.ts";
|
||||||
import { MarkdownClipboard } from "@/features/editor/extensions/markdown-clipboard.ts";
|
import { MarkdownClipboard } from "@/features/editor/extensions/markdown-clipboard.ts";
|
||||||
import EmojiCommand from "./emoji-command";
|
import EmojiCommand from "./emoji-command";
|
||||||
import { CharacterCount } from "@tiptap/extension-character-count";
|
|
||||||
import { countWords } from "alfaaz";
|
import { countWords } from "alfaaz";
|
||||||
import { TableOfContentsNodeview } from "@/features/editor/components/table-of-contents/table-of-contents-nodeview.tsx";
|
|
||||||
|
|
||||||
const lowlight = createLowlight(common);
|
const lowlight = createLowlight(common);
|
||||||
lowlight.register("mermaid", plaintext);
|
lowlight.register("mermaid", plaintext);
|
||||||
@@ -96,6 +96,7 @@ lowlight.register("scala", scala);
|
|||||||
|
|
||||||
export const mainExtensions = [
|
export const mainExtensions = [
|
||||||
StarterKit.configure({
|
StarterKit.configure({
|
||||||
|
heading: false,
|
||||||
history: false,
|
history: false,
|
||||||
dropcursor: {
|
dropcursor: {
|
||||||
width: 3,
|
width: 3,
|
||||||
@@ -108,6 +109,11 @@ export const mainExtensions = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
Heading,
|
||||||
|
UniqueID.configure({
|
||||||
|
types: ["heading", "paragraph"],
|
||||||
|
filterTransaction: (transaction) => !isChangeOrigin(transaction),
|
||||||
|
}),
|
||||||
Placeholder.configure({
|
Placeholder.configure({
|
||||||
placeholder: ({ node }) => {
|
placeholder: ({ node }) => {
|
||||||
if (node.type.name === "heading") {
|
if (node.type.name === "heading") {
|
||||||
@@ -128,6 +134,7 @@ export const mainExtensions = [
|
|||||||
TaskItem.configure({
|
TaskItem.configure({
|
||||||
nested: true,
|
nested: true,
|
||||||
}),
|
}),
|
||||||
|
ListKeymap,
|
||||||
Underline,
|
Underline,
|
||||||
LinkExtension.configure({
|
LinkExtension.configure({
|
||||||
openOnClick: false,
|
openOnClick: false,
|
||||||
@@ -244,10 +251,6 @@ export const mainExtensions = [
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
}).configure(),
|
}).configure(),
|
||||||
TiptapTableOfContents,
|
|
||||||
TableOfContentsNode.configure({
|
|
||||||
view: TableOfContentsNodeview,
|
|
||||||
}),
|
|
||||||
] as any;
|
] as any;
|
||||||
|
|
||||||
type CollabExtensions = (provider: HocuspocusProvider, user: IUser) => any[];
|
type CollabExtensions = (provider: HocuspocusProvider, user: IUser) => any[];
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
import { Editor } from "@tiptap/react";
|
||||||
|
import { useCallback, useEffect, useState } from "react";
|
||||||
|
|
||||||
|
function waitForState(checkFn: () => boolean): Promise<void> {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
if (checkFn()) {
|
||||||
|
clearInterval(interval);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
}, 800);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useEditorScroll = ({
|
||||||
|
canScroll,
|
||||||
|
initialScrollTo,
|
||||||
|
}: {
|
||||||
|
canScroll: () => boolean;
|
||||||
|
initialScrollTo?: string;
|
||||||
|
}) => {
|
||||||
|
const [scrollTo, setScrollTo] = useState<string>(initialScrollTo || "");
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!initialScrollTo) {
|
||||||
|
setScrollTo(window.location.hash ? window.location.hash.slice(1) : "");
|
||||||
|
}
|
||||||
|
}, [initialScrollTo]);
|
||||||
|
|
||||||
|
const handleScrollTo = useCallback(async (editor: Editor, _scrollTo: string | null = null, tryCount: number = 0) => {
|
||||||
|
await waitForState(() => canScroll());
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
const MAX_TRY_COUNT = 10;
|
||||||
|
if (tryCount >= MAX_TRY_COUNT) {
|
||||||
|
resolve(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const targetId = _scrollTo || scrollTo;
|
||||||
|
if (!targetId) {
|
||||||
|
resolve(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dom = editor.view.dom.querySelector(`[id="${targetId}"]`);
|
||||||
|
if (dom) {
|
||||||
|
dom.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||||
|
resolve(true);
|
||||||
|
} else {
|
||||||
|
setTimeout(async () => {
|
||||||
|
resolve(await handleScrollTo(editor, targetId, tryCount + 1));
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, [scrollTo, canScroll]);
|
||||||
|
|
||||||
|
return { scrollTo, handleScrollTo };
|
||||||
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import "@/features/editor/styles/index.css";
|
import "@/features/editor/styles/index.css";
|
||||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { IndexeddbPersistence } from "y-indexeddb";
|
import { IndexeddbPersistence } from "y-indexeddb";
|
||||||
import * as Y from "yjs";
|
import * as Y from "yjs";
|
||||||
import {
|
import {
|
||||||
@@ -28,9 +28,12 @@ import { asideStateAtom } from "@/components/layouts/global/hooks/atoms/sidebar-
|
|||||||
import {
|
import {
|
||||||
activeCommentIdAtom,
|
activeCommentIdAtom,
|
||||||
showCommentPopupAtom,
|
showCommentPopupAtom,
|
||||||
|
showReadOnlyCommentPopupAtom,
|
||||||
} from "@/features/comment/atoms/comment-atom";
|
} from "@/features/comment/atoms/comment-atom";
|
||||||
import CommentDialog from "@/features/comment/components/comment-dialog";
|
import CommentDialog from "@/features/comment/components/comment-dialog";
|
||||||
import { EditorBubbleMenu } from "@/features/editor/components/bubble-menu/bubble-menu";
|
import { EditorBubbleMenu } from "@/features/editor/components/bubble-menu/bubble-menu";
|
||||||
|
import { ReadOnlyBubbleMenu } from "@/features/editor/components/bubble-menu/read-only-bubble-menu";
|
||||||
|
import ReadOnlyCommentDialog from "@/features/editor/components/bubble-menu/read-only-comment-dialog";
|
||||||
import TableCellMenu from "@/features/editor/components/table/table-cell-menu.tsx";
|
import TableCellMenu from "@/features/editor/components/table/table-cell-menu.tsx";
|
||||||
import TableMenu from "@/features/editor/components/table/table-menu.tsx";
|
import TableMenu from "@/features/editor/components/table/table-menu.tsx";
|
||||||
import ImageMenu from "@/features/editor/components/image/image-menu.tsx";
|
import ImageMenu from "@/features/editor/components/image/image-menu.tsx";
|
||||||
@@ -56,6 +59,7 @@ import { FIVE_MINUTES } from "@/lib/constants.ts";
|
|||||||
import { PageEditMode } from "@/features/user/types/user.types.ts";
|
import { PageEditMode } from "@/features/user/types/user.types.ts";
|
||||||
import { jwtDecode } from "jwt-decode";
|
import { jwtDecode } from "jwt-decode";
|
||||||
import { searchSpotlight } from "@/features/search/constants.ts";
|
import { searchSpotlight } from "@/features/search/constants.ts";
|
||||||
|
import { useEditorScroll } from "./hooks/use-editor-scroll";
|
||||||
|
|
||||||
interface PageEditorProps {
|
interface PageEditorProps {
|
||||||
pageId: string;
|
pageId: string;
|
||||||
@@ -68,12 +72,22 @@ export default function PageEditor({
|
|||||||
editable,
|
editable,
|
||||||
content,
|
content,
|
||||||
}: PageEditorProps) {
|
}: PageEditorProps) {
|
||||||
|
|
||||||
|
|
||||||
const collaborationURL = useCollaborationUrl();
|
const collaborationURL = useCollaborationUrl();
|
||||||
|
const isComponentMounted = useRef(false);
|
||||||
|
const editorCreated = useRef(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
isComponentMounted.current = true;
|
||||||
|
}, []);
|
||||||
|
|
||||||
const [currentUser] = useAtom(currentUserAtom);
|
const [currentUser] = useAtom(currentUserAtom);
|
||||||
const [, setEditor] = useAtom(pageEditorAtom);
|
const [, setEditor] = useAtom(pageEditorAtom);
|
||||||
const [, setAsideState] = useAtom(asideStateAtom);
|
const [, setAsideState] = useAtom(asideStateAtom);
|
||||||
const [, setActiveCommentId] = useAtom(activeCommentIdAtom);
|
const [, setActiveCommentId] = useAtom(activeCommentIdAtom);
|
||||||
const [showCommentPopup, setShowCommentPopup] = useAtom(showCommentPopupAtom);
|
const [showCommentPopup, setShowCommentPopup] = useAtom(showCommentPopupAtom);
|
||||||
|
const [showReadOnlyCommentPopup] = useAtom(showReadOnlyCommentPopupAtom);
|
||||||
const ydocRef = useRef<Y.Doc | null>(null);
|
const ydocRef = useRef<Y.Doc | null>(null);
|
||||||
if (!ydocRef.current) {
|
if (!ydocRef.current) {
|
||||||
ydocRef.current = new Y.Doc();
|
ydocRef.current = new Y.Doc();
|
||||||
@@ -95,6 +109,8 @@ export default function PageEditor({
|
|||||||
const userPageEditMode =
|
const userPageEditMode =
|
||||||
currentUser?.user?.settings?.preferences?.pageEditMode ?? PageEditMode.Edit;
|
currentUser?.user?.settings?.preferences?.pageEditMode ?? PageEditMode.Edit;
|
||||||
|
|
||||||
|
const canScroll = useCallback(() => isComponentMounted.current && editorCreated.current, [isComponentMounted, editorCreated]);
|
||||||
|
const { handleScrollTo } = useEditorScroll({ canScroll });
|
||||||
// Providers only created once per pageId
|
// Providers only created once per pageId
|
||||||
const providersRef = useRef<{
|
const providersRef = useRef<{
|
||||||
local: IndexeddbPersistence;
|
local: IndexeddbPersistence;
|
||||||
@@ -264,6 +280,8 @@ export default function PageEditor({
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
setEditor(editor);
|
setEditor(editor);
|
||||||
editor.storage.pageId = pageId;
|
editor.storage.pageId = pageId;
|
||||||
|
handleScrollTo(editor);
|
||||||
|
editorCreated.current = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUpdate({ editor }) {
|
onUpdate({ editor }) {
|
||||||
@@ -415,7 +433,13 @@ export default function PageEditor({
|
|||||||
<LinkMenu editor={editor} appendTo={menuContainerRef} />
|
<LinkMenu editor={editor} appendTo={menuContainerRef} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{editor && !editorIsEditable && (
|
||||||
|
<ReadOnlyBubbleMenu key="readonly-bubble" editor={editor} />
|
||||||
|
)}
|
||||||
{showCommentPopup && <CommentDialog editor={editor} pageId={pageId} />}
|
{showCommentPopup && <CommentDialog editor={editor} pageId={pageId} />}
|
||||||
|
{showReadOnlyCommentPopup && (
|
||||||
|
<ReadOnlyCommentDialog editor={editor} pageId={pageId} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
onClick={() => editor.commands.focus("end")}
|
onClick={() => editor.commands.focus("end")}
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import "@/features/editor/styles/index.css";
|
import "@/features/editor/styles/index.css";
|
||||||
import React, { useMemo } from "react";
|
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
||||||
import { EditorProvider } from "@tiptap/react";
|
import { EditorProvider } from "@tiptap/react";
|
||||||
import { mainExtensions } from "@/features/editor/extensions/extensions";
|
import { mainExtensions } from "@/features/editor/extensions/extensions";
|
||||||
import { Document } from "@tiptap/extension-document";
|
import { Document } from "@tiptap/extension-document";
|
||||||
import { Heading } from "@tiptap/extension-heading";
|
import { Heading, generateNodeId, UniqueID } from "@docmost/editor-ext";
|
||||||
import { Text } from "@tiptap/extension-text";
|
import { Text } from "@tiptap/extension-text";
|
||||||
import { Placeholder } from "@tiptap/extension-placeholder";
|
import { Placeholder } from "@tiptap/extension-placeholder";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { readOnlyEditorAtom } from "@/features/editor/atoms/editor-atoms.ts";
|
import { readOnlyEditorAtom } from "@/features/editor/atoms/editor-atoms.ts";
|
||||||
|
import { useEditorScroll } from "./hooks/use-editor-scroll";
|
||||||
|
|
||||||
interface PageEditorProps {
|
interface PageEditorProps {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -21,9 +22,34 @@ export default function ReadonlyPageEditor({
|
|||||||
pageId,
|
pageId,
|
||||||
}: PageEditorProps) {
|
}: PageEditorProps) {
|
||||||
const [, setReadOnlyEditor] = useAtom(readOnlyEditorAtom);
|
const [, setReadOnlyEditor] = useAtom(readOnlyEditorAtom);
|
||||||
|
const isComponentMounted = useRef(false);
|
||||||
|
const editorCreated = useRef(false);
|
||||||
|
|
||||||
|
const canScroll = useCallback(
|
||||||
|
() => isComponentMounted.current && editorCreated.current,
|
||||||
|
[isComponentMounted, editorCreated],
|
||||||
|
);
|
||||||
|
const initialScrollTo = window.location.hash
|
||||||
|
? window.location.hash.slice(1)
|
||||||
|
: "";
|
||||||
|
const { handleScrollTo } = useEditorScroll({ canScroll, initialScrollTo });
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
isComponentMounted.current = true;
|
||||||
|
}, []);
|
||||||
|
|
||||||
const extensions = useMemo(() => {
|
const extensions = useMemo(() => {
|
||||||
return [...mainExtensions];
|
const filteredExtensions = mainExtensions.filter(
|
||||||
|
(ext) => ext.name !== "uniqueID",
|
||||||
|
);
|
||||||
|
|
||||||
|
return [
|
||||||
|
...filteredExtensions,
|
||||||
|
UniqueID.configure({
|
||||||
|
types: ["heading", "paragraph"],
|
||||||
|
updateDocument: false,
|
||||||
|
}),
|
||||||
|
];
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const titleExtensions = [
|
const titleExtensions = [
|
||||||
@@ -59,6 +85,9 @@ export default function ReadonlyPageEditor({
|
|||||||
}
|
}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
setReadOnlyEditor(editor);
|
setReadOnlyEditor(editor);
|
||||||
|
|
||||||
|
handleScrollTo(editor);
|
||||||
|
editorCreated.current = true;
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
></EditorProvider>
|
></EditorProvider>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
);
|
);
|
||||||
color: light-dark(
|
color: light-dark(
|
||||||
var(--mantine-color-default-color),
|
var(--mantine-color-default-color),
|
||||||
var(--mantine-color-dark-0)
|
var(--mantine-color-white)
|
||||||
);
|
);
|
||||||
font-size: var(--mantine-font-size-md);
|
font-size: var(--mantine-font-size-md);
|
||||||
line-height: var(--mantine-line-height-xl);
|
line-height: var(--mantine-line-height-xl);
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
& > .react-renderer {
|
& > .react-renderer {
|
||||||
margin-top: var(--mantine-spacing-sm);
|
margin-top: var(--mantine-spacing-sm);
|
||||||
margin-bottom: var(--mantine-spacing-sm);
|
margin-bottom: var(--mantine-spacing-sm);
|
||||||
|
|
||||||
&:first-child {
|
&:first-child {
|
||||||
@@ -141,7 +141,7 @@
|
|||||||
|
|
||||||
.selection,
|
.selection,
|
||||||
*::selection {
|
*::selection {
|
||||||
background-color: Highlight;
|
background-color: light-dark(Highlight, var(--mantine-color-gray-7));
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-mark {
|
.comment-mark {
|
||||||
@@ -186,6 +186,39 @@
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.ProseMirror > h1,
|
||||||
|
.ProseMirror > h2,
|
||||||
|
.ProseMirror > h3,
|
||||||
|
.ProseMirror > h4,
|
||||||
|
.ProseMirror > h5,
|
||||||
|
.ProseMirror > h6 {
|
||||||
|
|
||||||
|
> .link-btn {
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
> .link-btn > .link-btn-content {
|
||||||
|
opacity: 0;
|
||||||
|
position: absolute;
|
||||||
|
left: 5px;
|
||||||
|
top: 0;
|
||||||
|
height: 100%;
|
||||||
|
transition: opacity 0.15s ease;
|
||||||
|
display: inline-flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover > .link-btn > .link-btn-content {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
scroll-margin-top: 80px; /* match your header height */
|
||||||
}
|
}
|
||||||
|
|
||||||
.ProseMirror-icon {
|
.ProseMirror-icon {
|
||||||
@@ -209,4 +242,3 @@
|
|||||||
.actionIconGroup {
|
.actionIconGroup {
|
||||||
background: var(--mantine-color-body);
|
background: var(--mantine-color-body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,177 @@
|
|||||||
|
/* Highlight colors with dark mode support */
|
||||||
|
|
||||||
|
.ProseMirror {
|
||||||
|
/* Blue */
|
||||||
|
mark[data-color="#98d8f2"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(224 242 254),
|
||||||
|
rgba(37, 99, 235, 0.35)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Green */
|
||||||
|
mark[data-color="#7edb6c"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(220 252 231),
|
||||||
|
rgba(0, 138, 0, 0.35)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Purple */
|
||||||
|
mark[data-color="#e0d6ed"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(243 232 255),
|
||||||
|
rgba(147, 51, 234, 0.35)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Red */
|
||||||
|
mark[data-color="#ffc6c2"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(255 228 230),
|
||||||
|
rgba(224, 0, 0, 0.35)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Yellow */
|
||||||
|
mark[data-color="#faf594"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(254 249 195),
|
||||||
|
rgba(234, 179, 8, 0.35)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Orange */
|
||||||
|
mark[data-color="#f5c8a9"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(251, 236, 221),
|
||||||
|
rgba(255, 165, 0, 0.45)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pink */
|
||||||
|
mark[data-color="#f5cfe0"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(252, 241, 246),
|
||||||
|
rgba(186, 64, 129, 0.35)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gray */
|
||||||
|
mark[data-color="#dfdfd7"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(238 238 235),
|
||||||
|
rgba(168, 162, 158, 0.35)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Brown */
|
||||||
|
mark[data-color="#d7c4b7"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(215 196 183),
|
||||||
|
rgba(146, 64, 14, 0.35)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Color selector trigger button styles */
|
||||||
|
.color-selector-trigger[data-text-color="#2563EB"] {
|
||||||
|
color: #2563EB !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-text-color="#008A00"] {
|
||||||
|
color: #008A00 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-text-color="#9333EA"] {
|
||||||
|
color: #9333EA !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-text-color="#E00000"] {
|
||||||
|
color: #E00000 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-text-color="#EAB308"] {
|
||||||
|
color: #EAB308 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-text-color="#FFA500"] {
|
||||||
|
color: #FFA500 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-text-color="#BA4081"] {
|
||||||
|
color: #BA4081 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-text-color="#A8A29E"] {
|
||||||
|
color: #A8A29E !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-text-color="#92400E"] {
|
||||||
|
color: #92400E !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Highlight background colors with light-dark support - solid colors for trigger button */
|
||||||
|
.color-selector-trigger[data-highlight-color="#98d8f2"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(224 242 254),
|
||||||
|
rgb(30 64 175)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-highlight-color="#7edb6c"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(220 252 231),
|
||||||
|
rgb(21 128 61)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-highlight-color="#e0d6ed"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(243 232 255),
|
||||||
|
rgb(107 33 168)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-highlight-color="#ffc6c2"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(255 228 230),
|
||||||
|
rgb(185 28 28)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-highlight-color="#faf594"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(254 249 195),
|
||||||
|
rgb(161 98 7)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-highlight-color="#f5c8a9"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(251 236 221),
|
||||||
|
rgb(194 65 12)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-highlight-color="#f5cfe0"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(252 241 246),
|
||||||
|
rgb(157 23 77)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-highlight-color="#dfdfd7"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(238 238 235),
|
||||||
|
rgb(115 115 115)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-selector-trigger[data-highlight-color="#d7c4b7"] {
|
||||||
|
background-color: light-dark(
|
||||||
|
rgb(215 196 183),
|
||||||
|
rgb(120 53 15)
|
||||||
|
) !important;
|
||||||
|
}
|
||||||
@@ -12,3 +12,4 @@
|
|||||||
@import "./find.css";
|
@import "./find.css";
|
||||||
@import "./mention.css";
|
@import "./mention.css";
|
||||||
@import "./ordered-list.css";
|
@import "./ordered-list.css";
|
||||||
|
@import "./highlight.css";
|
||||||
|
|||||||
@@ -104,7 +104,10 @@ export function TitleEditor({
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const pageSlug = buildPageUrl(spaceSlug, slugId, title);
|
const anchorId = window.location.hash
|
||||||
|
? window.location.hash.substring(1)
|
||||||
|
: undefined;
|
||||||
|
const pageSlug = buildPageUrl(spaceSlug, slugId, title, anchorId);
|
||||||
navigate(pageSlug, { replace: true });
|
navigate(pageSlug, { replace: true });
|
||||||
}, [title]);
|
}, [title]);
|
||||||
|
|
||||||
@@ -192,10 +195,43 @@ export function TitleEditor({
|
|||||||
const { key } = event;
|
const { key } = event;
|
||||||
const { $head } = titleEditor.state.selection;
|
const { $head } = titleEditor.state.selection;
|
||||||
|
|
||||||
|
if (key === "Enter") {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const { $from } = titleEditor.state.selection;
|
||||||
|
const titleText = titleEditor.getText();
|
||||||
|
|
||||||
|
// Get the text offset within the heading node (not document position)
|
||||||
|
const textOffset = $from.parentOffset;
|
||||||
|
|
||||||
|
const textAfterCursor = titleText.slice(textOffset);
|
||||||
|
|
||||||
|
// Delete text after cursor from title (this will be in undo history)
|
||||||
|
const endPos = titleEditor.state.doc.content.size;
|
||||||
|
if (textAfterCursor) {
|
||||||
|
titleEditor.commands.deleteRange({ from: $from.pos, to: endPos });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't add to history so undo in page editor won't remove this split
|
||||||
|
pageEditor
|
||||||
|
.chain()
|
||||||
|
.command(({ tr }) => {
|
||||||
|
tr.setMeta("addToHistory", false);
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.insertContentAt(0, {
|
||||||
|
type: "paragraph",
|
||||||
|
content: textAfterCursor
|
||||||
|
? [{ type: "text", text: textAfterCursor }]
|
||||||
|
: undefined,
|
||||||
|
})
|
||||||
|
.focus("start")
|
||||||
|
.run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const shouldFocusEditor =
|
const shouldFocusEditor =
|
||||||
key === "Enter" ||
|
key === "ArrowDown" || (key === "ArrowRight" && !$head.nodeAfter);
|
||||||
key === "ArrowDown" ||
|
|
||||||
(key === "ArrowRight" && !$head.nodeAfter);
|
|
||||||
|
|
||||||
if (shouldFocusEditor) {
|
if (shouldFocusEditor) {
|
||||||
pageEditor.commands.focus("start");
|
pageEditor.commands.focus("start");
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import api from "@/lib/api-client";
|
import api from "@/lib/api-client";
|
||||||
import { IFileTask } from "@/features/file-task/types/file-task.types.ts";
|
import { IFileTask } from "@/features/file-task/types/file-task.types.ts";
|
||||||
|
import { IPagination, QueryParams } from "@/lib/types.ts";
|
||||||
|
import { IApiKey } from "@/ee/api-key";
|
||||||
|
|
||||||
export async function getFileTaskById(fileTaskId: string): Promise<IFileTask> {
|
export async function getFileTaskById(fileTaskId: string): Promise<IFileTask> {
|
||||||
const req = await api.post<IFileTask>("/file-tasks/info", {
|
const req = await api.post<IFileTask>("/file-tasks/info", {
|
||||||
@@ -8,7 +10,10 @@ export async function getFileTaskById(fileTaskId: string): Promise<IFileTask> {
|
|||||||
return req.data;
|
return req.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getFileTasks(): Promise<IFileTask[]> {
|
export async function getFileTasks(
|
||||||
const req = await api.post<IFileTask[]>("/file-tasks");
|
params?: QueryParams,
|
||||||
|
): Promise<IPagination<IFileTask>> {
|
||||||
|
const req = await api.post("/file-tasks", { ...params });
|
||||||
return req.data;
|
return req.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { zodResolver } from 'mantine-form-zod-resolver';
|
import { zodResolver } from 'mantine-form-zod-resolver';
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
name: z.string().trim().min(2).max(50),
|
name: z.string().trim().min(2).max(100),
|
||||||
description: z.string().max(500),
|
description: z.string().max(500),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { zodResolver } from "mantine-form-zod-resolver";
|
import { zodResolver } from "mantine-form-zod-resolver";
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
name: z.string().min(2).max(50),
|
name: z.string().min(2).max(100),
|
||||||
description: z.string().max(500),
|
description: z.string().max(500),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export default function GroupList() {
|
|||||||
>
|
>
|
||||||
<Group gap="sm" wrap="nowrap">
|
<Group gap="sm" wrap="nowrap">
|
||||||
<IconGroupCircle />
|
<IconGroupCircle />
|
||||||
<div>
|
<div style={{ minWidth: 0, overflow: "hidden" }}>
|
||||||
<Text fz="sm" fw={500} lineClamp={1}>
|
<Text fz="sm" fw={500} lineClamp={1}>
|
||||||
{group.name}
|
{group.name}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@@ -15,22 +15,29 @@ export const buildPageUrl = (
|
|||||||
spaceName: string,
|
spaceName: string,
|
||||||
pageSlugId: string,
|
pageSlugId: string,
|
||||||
pageTitle?: string,
|
pageTitle?: string,
|
||||||
|
anchorId?: string,
|
||||||
): string => {
|
): string => {
|
||||||
|
let url: string;
|
||||||
if (spaceName === undefined) {
|
if (spaceName === undefined) {
|
||||||
return `/p/${buildPageSlug(pageSlugId, pageTitle)}`;
|
url = `/p/${buildPageSlug(pageSlugId, pageTitle)}`;
|
||||||
|
} else {
|
||||||
|
url = `/s/${spaceName}/p/${buildPageSlug(pageSlugId, pageTitle)}`;
|
||||||
}
|
}
|
||||||
return `/s/${spaceName}/p/${buildPageSlug(pageSlugId, pageTitle)}`;
|
return anchorId ? `${url}#${anchorId}` : url;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const buildSharedPageUrl = (opts: {
|
export const buildSharedPageUrl = (opts: {
|
||||||
shareId: string;
|
shareId: string;
|
||||||
pageSlugId: string;
|
pageSlugId: string;
|
||||||
pageTitle?: string;
|
pageTitle?: string;
|
||||||
|
anchorId?: string;
|
||||||
}): string => {
|
}): string => {
|
||||||
const { shareId, pageSlugId, pageTitle } = opts;
|
const { shareId, pageSlugId, pageTitle, anchorId } = opts;
|
||||||
|
let url: string;
|
||||||
if (!shareId) {
|
if (!shareId) {
|
||||||
return `/share/p/${buildPageSlug(pageSlugId, pageTitle)}`;
|
url = `/share/p/${buildPageSlug(pageSlugId, pageTitle)}`;
|
||||||
|
} else {
|
||||||
|
url = `/share/${shareId}/p/${buildPageSlug(pageSlugId, pageTitle)}`;
|
||||||
}
|
}
|
||||||
|
return anchorId ? `${url}#${anchorId}` : url;
|
||||||
return `/share/${shareId}/p/${buildPageSlug(pageSlugId, pageTitle)}`;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -269,12 +269,15 @@ function Node({ node, style, dragHandle, tree }: NodeRendererProps<any>) {
|
|||||||
const toggleMobileSidebar = useToggleSidebar(mobileSidebarAtom);
|
const toggleMobileSidebar = useToggleSidebar(mobileSidebarAtom);
|
||||||
|
|
||||||
const prefetchPage = () => {
|
const prefetchPage = () => {
|
||||||
timerRef.current = setTimeout(() => {
|
timerRef.current = setTimeout(async () => {
|
||||||
queryClient.prefetchQuery({
|
const page = await queryClient.fetchQuery({
|
||||||
queryKey: ["pages", node.data.slugId],
|
queryKey: ["pages", node.data.id],
|
||||||
queryFn: () => getPageById({ pageId: node.data.slugId }),
|
queryFn: () => getPageById({ pageId: node.data.id }),
|
||||||
staleTime: 5 * 60 * 1000,
|
staleTime: 5 * 60 * 1000,
|
||||||
});
|
});
|
||||||
|
if (page?.slugId) {
|
||||||
|
queryClient.setQueryData(["pages", page.slugId], page);
|
||||||
|
}
|
||||||
}, 150);
|
}, 150);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
ScrollArea,
|
ScrollArea,
|
||||||
Avatar,
|
Avatar,
|
||||||
Group,
|
Group,
|
||||||
|
Switch,
|
||||||
getDefaultZIndex,
|
getDefaultZIndex,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import {
|
import {
|
||||||
@@ -17,6 +18,7 @@ import {
|
|||||||
IconFileDescription,
|
IconFileDescription,
|
||||||
IconSearch,
|
IconSearch,
|
||||||
IconCheck,
|
IconCheck,
|
||||||
|
IconSparkles,
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useDebouncedValue } from "@mantine/hooks";
|
import { useDebouncedValue } from "@mantine/hooks";
|
||||||
@@ -24,15 +26,21 @@ import { useGetSpacesQuery } from "@/features/space/queries/space-query";
|
|||||||
import { useLicense } from "@/ee/hooks/use-license";
|
import { useLicense } from "@/ee/hooks/use-license";
|
||||||
import classes from "./search-spotlight-filters.module.css";
|
import classes from "./search-spotlight-filters.module.css";
|
||||||
import { isCloud } from "@/lib/config.ts";
|
import { isCloud } from "@/lib/config.ts";
|
||||||
|
import { useAtom } from "jotai/index";
|
||||||
|
import { workspaceAtom } from "@/features/user/atoms/current-user-atom.ts";
|
||||||
|
|
||||||
interface SearchSpotlightFiltersProps {
|
interface SearchSpotlightFiltersProps {
|
||||||
onFiltersChange?: (filters: any) => void;
|
onFiltersChange?: (filters: any) => void;
|
||||||
|
onAskClick?: () => void;
|
||||||
spaceId?: string;
|
spaceId?: string;
|
||||||
|
isAiMode?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SearchSpotlightFilters({
|
export function SearchSpotlightFilters({
|
||||||
onFiltersChange,
|
onFiltersChange,
|
||||||
|
onAskClick,
|
||||||
spaceId,
|
spaceId,
|
||||||
|
isAiMode = false,
|
||||||
}: SearchSpotlightFiltersProps) {
|
}: SearchSpotlightFiltersProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { hasLicenseKey } = useLicense();
|
const { hasLicenseKey } = useLicense();
|
||||||
@@ -42,6 +50,7 @@ export function SearchSpotlightFilters({
|
|||||||
const [spaceSearchQuery, setSpaceSearchQuery] = useState("");
|
const [spaceSearchQuery, setSpaceSearchQuery] = useState("");
|
||||||
const [debouncedSpaceQuery] = useDebouncedValue(spaceSearchQuery, 300);
|
const [debouncedSpaceQuery] = useDebouncedValue(spaceSearchQuery, 300);
|
||||||
const [contentType, setContentType] = useState<string | null>("page");
|
const [contentType, setContentType] = useState<string | null>("page");
|
||||||
|
const [workspace] = useAtom(workspaceAtom);
|
||||||
|
|
||||||
const { data: spacesData } = useGetSpacesQuery({
|
const { data: spacesData } = useGetSpacesQuery({
|
||||||
page: 1,
|
page: 1,
|
||||||
@@ -120,6 +129,31 @@ export function SearchSpotlightFilters({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.filtersContainer}>
|
<div className={classes.filtersContainer}>
|
||||||
|
{workspace?.settings?.ai?.search === true && (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
height: "32px",
|
||||||
|
paddingLeft: "8px",
|
||||||
|
paddingRight: "8px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Switch
|
||||||
|
checked={isAiMode}
|
||||||
|
onChange={(event) => onAskClick()}
|
||||||
|
label={t("Ask AI")}
|
||||||
|
size="sm"
|
||||||
|
color="blue"
|
||||||
|
labelPosition="left"
|
||||||
|
styles={{
|
||||||
|
root: { display: "flex", alignItems: "center" },
|
||||||
|
label: { paddingRight: "8px", fontSize: "13px", fontWeight: 500 },
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<Menu
|
<Menu
|
||||||
shadow="md"
|
shadow="md"
|
||||||
width={250}
|
width={250}
|
||||||
@@ -231,7 +265,7 @@ export function SearchSpotlightFilters({
|
|||||||
contentType !== option.value &&
|
contentType !== option.value &&
|
||||||
handleFilterChange("contentType", option.value)
|
handleFilterChange("contentType", option.value)
|
||||||
}
|
}
|
||||||
disabled={option.disabled}
|
disabled={option.disabled || (isAiMode && option.value === "attachment")}
|
||||||
>
|
>
|
||||||
<Group flex="1" gap="xs">
|
<Group flex="1" gap="xs">
|
||||||
<div>
|
<div>
|
||||||
@@ -241,6 +275,11 @@ export function SearchSpotlightFilters({
|
|||||||
{t("Enterprise")}
|
{t("Enterprise")}
|
||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
|
{!option.disabled && isAiMode && option.value === "attachment" && (
|
||||||
|
<Text size="xs" mt={4}>
|
||||||
|
{t("Ask AI not available for attachments")}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{contentType === option.value && <IconCheck size={20} />}
|
{contentType === option.value && <IconCheck size={20} />}
|
||||||
</Group>
|
</Group>
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
import { Spotlight } from "@mantine/spotlight";
|
import { Spotlight } from "@mantine/spotlight";
|
||||||
import { IconSearch } from "@tabler/icons-react";
|
import { IconSearch, IconSparkles } from "@tabler/icons-react";
|
||||||
import React, { useState, useMemo } from "react";
|
import { Group, Button } from "@mantine/core";
|
||||||
|
import React, { useState, useMemo, useEffect } from "react";
|
||||||
import { useDebouncedValue } from "@mantine/hooks";
|
import { useDebouncedValue } from "@mantine/hooks";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { notifications } from "@mantine/notifications";
|
||||||
import { searchSpotlightStore } from "../constants.ts";
|
import { searchSpotlightStore } from "../constants.ts";
|
||||||
import { SearchSpotlightFilters } from "./search-spotlight-filters.tsx";
|
import { SearchSpotlightFilters } from "./search-spotlight-filters.tsx";
|
||||||
import { useUnifiedSearch } from "../hooks/use-unified-search.ts";
|
import { useUnifiedSearch } from "../hooks/use-unified-search.ts";
|
||||||
|
import { useAiSearch } from "../../../ee/ai/hooks/use-ai-search.ts";
|
||||||
import { SearchResultItem } from "./search-result-item.tsx";
|
import { SearchResultItem } from "./search-result-item.tsx";
|
||||||
|
import { AiSearchResult } from "../../../ee/ai/components/ai-search-result.tsx";
|
||||||
import { useLicense } from "@/ee/hooks/use-license.tsx";
|
import { useLicense } from "@/ee/hooks/use-license.tsx";
|
||||||
import { isCloud } from "@/lib/config.ts";
|
import { isCloud } from "@/lib/config.ts";
|
||||||
|
|
||||||
@@ -24,6 +28,7 @@ export function SearchSpotlight({ spaceId }: SearchSpotlightProps) {
|
|||||||
}>({
|
}>({
|
||||||
contentType: "page",
|
contentType: "page",
|
||||||
});
|
});
|
||||||
|
const [isAiMode, setIsAiMode] = useState(false);
|
||||||
|
|
||||||
// Build unified search params
|
// Build unified search params
|
||||||
const searchParams = useMemo(() => {
|
const searchParams = useMemo(() => {
|
||||||
@@ -40,7 +45,42 @@ export function SearchSpotlight({ spaceId }: SearchSpotlightProps) {
|
|||||||
return params;
|
return params;
|
||||||
}, [debouncedSearchQuery, filters]);
|
}, [debouncedSearchQuery, filters]);
|
||||||
|
|
||||||
const { data: searchResults, isLoading } = useUnifiedSearch(searchParams);
|
const { data: searchResults, isLoading } = useUnifiedSearch(
|
||||||
|
searchParams,
|
||||||
|
!isAiMode // Disable regular search when in AI mode
|
||||||
|
);
|
||||||
|
const {
|
||||||
|
//@ts-ignore
|
||||||
|
data: aiSearchResult,
|
||||||
|
//@ts-ignore
|
||||||
|
isPending: isAiLoading,
|
||||||
|
//@ts-ignore
|
||||||
|
mutate: triggerAiSearchMutation,
|
||||||
|
//@ts-ignore
|
||||||
|
reset: resetAiMutation,
|
||||||
|
//@ts-ignore
|
||||||
|
error: aiSearchError,
|
||||||
|
streamingAnswer,
|
||||||
|
streamingSources,
|
||||||
|
clearStreaming,
|
||||||
|
} = useAiSearch();
|
||||||
|
|
||||||
|
// Clear streaming state and mutation data when query changes (user is typing a new query)
|
||||||
|
useEffect(() => {
|
||||||
|
clearStreaming();
|
||||||
|
resetAiMutation();
|
||||||
|
}, [query, clearStreaming, resetAiMutation]);
|
||||||
|
|
||||||
|
// Show error notification when AI search fails
|
||||||
|
useEffect(() => {
|
||||||
|
if (aiSearchError) {
|
||||||
|
notifications.show({
|
||||||
|
message: aiSearchError.message || t("AI search failed. Please try again."),
|
||||||
|
color: "red",
|
||||||
|
position: "top-center"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [aiSearchError, t]);
|
||||||
|
|
||||||
// Determine result type for rendering
|
// Determine result type for rendering
|
||||||
const isAttachmentSearch =
|
const isAttachmentSearch =
|
||||||
@@ -59,6 +99,16 @@ export function SearchSpotlight({ spaceId }: SearchSpotlightProps) {
|
|||||||
setFilters(newFilters);
|
setFilters(newFilters);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleAskClick = () => {
|
||||||
|
setIsAiMode(!isAiMode);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAiSearchTrigger = () => {
|
||||||
|
if (query.trim() && isAiMode) {
|
||||||
|
triggerAiSearchMutation(searchParams);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Spotlight.Root
|
<Spotlight.Root
|
||||||
@@ -72,10 +122,30 @@ export function SearchSpotlight({ spaceId }: SearchSpotlightProps) {
|
|||||||
backgroundOpacity: 0.55,
|
backgroundOpacity: 0.55,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Spotlight.Search
|
<Group gap="xs" px="sm" pt="sm" pb="xs">
|
||||||
placeholder={t("Search...")}
|
<Spotlight.Search
|
||||||
leftSection={<IconSearch size={20} stroke={1.5} />}
|
placeholder={isAiMode ? t("Ask a question...") : t("Search...")}
|
||||||
/>
|
leftSection={<IconSearch size={20} stroke={1.5} />}
|
||||||
|
style={{ flex: 1 }}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === "Enter" && isAiMode && query.trim() && !isAiLoading) {
|
||||||
|
e.preventDefault();
|
||||||
|
handleAiSearchTrigger();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{isAiMode && hasLicenseKey && (
|
||||||
|
<Button
|
||||||
|
size="xs"
|
||||||
|
leftSection={<IconSparkles size={16} />}
|
||||||
|
onClick={handleAiSearchTrigger}
|
||||||
|
disabled={!query.trim()}
|
||||||
|
loading={isAiLoading}
|
||||||
|
>
|
||||||
|
Ask
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</Group>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@@ -84,20 +154,43 @@ export function SearchSpotlight({ spaceId }: SearchSpotlightProps) {
|
|||||||
>
|
>
|
||||||
<SearchSpotlightFilters
|
<SearchSpotlightFilters
|
||||||
onFiltersChange={handleFiltersChange}
|
onFiltersChange={handleFiltersChange}
|
||||||
|
onAskClick={handleAskClick}
|
||||||
spaceId={spaceId}
|
spaceId={spaceId}
|
||||||
|
isAiMode={isAiMode}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Spotlight.ActionsList>
|
<Spotlight.ActionsList>
|
||||||
{query.length === 0 && resultItems.length === 0 && (
|
{isAiMode ? (
|
||||||
<Spotlight.Empty>{t("Start typing to search...")}</Spotlight.Empty>
|
<>
|
||||||
)}
|
{query.length === 0 && (
|
||||||
|
<Spotlight.Empty>{t("Ask a question...")}</Spotlight.Empty>
|
||||||
|
)}
|
||||||
|
{query.length > 0 && (isAiLoading || aiSearchResult || streamingAnswer) && (
|
||||||
|
<AiSearchResult
|
||||||
|
result={aiSearchResult}
|
||||||
|
isLoading={isAiLoading}
|
||||||
|
streamingAnswer={streamingAnswer}
|
||||||
|
streamingSources={streamingSources}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{query.length > 0 && !isAiLoading && !aiSearchResult && (
|
||||||
|
<Spotlight.Empty>{t("No answer available")}</Spotlight.Empty>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{query.length === 0 && resultItems.length === 0 && (
|
||||||
|
<Spotlight.Empty>{t("Start typing to search...")}</Spotlight.Empty>
|
||||||
|
)}
|
||||||
|
|
||||||
{query.length > 0 && !isLoading && resultItems.length === 0 && (
|
{query.length > 0 && !isLoading && resultItems.length === 0 && (
|
||||||
<Spotlight.Empty>{t("No results found...")}</Spotlight.Empty>
|
<Spotlight.Empty>{t("No results found...")}</Spotlight.Empty>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{resultItems.length > 0 && <>{resultItems}</>}
|
{resultItems.length > 0 && <>{resultItems}</>}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Spotlight.ActionsList>
|
</Spotlight.ActionsList>
|
||||||
</Spotlight.Root>
|
</Spotlight.Root>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export interface UseUnifiedSearchParams extends IPageSearchParams {
|
|||||||
|
|
||||||
export function useUnifiedSearch(
|
export function useUnifiedSearch(
|
||||||
params: UseUnifiedSearchParams,
|
params: UseUnifiedSearchParams,
|
||||||
|
enabled: boolean = true,
|
||||||
): UseQueryResult<UnifiedSearchResult[], Error> {
|
): UseQueryResult<UnifiedSearchResult[], Error> {
|
||||||
const { hasLicenseKey } = useLicense();
|
const { hasLicenseKey } = useLicense();
|
||||||
|
|
||||||
@@ -38,6 +39,6 @@ export function useUnifiedSearch(
|
|||||||
return await searchPage(backendParams);
|
return await searchPage(backendParams);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enabled: !!params.query,
|
enabled: !!params.query && enabled,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import {
|
|||||||
Switch,
|
Switch,
|
||||||
Text,
|
Text,
|
||||||
TextInput,
|
TextInput,
|
||||||
Tooltip,
|
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconExternalLink, IconWorld, IconLock } from "@tabler/icons-react";
|
import { IconExternalLink, IconWorld, IconLock } from "@tabler/icons-react";
|
||||||
import React, { useEffect, useMemo, useState } from "react";
|
import React, { useEffect, useMemo, useState } from "react";
|
||||||
@@ -21,12 +20,12 @@ import {
|
|||||||
import { Link, useNavigate, useParams } from "react-router-dom";
|
import { Link, useNavigate, useParams } from "react-router-dom";
|
||||||
import { extractPageSlugId, getPageIcon } from "@/lib";
|
import { extractPageSlugId, getPageIcon } from "@/lib";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { usePageQuery } from "@/features/page/queries/page-query.ts";
|
||||||
import CopyTextButton from "@/components/common/copy.tsx";
|
import CopyTextButton from "@/components/common/copy.tsx";
|
||||||
import { getAppUrl, isCloud } from "@/lib/config.ts";
|
import { getAppUrl, isCloud } from "@/lib/config.ts";
|
||||||
import { buildPageUrl } from "@/features/page/page.utils.ts";
|
import { buildPageUrl } from "@/features/page/page.utils.ts";
|
||||||
import classes from "@/features/share/components/share.module.css";
|
import classes from "@/features/share/components/share.module.css";
|
||||||
import useTrial from "@/ee/hooks/use-trial.tsx";
|
import useTrial from "@/ee/hooks/use-trial.tsx";
|
||||||
import { getCheckoutLink } from "@/ee/billing/services/billing-service.ts";
|
|
||||||
|
|
||||||
interface ShareModalProps {
|
interface ShareModalProps {
|
||||||
readOnly: boolean;
|
readOnly: boolean;
|
||||||
@@ -35,7 +34,9 @@ export default function ShareModal({ readOnly }: ShareModalProps) {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { pageSlug } = useParams();
|
const { pageSlug } = useParams();
|
||||||
const pageId = extractPageSlugId(pageSlug);
|
const pageSlugId = extractPageSlugId(pageSlug);
|
||||||
|
const { data: page } = usePageQuery({ pageId: pageSlugId });
|
||||||
|
const pageId = page?.id;
|
||||||
const { data: share } = useShareForPageQuery(pageId);
|
const { data: share } = useShareForPageQuery(pageId);
|
||||||
const { spaceSlug } = useParams();
|
const { spaceSlug } = useParams();
|
||||||
const { isTrial } = useTrial();
|
const { isTrial } = useTrial();
|
||||||
|
|||||||
@@ -27,9 +27,7 @@ import {
|
|||||||
getShares,
|
getShares,
|
||||||
updateShare,
|
updateShare,
|
||||||
} from "@/features/share/services/share-service.ts";
|
} from "@/features/share/services/share-service.ts";
|
||||||
import { IPage } from "@/features/page/types/page.types.ts";
|
|
||||||
import { IPagination, QueryParams } from "@/lib/types.ts";
|
import { IPagination, QueryParams } from "@/lib/types.ts";
|
||||||
import { useEffect } from "react";
|
|
||||||
|
|
||||||
export function useGetSharesQuery(
|
export function useGetSharesQuery(
|
||||||
params?: QueryParams,
|
params?: QueryParams,
|
||||||
@@ -72,7 +70,7 @@ export function useShareForPageQuery(
|
|||||||
queryKey: ["share-for-page", pageId],
|
queryKey: ["share-for-page", pageId],
|
||||||
queryFn: () => getShareForPage(pageId),
|
queryFn: () => getShareForPage(pageId),
|
||||||
enabled: !!pageId,
|
enabled: !!pageId,
|
||||||
staleTime: 0,
|
staleTime: 60 * 1000,
|
||||||
retry: false,
|
retry: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Group, Box, Button, TextInput, Stack, Textarea } from "@mantine/core";
|
import { Group, Box, Button, TextInput, Stack, Textarea } from "@mantine/core";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useForm, zodResolver } from "@mantine/form";
|
import { useForm } from "@mantine/form";
|
||||||
|
import { zodResolver } from "mantine-form-zod-resolver";
|
||||||
import * as z from "zod";
|
import * as z from "zod";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useCreateSpaceMutation } from "@/features/space/queries/space-query.ts";
|
import { useCreateSpaceMutation } from "@/features/space/queries/space-query.ts";
|
||||||
@@ -9,12 +10,12 @@ import { getSpaceUrl } from "@/lib/config.ts";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
name: z.string().trim().min(2).max(50),
|
name: z.string().trim().min(2).max(100),
|
||||||
slug: z
|
slug: z
|
||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
.min(2)
|
.min(2)
|
||||||
.max(50)
|
.max(100)
|
||||||
.regex(
|
.regex(
|
||||||
/^[a-zA-Z0-9]+$/,
|
/^[a-zA-Z0-9]+$/,
|
||||||
"Space slug must be alphanumeric. No special characters",
|
"Space slug must be alphanumeric. No special characters",
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import { ISpace } from "@/features/space/types/space.types.ts";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
name: z.string().min(2).max(50),
|
name: z.string().min(2).max(100),
|
||||||
description: z.string().max(250),
|
description: z.string().max(500),
|
||||||
slug: z
|
slug: z
|
||||||
.string()
|
.string()
|
||||||
.min(2)
|
.min(2)
|
||||||
.max(50)
|
.max(100)
|
||||||
.regex(
|
.regex(
|
||||||
/^[a-zA-Z0-9]+$/,
|
/^[a-zA-Z0-9]+$/,
|
||||||
"Space slug must be alphanumeric. No special characters",
|
"Space slug must be alphanumeric. No special characters",
|
||||||
|
|||||||
@@ -62,14 +62,17 @@ export default function SpaceSettingsModal({
|
|||||||
</Tabs.List>
|
</Tabs.List>
|
||||||
|
|
||||||
<Tabs.Panel value="general">
|
<Tabs.Panel value="general">
|
||||||
<ScrollArea h={550} scrollbarSize={4} pr={8}>
|
<ScrollArea h={580} scrollbarSize={5} pr={8}>
|
||||||
<SpaceDetails
|
<div style={{ paddingBottom: "100px"}}>
|
||||||
spaceId={space?.id}
|
<SpaceDetails
|
||||||
readOnly={spaceAbility.cannot(
|
spaceId={space?.id}
|
||||||
SpaceCaslAction.Manage,
|
readOnly={spaceAbility.cannot(
|
||||||
SpaceCaslSubject.Settings,
|
SpaceCaslAction.Manage,
|
||||||
)}
|
SpaceCaslSubject.Settings,
|
||||||
/>
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</Tabs.Panel>
|
</Tabs.Panel>
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export default function SpaceList() {
|
|||||||
variant="filled"
|
variant="filled"
|
||||||
name={space.name}
|
name={space.name}
|
||||||
/>
|
/>
|
||||||
<div>
|
<div style={{ minWidth: 0, overflow: "hidden" }}>
|
||||||
<Text fz="sm" fw={500} lineClamp={1}>
|
<Text fz="sm" fw={500} lineClamp={1}>
|
||||||
{space.name}
|
{space.name}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ export default function SpaceMembersList({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SearchInput onSearch={handleSearch} />
|
<SearchInput onSearch={handleSearch} />
|
||||||
<ScrollArea h={400}>
|
<ScrollArea h={450}>
|
||||||
<Table.ScrollContainer minWidth={500}>
|
<Table.ScrollContainer minWidth={500}>
|
||||||
<Table highlightOnHover verticalSpacing={8}>
|
<Table highlightOnHover verticalSpacing={8}>
|
||||||
<Table.Thead>
|
<Table.Thead>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export async function deleteWorkspaceMember(data: {
|
|||||||
await api.post("/workspace/members/delete", data);
|
await api.post("/workspace/members/delete", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateWorkspace(data: Partial<IWorkspace>) {
|
export async function updateWorkspace(data: Partial<IWorkspace> & { aiSearch?: boolean }) {
|
||||||
const req = await api.post<IWorkspace>("/workspace/update", data);
|
const req = await api.post<IWorkspace>("/workspace/update", data);
|
||||||
return req.data;
|
return req.data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export interface IWorkspace {
|
|||||||
defaultSpaceId: string;
|
defaultSpaceId: string;
|
||||||
customDomain: string;
|
customDomain: string;
|
||||||
enableInvite: boolean;
|
enableInvite: boolean;
|
||||||
settings: any;
|
settings: IWorkspaceSettings;
|
||||||
status: string;
|
status: string;
|
||||||
enforceSso: boolean;
|
enforceSso: boolean;
|
||||||
stripeCustomerId: string;
|
stripeCustomerId: string;
|
||||||
@@ -24,6 +24,14 @@ export interface IWorkspace {
|
|||||||
enforceMfa?: boolean;
|
enforceMfa?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IWorkspaceSettings {
|
||||||
|
ai?: IWorkspaceAiSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IWorkspaceAiSettings {
|
||||||
|
search?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ICreateInvite {
|
export interface ICreateInvite {
|
||||||
role: string;
|
role: string;
|
||||||
emails: string[];
|
emails: string[];
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const INTERNAL_LINK_REGEX =
|
export const INTERNAL_LINK_REGEX =
|
||||||
/^(https?:\/\/)?([^\/]+)?(\/s\/([^\/]+)\/)?p\/([a-zA-Z0-9-]+)\/?$/;
|
/^(https?:\/\/)?([^\/]+)?(\/s\/([^\/]+)\/)?p\/([a-zA-Z0-9-]+)\/?(?:#(.*))?$/;
|
||||||
|
|
||||||
export const FIVE_MINUTES = 5 * 60 * 1000;
|
export const FIVE_MINUTES = 5 * 60 * 1000;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ root.render(
|
|||||||
<MantineProvider theme={theme} cssVariablesResolver={mantineCssResolver}>
|
<MantineProvider theme={theme} cssVariablesResolver={mantineCssResolver}>
|
||||||
<ModalsProvider>
|
<ModalsProvider>
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<Notifications position="bottom-center" limit={3} />
|
<Notifications position="bottom-center" limit={3} zIndex={10000} />
|
||||||
<HelmetProvider>
|
<HelmetProvider>
|
||||||
<PostHogProvider client={posthog}>
|
<PostHogProvider client={posthog}>
|
||||||
<App />
|
<App />
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ const MemoizedHistoryModal = React.memo(HistoryModal);
|
|||||||
export default function Page() {
|
export default function Page() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { pageSlug } = useParams();
|
const { pageSlug } = useParams();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: page,
|
data: page,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
|||||||
+35
-28
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "server",
|
"name": "server",
|
||||||
"version": "0.23.2",
|
"version": "0.24.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "",
|
"author": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -30,69 +30,76 @@
|
|||||||
"test:e2e": "jest --config test/jest-e2e.json"
|
"test:e2e": "jest --config test/jest-e2e.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@ai-sdk/google": "^3.0.9",
|
||||||
|
"@ai-sdk/openai": "^3.0.11",
|
||||||
|
"@ai-sdk/openai-compatible": "^2.0.12",
|
||||||
"@aws-sdk/client-s3": "3.701.0",
|
"@aws-sdk/client-s3": "3.701.0",
|
||||||
"@aws-sdk/lib-storage": "3.701.0",
|
"@aws-sdk/lib-storage": "3.701.0",
|
||||||
"@aws-sdk/s3-request-presigner": "3.701.0",
|
"@aws-sdk/s3-request-presigner": "3.701.0",
|
||||||
"@casl/ability": "^6.7.3",
|
|
||||||
"@fastify/cookie": "^11.0.2",
|
"@fastify/cookie": "^11.0.2",
|
||||||
"@fastify/multipart": "^9.0.3",
|
"@fastify/multipart": "^9.3.0",
|
||||||
"@fastify/static": "^8.2.0",
|
"@fastify/static": "^8.3.0",
|
||||||
|
"@langchain/core": "1.1.13",
|
||||||
|
"@langchain/textsplitters": "1.0.1",
|
||||||
"@nestjs-labs/nestjs-ioredis": "^11.0.4",
|
"@nestjs-labs/nestjs-ioredis": "^11.0.4",
|
||||||
"@nestjs/bullmq": "^11.0.2",
|
"@nestjs/bullmq": "^11.0.4",
|
||||||
"@nestjs/common": "^11.1.3",
|
"@nestjs/common": "^11.1.11",
|
||||||
"@nestjs/config": "^4.0.2",
|
"@nestjs/config": "^4.0.2",
|
||||||
"@nestjs/core": "^11.1.3",
|
"@nestjs/core": "^11.1.11",
|
||||||
"@nestjs/event-emitter": "^3.0.1",
|
"@nestjs/event-emitter": "^3.0.1",
|
||||||
"@nestjs/jwt": "^11.0.0",
|
"@nestjs/jwt": "11.0.0",
|
||||||
"@nestjs/mapped-types": "^2.1.0",
|
"@nestjs/mapped-types": "^2.1.0",
|
||||||
"@nestjs/passport": "^11.0.5",
|
"@nestjs/passport": "^11.0.5",
|
||||||
"@nestjs/platform-fastify": "^11.1.3",
|
"@nestjs/platform-fastify": "^11.1.11",
|
||||||
"@nestjs/platform-socket.io": "^11.1.3",
|
"@nestjs/platform-socket.io": "^11.1.11",
|
||||||
"@nestjs/schedule": "^6.0.0",
|
"@nestjs/schedule": "^6.1.0",
|
||||||
"@nestjs/terminus": "^11.0.0",
|
"@nestjs/terminus": "^11.0.0",
|
||||||
"@nestjs/websockets": "^11.1.3",
|
"@nestjs/websockets": "^11.1.11",
|
||||||
"@node-saml/passport-saml": "^5.1.0",
|
"@node-saml/passport-saml": "^5.1.0",
|
||||||
"@react-email/components": "0.0.28",
|
"@react-email/components": "0.0.28",
|
||||||
"@react-email/render": "1.0.2",
|
"@react-email/render": "1.0.2",
|
||||||
"@socket.io/redis-adapter": "^8.3.0",
|
"@socket.io/redis-adapter": "^8.3.0",
|
||||||
"bcrypt": "^5.1.1",
|
"ai": "^6.0.37",
|
||||||
"bullmq": "^5.61.0",
|
"ai-sdk-ollama": "^3.1.1",
|
||||||
|
"bcrypt": "^6.0.0",
|
||||||
|
"bullmq": "^5.65.0",
|
||||||
"cache-manager": "^6.4.3",
|
"cache-manager": "^6.4.3",
|
||||||
"cheerio": "^1.1.0",
|
"cheerio": "^1.1.2",
|
||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
"class-validator": "^0.14.1",
|
"class-validator": "^0.14.3",
|
||||||
"cookie": "^1.0.2",
|
"cookie": "^1.1.1",
|
||||||
"fs-extra": "^11.3.0",
|
"fs-extra": "^11.3.3",
|
||||||
"happy-dom": "^18.0.1",
|
"happy-dom": "20.1.0",
|
||||||
"ioredis": "^5.4.1",
|
"ioredis": "^5.4.1",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.3",
|
||||||
"kysely": "^0.28.2",
|
"kysely": "^0.28.2",
|
||||||
"kysely-migration-cli": "^0.4.2",
|
"kysely-migration-cli": "^0.4.2",
|
||||||
"ldapts": "^7.4.0",
|
"ldapts": "^7.4.0",
|
||||||
"mammoth": "^1.10.0",
|
"mammoth": "^1.11.0",
|
||||||
"mime-types": "^2.1.35",
|
"mime-types": "^2.1.35",
|
||||||
"nanoid": "3.3.11",
|
"nanoid": "3.3.11",
|
||||||
"nestjs-kysely": "^1.2.0",
|
"nestjs-kysely": "^1.2.0",
|
||||||
"nodemailer": "^7.0.3",
|
"nodemailer": "^7.0.12",
|
||||||
"openid-client": "^5.7.1",
|
"openid-client": "^5.7.1",
|
||||||
"otpauth": "^9.4.0",
|
"otpauth": "^9.4.1",
|
||||||
"p-limit": "^6.2.0",
|
"p-limit": "^6.2.0",
|
||||||
"passport-google-oauth20": "^2.0.0",
|
"passport-google-oauth20": "^2.0.0",
|
||||||
"passport-jwt": "^4.0.1",
|
"passport-jwt": "^4.0.1",
|
||||||
"pdfjs-dist": "^5.4.54",
|
"pdfjs-dist": "^5.4.394",
|
||||||
"pg": "^8.16.0",
|
"pg": "^8.16.3",
|
||||||
"pg-tsquery": "^8.4.2",
|
"pg-tsquery": "^8.4.2",
|
||||||
|
"pgvector": "^0.2.1",
|
||||||
"postmark": "^4.0.5",
|
"postmark": "^4.0.5",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"reflect-metadata": "^0.2.2",
|
"reflect-metadata": "^0.2.2",
|
||||||
"rxjs": "^7.8.2",
|
"rxjs": "^7.8.2",
|
||||||
"sanitize-filename-ts": "1.0.2",
|
"sanitize-filename-ts": "1.0.2",
|
||||||
"sharp": "0.34.3",
|
"sharp": "0.34.3",
|
||||||
"socket.io": "^4.8.1",
|
"socket.io": "^4.8.3",
|
||||||
"stripe": "^17.5.0",
|
"stripe": "^17.5.0",
|
||||||
"tmp-promise": "^3.0.3",
|
"tmp-promise": "^3.0.3",
|
||||||
"typesense": "^2.1.0",
|
"typesense": "^2.1.0",
|
||||||
"ws": "^8.18.2",
|
"ws": "^8.19.0",
|
||||||
"yauzl": "^3.2.0"
|
"yauzl": "^3.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -117,7 +124,7 @@
|
|||||||
"eslint-config-prettier": "^10.0.1",
|
"eslint-config-prettier": "^10.0.1",
|
||||||
"globals": "^15.15.0",
|
"globals": "^15.15.0",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"kysely-codegen": "^0.17.0",
|
"kysely-codegen": "^0.19.0",
|
||||||
"prettier": "^3.5.1",
|
"prettier": "^3.5.1",
|
||||||
"react-email": "3.0.2",
|
"react-email": "3.0.2",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
|
|||||||
@@ -67,4 +67,8 @@ export class CollaborationGateway {
|
|||||||
async destroy(): Promise<void> {
|
async destroy(): Promise<void> {
|
||||||
await this.hocuspocus.destroy();
|
await this.hocuspocus.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async openDirectConnection(documentName: string) {
|
||||||
|
return this.hocuspocus.openDirectConnection(documentName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
import { StarterKit } from '@tiptap/starter-kit';
|
import { StarterKit } from '@tiptap/starter-kit';
|
||||||
|
import {
|
||||||
|
initProseMirrorDoc,
|
||||||
|
relativePositionToAbsolutePosition,
|
||||||
|
} from 'y-prosemirror';
|
||||||
|
import * as Y from 'yjs';
|
||||||
|
import { Document } from '@hocuspocus/server';
|
||||||
import { TextAlign } from '@tiptap/extension-text-align';
|
import { TextAlign } from '@tiptap/extension-text-align';
|
||||||
import { TaskList } from '@tiptap/extension-task-list';
|
import { TaskList } from '@tiptap/extension-task-list';
|
||||||
import { TaskItem } from '@tiptap/extension-task-item';
|
import { TaskItem } from '@tiptap/extension-task-item';
|
||||||
import { Underline } from '@tiptap/extension-underline';
|
import { Underline } from '@tiptap/extension-underline';
|
||||||
import { Superscript } from '@tiptap/extension-superscript';
|
import { Superscript } from '@tiptap/extension-superscript';
|
||||||
import SubScript from '@tiptap/extension-subscript';
|
import SubScript from '@tiptap/extension-subscript';
|
||||||
import { Highlight } from '@tiptap/extension-highlight';
|
|
||||||
import { Typography } from '@tiptap/extension-typography';
|
import { Typography } from '@tiptap/extension-typography';
|
||||||
import { TextStyle } from '@tiptap/extension-text-style';
|
import { TextStyle } from '@tiptap/extension-text-style';
|
||||||
import { Color } from '@tiptap/extension-color';
|
import { Color } from '@tiptap/extension-color';
|
||||||
import { Youtube } from '@tiptap/extension-youtube';
|
import { Youtube } from '@tiptap/extension-youtube';
|
||||||
import {
|
import {
|
||||||
|
Heading,
|
||||||
Callout,
|
Callout,
|
||||||
Comment,
|
Comment,
|
||||||
CustomCodeBlock,
|
CustomCodeBlock,
|
||||||
@@ -33,7 +39,9 @@ import {
|
|||||||
Embed,
|
Embed,
|
||||||
Mention,
|
Mention,
|
||||||
Subpages,
|
Subpages,
|
||||||
TableOfContentsNode,
|
Highlight,
|
||||||
|
UniqueID,
|
||||||
|
addUniqueIdsToDoc,
|
||||||
} from '@docmost/editor-ext';
|
} from '@docmost/editor-ext';
|
||||||
import { generateText, getSchema, JSONContent } from '@tiptap/core';
|
import { generateText, getSchema, JSONContent } from '@tiptap/core';
|
||||||
import { generateHTML, generateJSON } from '../common/helpers/prosemirror/html';
|
import { generateHTML, generateJSON } from '../common/helpers/prosemirror/html';
|
||||||
@@ -45,6 +53,11 @@ import { Node } from '@tiptap/pm/model';
|
|||||||
export const tiptapExtensions = [
|
export const tiptapExtensions = [
|
||||||
StarterKit.configure({
|
StarterKit.configure({
|
||||||
codeBlock: false,
|
codeBlock: false,
|
||||||
|
heading: false,
|
||||||
|
}),
|
||||||
|
Heading,
|
||||||
|
UniqueID.configure({
|
||||||
|
types: ['heading', 'paragraph'],
|
||||||
}),
|
}),
|
||||||
Comment,
|
Comment,
|
||||||
TextAlign.configure({ types: ['heading', 'paragraph'] }),
|
TextAlign.configure({ types: ['heading', 'paragraph'] }),
|
||||||
@@ -81,7 +94,6 @@ export const tiptapExtensions = [
|
|||||||
Embed,
|
Embed,
|
||||||
Mention,
|
Mention,
|
||||||
Subpages,
|
Subpages,
|
||||||
TableOfContentsNode,
|
|
||||||
] as any;
|
] as any;
|
||||||
|
|
||||||
export function jsonToHtml(tiptapJson: any) {
|
export function jsonToHtml(tiptapJson: any) {
|
||||||
@@ -89,7 +101,14 @@ export function jsonToHtml(tiptapJson: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function htmlToJson(html: string) {
|
export function htmlToJson(html: string) {
|
||||||
return generateJSON(html, tiptapExtensions);
|
const pmJson = generateJSON(html, tiptapExtensions);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return addUniqueIdsToDoc(pmJson, tiptapExtensions);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('failed to add unique ids to doc', error);
|
||||||
|
return pmJson;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function jsonToText(tiptapJson: JSONContent) {
|
export function jsonToText(tiptapJson: JSONContent) {
|
||||||
@@ -103,3 +122,169 @@ export function jsonToNode(tiptapJson: JSONContent) {
|
|||||||
export function getPageId(documentName: string) {
|
export function getPageId(documentName: string) {
|
||||||
return documentName.split('.')[1];
|
return documentName.split('.')[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type YjsSelection = {
|
||||||
|
anchor: any;
|
||||||
|
head: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function setYjsMark(
|
||||||
|
doc: Document,
|
||||||
|
fragment: Y.XmlFragment,
|
||||||
|
yjsSelection: YjsSelection,
|
||||||
|
markName: string,
|
||||||
|
markAttributes: Record<string, any>,
|
||||||
|
) {
|
||||||
|
const schema = getSchema(tiptapExtensions);
|
||||||
|
const { mapping } = initProseMirrorDoc(fragment, schema);
|
||||||
|
|
||||||
|
// Convert JSON positions to Y.js RelativePosition objects
|
||||||
|
const anchorRelPos = Y.createRelativePositionFromJSON(yjsSelection.anchor);
|
||||||
|
const headRelPos = Y.createRelativePositionFromJSON(yjsSelection.head);
|
||||||
|
|
||||||
|
const anchor = relativePositionToAbsolutePosition(
|
||||||
|
doc,
|
||||||
|
fragment,
|
||||||
|
anchorRelPos,
|
||||||
|
mapping,
|
||||||
|
);
|
||||||
|
const head = relativePositionToAbsolutePosition(
|
||||||
|
doc,
|
||||||
|
fragment,
|
||||||
|
headRelPos,
|
||||||
|
mapping,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (anchor === null || head === null) {
|
||||||
|
throw new Error(
|
||||||
|
'Could not resolve Y.js relative positions to absolute positions',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const from = Math.min(anchor, head);
|
||||||
|
const to = Math.max(anchor, head);
|
||||||
|
|
||||||
|
// Apply mark directly to Y.js XmlText nodes
|
||||||
|
// This bypasses updateYFragment which has compatibility issues
|
||||||
|
applyMarkToYFragment(fragment, from, to, markName, markAttributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyMarkToYFragment(
|
||||||
|
fragment: Y.XmlFragment,
|
||||||
|
from: number,
|
||||||
|
to: number,
|
||||||
|
markName: string,
|
||||||
|
markAttributes: Record<string, any>,
|
||||||
|
) {
|
||||||
|
let pos = 0;
|
||||||
|
|
||||||
|
const processItem = (item: any): boolean => {
|
||||||
|
if (pos >= to) return false;
|
||||||
|
|
||||||
|
if (item instanceof Y.XmlText) {
|
||||||
|
const textLength = item.length;
|
||||||
|
const itemEnd = pos + textLength;
|
||||||
|
|
||||||
|
if (itemEnd > from && pos < to) {
|
||||||
|
const formatFrom = Math.max(0, from - pos);
|
||||||
|
const formatTo = Math.min(textLength, to - pos);
|
||||||
|
const formatLength = formatTo - formatFrom;
|
||||||
|
|
||||||
|
if (formatLength > 0) {
|
||||||
|
item.format(formatFrom, formatLength, { [markName]: markAttributes });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pos = itemEnd;
|
||||||
|
} else if (item instanceof Y.XmlElement) {
|
||||||
|
pos++; // Opening tag
|
||||||
|
for (let i = 0; i < item.length; i++) {
|
||||||
|
if (!processItem(item.get(i))) return false;
|
||||||
|
}
|
||||||
|
pos++; // Closing tag
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
for (let i = 0; i < fragment.length; i++) {
|
||||||
|
if (!processItem(fragment.get(i))) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a mark from all text in the fragment that has the specified attribute value.
|
||||||
|
* Useful for deleting comments by commentId.
|
||||||
|
*/
|
||||||
|
export function removeYjsMarkByAttribute(
|
||||||
|
fragment: Y.XmlFragment,
|
||||||
|
markName: string,
|
||||||
|
attributeName: string,
|
||||||
|
attributeValue: string,
|
||||||
|
) {
|
||||||
|
const processItem = (item: any) => {
|
||||||
|
if (item instanceof Y.XmlText) {
|
||||||
|
// Get all formatting deltas to find ranges with this mark
|
||||||
|
const deltas = item.toDelta();
|
||||||
|
let offset = 0;
|
||||||
|
|
||||||
|
for (const delta of deltas) {
|
||||||
|
const length = delta.insert?.length ?? 0;
|
||||||
|
const attributes = delta.attributes ?? {};
|
||||||
|
const markAttr = attributes[markName];
|
||||||
|
|
||||||
|
if (markAttr && markAttr[attributeName] === attributeValue) {
|
||||||
|
// Remove the mark by setting it to null
|
||||||
|
item.format(offset, length, { [markName]: null });
|
||||||
|
}
|
||||||
|
offset += length;
|
||||||
|
}
|
||||||
|
} else if (item instanceof Y.XmlElement) {
|
||||||
|
for (let i = 0; i < item.length; i++) {
|
||||||
|
processItem(item.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (let i = 0; i < fragment.length; i++) {
|
||||||
|
processItem(fragment.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a mark's attributes for all text that has the specified attribute value.
|
||||||
|
* Useful for resolving/unresolving comments by commentId.
|
||||||
|
*/
|
||||||
|
export function updateYjsMarkAttribute(
|
||||||
|
fragment: Y.XmlFragment,
|
||||||
|
markName: string,
|
||||||
|
findByAttribute: { name: string; value: string },
|
||||||
|
newAttributes: Record<string, any>,
|
||||||
|
) {
|
||||||
|
const processItem = (item: any) => {
|
||||||
|
if (item instanceof Y.XmlText) {
|
||||||
|
const deltas = item.toDelta();
|
||||||
|
let offset = 0;
|
||||||
|
|
||||||
|
for (const delta of deltas) {
|
||||||
|
const length = delta.insert?.length ?? 0;
|
||||||
|
const attributes = delta.attributes ?? {};
|
||||||
|
const markAttr = attributes[markName];
|
||||||
|
|
||||||
|
if (markAttr && markAttr[findByAttribute.name] === findByAttribute.value) {
|
||||||
|
// Update the mark with new attributes (merge with existing)
|
||||||
|
item.format(offset, length, {
|
||||||
|
[markName]: { ...markAttr, ...newAttributes },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
offset += length;
|
||||||
|
}
|
||||||
|
} else if (item instanceof Y.XmlElement) {
|
||||||
|
for (let i = 0; i < item.length; i++) {
|
||||||
|
processItem(item.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (let i = 0; i < fragment.length; i++) {
|
||||||
|
processItem(fragment.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export class PersistenceExtension implements Extension {
|
|||||||
@InjectKysely() private readonly db: KyselyDB,
|
@InjectKysely() private readonly db: KyselyDB,
|
||||||
private eventEmitter: EventEmitter2,
|
private eventEmitter: EventEmitter2,
|
||||||
@InjectQueue(QueueName.GENERAL_QUEUE) private generalQueue: Queue,
|
@InjectQueue(QueueName.GENERAL_QUEUE) private generalQueue: Queue,
|
||||||
|
@InjectQueue(QueueName.AI_QUEUE) private aiQueue: Queue,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async onLoadDocument(data: onLoadDocumentPayload) {
|
async onLoadDocument(data: onLoadDocumentPayload) {
|
||||||
@@ -138,7 +139,7 @@ export class PersistenceExtension implements Extension {
|
|||||||
content: tiptapJson,
|
content: tiptapJson,
|
||||||
textContent: textContent,
|
textContent: textContent,
|
||||||
ydoc: ydocState,
|
ydoc: ydocState,
|
||||||
lastUpdatedById: context.user.id,
|
lastUpdatedById: context?.user?.id,
|
||||||
contributorIds: contributorIds,
|
contributorIds: contributorIds,
|
||||||
},
|
},
|
||||||
pageId,
|
pageId,
|
||||||
@@ -156,7 +157,7 @@ export class PersistenceExtension implements Extension {
|
|||||||
page: {
|
page: {
|
||||||
...page,
|
...page,
|
||||||
content: tiptapJson,
|
content: tiptapJson,
|
||||||
lastUpdatedById: context.user.id,
|
lastUpdatedById: context?.user?.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -168,12 +169,17 @@ export class PersistenceExtension implements Extension {
|
|||||||
workspaceId: page.workspaceId,
|
workspaceId: page.workspaceId,
|
||||||
mentions: pageMentions,
|
mentions: pageMentions,
|
||||||
} as IPageBacklinkJob);
|
} as IPageBacklinkJob);
|
||||||
|
|
||||||
|
await this.aiQueue.add(QueueJob.PAGE_CONTENT_UPDATED, {
|
||||||
|
pageIds: [pageId],
|
||||||
|
workspaceId: page.workspaceId,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async onChange(data: onChangePayload) {
|
async onChange(data: onChangePayload) {
|
||||||
const documentName = data.documentName;
|
const documentName = data.documentName;
|
||||||
const userId = data.context?.user.id;
|
const userId = data.context?.user?.id;
|
||||||
if (!userId) return;
|
if (!userId) return;
|
||||||
|
|
||||||
if (!this.contributors.has(documentName)) {
|
if (!this.contributors.has(documentName)) {
|
||||||
|
|||||||
@@ -2,7 +2,17 @@ export enum EventName {
|
|||||||
COLLAB_PAGE_UPDATED = 'collab.page.updated',
|
COLLAB_PAGE_UPDATED = 'collab.page.updated',
|
||||||
PAGE_CREATED = 'page.created',
|
PAGE_CREATED = 'page.created',
|
||||||
PAGE_UPDATED = 'page.updated',
|
PAGE_UPDATED = 'page.updated',
|
||||||
|
PAGE_CONTENT_UPDATED = 'page-content-updated',
|
||||||
|
PAGE_MOVED_TO_SPACE = 'page-moved-to-space',
|
||||||
PAGE_DELETED = 'page.deleted',
|
PAGE_DELETED = 'page.deleted',
|
||||||
PAGE_SOFT_DELETED = 'page.soft_deleted',
|
PAGE_SOFT_DELETED = 'page.soft_deleted',
|
||||||
PAGE_RESTORED = 'page.restored',
|
PAGE_RESTORED = 'page.restored',
|
||||||
|
|
||||||
|
SPACE_CREATED = 'space.created',
|
||||||
|
SPACE_UPDATED = 'space.updated',
|
||||||
|
SPACE_DELETED = 'space.deleted',
|
||||||
|
|
||||||
|
WORKSPACE_CREATED = 'workspace.created',
|
||||||
|
WORKSPACE_UPDATED = 'workspace.updated',
|
||||||
|
WORKSPACE_DELETED = 'workspace.deleted',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { CommentService } from './comment.service';
|
import { CommentService } from './comment.service';
|
||||||
import { CreateCommentDto } from './dto/create-comment.dto';
|
import { CreateCommentDto } from './dto/create-comment.dto';
|
||||||
|
import { CreateReadOnlyCommentDto } from './dto/create-readonly-comment.dto';
|
||||||
import { UpdateCommentDto } from './dto/update-comment.dto';
|
import { UpdateCommentDto } from './dto/update-comment.dto';
|
||||||
import { PageIdDto, CommentIdDto } from './dto/comments.input';
|
import { PageIdDto, CommentIdDto } from './dto/comments.input';
|
||||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||||
@@ -62,6 +63,28 @@ export class CommentController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HttpCode(HttpStatus.OK)
|
||||||
|
@Post('create-readonly')
|
||||||
|
async createReadOnly(
|
||||||
|
@Body() createCommentDto: CreateReadOnlyCommentDto,
|
||||||
|
@AuthUser() user: User,
|
||||||
|
@AuthWorkspace() workspace: Workspace,
|
||||||
|
) {
|
||||||
|
const page = await this.pageRepo.findById(createCommentDto.pageId);
|
||||||
|
if (!page || page.deletedAt) {
|
||||||
|
throw new NotFoundException('Page not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.commentService.createReadOnlyComment(
|
||||||
|
{
|
||||||
|
userId: user.id,
|
||||||
|
page,
|
||||||
|
workspaceId: workspace.id,
|
||||||
|
},
|
||||||
|
createCommentDto,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@HttpCode(HttpStatus.OK)
|
@HttpCode(HttpStatus.OK)
|
||||||
@Post('/')
|
@Post('/')
|
||||||
async findPageComments(
|
async findPageComments(
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { CommentService } from './comment.service';
|
import { CommentService } from './comment.service';
|
||||||
import { CommentController } from './comment.controller';
|
import { CommentController } from './comment.controller';
|
||||||
|
import { CollaborationModule } from '../../collaboration/collaboration.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [],
|
imports: [CollaborationModule],
|
||||||
controllers: [CommentController],
|
controllers: [CommentController],
|
||||||
providers: [CommentService],
|
providers: [CommentService],
|
||||||
exports: [CommentService],
|
exports: [CommentService],
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ import {
|
|||||||
BadRequestException,
|
BadRequestException,
|
||||||
ForbiddenException,
|
ForbiddenException,
|
||||||
Injectable,
|
Injectable,
|
||||||
|
Logger,
|
||||||
NotFoundException,
|
NotFoundException,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { CreateCommentDto } from './dto/create-comment.dto';
|
import { CreateCommentDto } from './dto/create-comment.dto';
|
||||||
|
import { CreateReadOnlyCommentDto } from './dto/create-readonly-comment.dto';
|
||||||
import { UpdateCommentDto } from './dto/update-comment.dto';
|
import { UpdateCommentDto } from './dto/update-comment.dto';
|
||||||
import { CommentRepo } from '@docmost/db/repos/comment/comment.repo';
|
import { CommentRepo } from '@docmost/db/repos/comment/comment.repo';
|
||||||
import { Comment, Page, User } from '@docmost/db/types/entity.types';
|
import { Comment, Page, User } from '@docmost/db/types/entity.types';
|
||||||
@@ -12,13 +14,19 @@ import { PaginationOptions } from '@docmost/db/pagination/pagination-options';
|
|||||||
import { PaginationResult } from '@docmost/db/pagination/pagination';
|
import { PaginationResult } from '@docmost/db/pagination/pagination';
|
||||||
import { PageRepo } from '@docmost/db/repos/page/page.repo';
|
import { PageRepo } from '@docmost/db/repos/page/page.repo';
|
||||||
import { SpaceMemberRepo } from '@docmost/db/repos/space/space-member.repo';
|
import { SpaceMemberRepo } from '@docmost/db/repos/space/space-member.repo';
|
||||||
|
import { CollaborationGateway } from '../../collaboration/collaboration.gateway';
|
||||||
|
import { setYjsMark } from '../../collaboration/collaboration.util';
|
||||||
|
import * as Y from 'yjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CommentService {
|
export class CommentService {
|
||||||
|
private readonly logger = new Logger(CommentService.name);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private commentRepo: CommentRepo,
|
private commentRepo: CommentRepo,
|
||||||
private pageRepo: PageRepo,
|
private pageRepo: PageRepo,
|
||||||
private spaceMemberRepo: SpaceMemberRepo,
|
private spaceMemberRepo: SpaceMemberRepo,
|
||||||
|
private collaborationGateway: CollaborationGateway,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async findById(commentId: string) {
|
async findById(commentId: string) {
|
||||||
@@ -105,4 +113,49 @@ export class CommentService {
|
|||||||
|
|
||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async createReadOnlyComment(
|
||||||
|
opts: { userId: string; page: Page; workspaceId: string },
|
||||||
|
createCommentDto: CreateReadOnlyCommentDto,
|
||||||
|
): Promise<Comment> {
|
||||||
|
const { userId, page, workspaceId } = opts;
|
||||||
|
const commentContent = JSON.parse(createCommentDto.content);
|
||||||
|
|
||||||
|
const comment = await this.commentRepo.insertComment({
|
||||||
|
pageId: page.id,
|
||||||
|
content: commentContent,
|
||||||
|
selection: createCommentDto?.selection?.substring(0, 250),
|
||||||
|
type: 'inline',
|
||||||
|
creatorId: userId,
|
||||||
|
workspaceId: workspaceId,
|
||||||
|
spaceId: page.spaceId,
|
||||||
|
});
|
||||||
|
|
||||||
|
const documentName = `page.${page.id}`;
|
||||||
|
const directConnection =
|
||||||
|
await this.collaborationGateway.openDirectConnection(documentName);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await directConnection.transact((doc) => {
|
||||||
|
const fragment = doc.getXmlFragment('default');
|
||||||
|
setYjsMark(doc, fragment, createCommentDto.yjsSelection, 'comment', {
|
||||||
|
commentId: comment.id,
|
||||||
|
resolved: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
this.logger.error(
|
||||||
|
`Failed to apply comment mark for comment ${comment.id}`,
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
await this.commentRepo.deleteComment(comment.id);
|
||||||
|
throw new BadRequestException(
|
||||||
|
'Failed to apply comment mark. Selection may have changed.',
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
await directConnection.disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { IsJSON, IsObject, IsOptional, IsString } from 'class-validator';
|
||||||
|
|
||||||
|
export class CreateReadOnlyCommentDto {
|
||||||
|
@IsString()
|
||||||
|
pageId: string;
|
||||||
|
|
||||||
|
@IsJSON()
|
||||||
|
content: any;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
selection: string;
|
||||||
|
|
||||||
|
@IsObject()
|
||||||
|
yjsSelection: {
|
||||||
|
anchor: any;
|
||||||
|
head: any;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ import {Transform, TransformFnParams} from "class-transformer";
|
|||||||
|
|
||||||
export class CreateGroupDto {
|
export class CreateGroupDto {
|
||||||
@MinLength(2)
|
@MinLength(2)
|
||||||
@MaxLength(50)
|
@MaxLength(100)
|
||||||
@IsString()
|
@IsString()
|
||||||
@Transform(({ value }: TransformFnParams) => value?.trim())
|
@Transform(({ value }: TransformFnParams) => value?.trim())
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
import {
|
import {
|
||||||
Controller,
|
BadRequestException,
|
||||||
Post,
|
|
||||||
Body,
|
Body,
|
||||||
|
Controller,
|
||||||
|
ForbiddenException,
|
||||||
HttpCode,
|
HttpCode,
|
||||||
HttpStatus,
|
HttpStatus,
|
||||||
UseGuards,
|
|
||||||
ForbiddenException,
|
|
||||||
NotFoundException,
|
NotFoundException,
|
||||||
BadRequestException,
|
Post,
|
||||||
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { PageService } from './services/page.service';
|
import { PageService } from './services/page.service';
|
||||||
import { CreatePageDto } from './dto/create-page.dto';
|
import { CreatePageDto } from './dto/create-page.dto';
|
||||||
import { UpdatePageDto } from './dto/update-page.dto';
|
import { UpdatePageDto } from './dto/update-page.dto';
|
||||||
import { MovePageDto, MovePageToSpaceDto } from './dto/move-page.dto';
|
import { MovePageDto, MovePageToSpaceDto } from './dto/move-page.dto';
|
||||||
import {
|
import {
|
||||||
|
DeletePageDto,
|
||||||
PageHistoryIdDto,
|
PageHistoryIdDto,
|
||||||
PageIdDto,
|
PageIdDto,
|
||||||
PageInfoDto,
|
PageInfoDto,
|
||||||
DeletePageDto,
|
|
||||||
} from './dto/page.dto';
|
} from './dto/page.dto';
|
||||||
import { PageHistoryService } from './services/page-history.service';
|
import { PageHistoryService } from './services/page-history.service';
|
||||||
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
import { AuthUser } from '../../common/decorators/auth-user.decorator';
|
||||||
@@ -106,7 +106,11 @@ export class PageController {
|
|||||||
|
|
||||||
@HttpCode(HttpStatus.OK)
|
@HttpCode(HttpStatus.OK)
|
||||||
@Post('delete')
|
@Post('delete')
|
||||||
async delete(@Body() deletePageDto: DeletePageDto, @AuthUser() user: User) {
|
async delete(
|
||||||
|
@Body() deletePageDto: DeletePageDto,
|
||||||
|
@AuthUser() user: User,
|
||||||
|
@AuthWorkspace() workspace: Workspace,
|
||||||
|
) {
|
||||||
const page = await this.pageRepo.findById(deletePageDto.pageId);
|
const page = await this.pageRepo.findById(deletePageDto.pageId);
|
||||||
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
@@ -122,19 +126,27 @@ export class PageController {
|
|||||||
'Only space admins can permanently delete pages',
|
'Only space admins can permanently delete pages',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await this.pageService.forceDelete(deletePageDto.pageId);
|
await this.pageService.forceDelete(deletePageDto.pageId, workspace.id);
|
||||||
} else {
|
} else {
|
||||||
// Soft delete requires page manage permissions
|
// Soft delete requires page manage permissions
|
||||||
if (ability.cannot(SpaceCaslAction.Manage, SpaceCaslSubject.Page)) {
|
if (ability.cannot(SpaceCaslAction.Manage, SpaceCaslSubject.Page)) {
|
||||||
throw new ForbiddenException();
|
throw new ForbiddenException();
|
||||||
}
|
}
|
||||||
await this.pageService.remove(deletePageDto.pageId, user.id);
|
await this.pageService.removePage(
|
||||||
|
deletePageDto.pageId,
|
||||||
|
user.id,
|
||||||
|
workspace.id,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@HttpCode(HttpStatus.OK)
|
@HttpCode(HttpStatus.OK)
|
||||||
@Post('restore')
|
@Post('restore')
|
||||||
async restore(@Body() pageIdDto: PageIdDto, @AuthUser() user: User) {
|
async restore(
|
||||||
|
@Body() pageIdDto: PageIdDto,
|
||||||
|
@AuthUser() user: User,
|
||||||
|
@AuthWorkspace() workspace: Workspace,
|
||||||
|
) {
|
||||||
const page = await this.pageRepo.findById(pageIdDto.pageId);
|
const page = await this.pageRepo.findById(pageIdDto.pageId);
|
||||||
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
@@ -146,13 +158,11 @@ export class PageController {
|
|||||||
throw new ForbiddenException();
|
throw new ForbiddenException();
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.pageRepo.restorePage(pageIdDto.pageId);
|
await this.pageRepo.restorePage(pageIdDto.pageId, workspace.id);
|
||||||
|
|
||||||
// Return the restored page data with hasChildren info
|
return this.pageRepo.findById(pageIdDto.pageId, {
|
||||||
const restoredPage = await this.pageRepo.findById(pageIdDto.pageId, {
|
|
||||||
includeHasChildren: true,
|
includeHasChildren: true,
|
||||||
});
|
});
|
||||||
return restoredPage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@HttpCode(HttpStatus.OK)
|
@HttpCode(HttpStatus.OK)
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export class PageService {
|
|||||||
@InjectKysely() private readonly db: KyselyDB,
|
@InjectKysely() private readonly db: KyselyDB,
|
||||||
private readonly storageService: StorageService,
|
private readonly storageService: StorageService,
|
||||||
@InjectQueue(QueueName.ATTACHMENT_QUEUE) private attachmentQueue: Queue,
|
@InjectQueue(QueueName.ATTACHMENT_QUEUE) private attachmentQueue: Queue,
|
||||||
|
@InjectQueue(QueueName.AI_QUEUE) private aiQueue: Queue,
|
||||||
private eventEmitter: EventEmitter2,
|
private eventEmitter: EventEmitter2,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@@ -255,6 +256,11 @@ export class PageService {
|
|||||||
pageIds,
|
pageIds,
|
||||||
trx,
|
trx,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await this.aiQueue.add(QueueJob.PAGE_MOVED_TO_SPACE, {
|
||||||
|
pageId: pageIds,
|
||||||
|
workspaceId: rootPage.workspaceId
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -381,9 +387,9 @@ export class PageService {
|
|||||||
workspaceId: page.workspaceId,
|
workspaceId: page.workspaceId,
|
||||||
creatorId: authUser.id,
|
creatorId: authUser.id,
|
||||||
lastUpdatedById: authUser.id,
|
lastUpdatedById: authUser.id,
|
||||||
parentPageId: page.parentPageId
|
parentPageId: page.id === rootPage.id
|
||||||
? pageMap.get(page.parentPageId)?.newPageId
|
? (isDuplicateInSameSpace ? rootPage.parentPageId : null)
|
||||||
: null,
|
: (page.parentPageId ? pageMap.get(page.parentPageId)?.newPageId : null),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -393,6 +399,7 @@ export class PageService {
|
|||||||
const insertedPageIds = insertablePages.map((page) => page.id);
|
const insertedPageIds = insertablePages.map((page) => page.id);
|
||||||
this.eventEmitter.emit(EventName.PAGE_CREATED, {
|
this.eventEmitter.emit(EventName.PAGE_CREATED, {
|
||||||
pageIds: insertedPageIds,
|
pageIds: insertedPageIds,
|
||||||
|
workspaceId: authUser.workspaceId,
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO: best to handle this in a queue
|
//TODO: best to handle this in a queue
|
||||||
@@ -580,7 +587,7 @@ export class PageService {
|
|||||||
return await this.pageRepo.getDeletedPagesInSpace(spaceId, pagination);
|
return await this.pageRepo.getDeletedPagesInSpace(spaceId, pagination);
|
||||||
}
|
}
|
||||||
|
|
||||||
async forceDelete(pageId: string): Promise<void> {
|
async forceDelete(pageId: string, workspaceId: string): Promise<void> {
|
||||||
// Get all descendant IDs (including the page itself) using recursive CTE
|
// Get all descendant IDs (including the page itself) using recursive CTE
|
||||||
const descendants = await this.db
|
const descendants = await this.db
|
||||||
.withRecursive('page_descendants', (db) =>
|
.withRecursive('page_descendants', (db) =>
|
||||||
@@ -623,11 +630,16 @@ export class PageService {
|
|||||||
await this.db.deleteFrom('pages').where('id', 'in', pageIds).execute();
|
await this.db.deleteFrom('pages').where('id', 'in', pageIds).execute();
|
||||||
this.eventEmitter.emit(EventName.PAGE_DELETED, {
|
this.eventEmitter.emit(EventName.PAGE_DELETED, {
|
||||||
pageIds: pageIds,
|
pageIds: pageIds,
|
||||||
|
workspaceId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove(pageId: string, userId: string): Promise<void> {
|
async removePage(
|
||||||
await this.pageRepo.removePage(pageId, userId);
|
pageId: string,
|
||||||
|
userId: string,
|
||||||
|
workspaceId: string,
|
||||||
|
): Promise<void> {
|
||||||
|
await this.pageRepo.removePage(pageId, userId, workspaceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export class SearchService {
|
|||||||
)
|
)
|
||||||
.where('deletedAt', 'is', null)
|
.where('deletedAt', 'is', null)
|
||||||
.orderBy('rank', 'desc')
|
.orderBy('rank', 'desc')
|
||||||
.limit(searchParams.limit | 20)
|
.limit(searchParams.limit | 25)
|
||||||
.offset(searchParams.offset || 0);
|
.offset(searchParams.offset || 0);
|
||||||
|
|
||||||
if (!searchParams.shareId) {
|
if (!searchParams.shareId) {
|
||||||
@@ -74,16 +74,13 @@ export class SearchService {
|
|||||||
queryResults = queryResults.where('spaceId', '=', searchParams.spaceId);
|
queryResults = queryResults.where('spaceId', '=', searchParams.spaceId);
|
||||||
} else if (opts.userId && !searchParams.spaceId) {
|
} else if (opts.userId && !searchParams.spaceId) {
|
||||||
// only search spaces the user is a member of
|
// only search spaces the user is a member of
|
||||||
const userSpaceIds = await this.spaceMemberRepo.getUserSpaceIds(
|
queryResults = queryResults
|
||||||
opts.userId,
|
.where(
|
||||||
);
|
'spaceId',
|
||||||
if (userSpaceIds.length > 0) {
|
'in',
|
||||||
queryResults = queryResults
|
this.spaceMemberRepo.getUserSpaceIdsQuery(opts.userId),
|
||||||
.where('spaceId', 'in', userSpaceIds)
|
)
|
||||||
.where('workspaceId', '=', opts.workspaceId);
|
.where('workspaceId', '=', opts.workspaceId);
|
||||||
} else {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
} else if (searchParams.shareId && !searchParams.spaceId && !opts.userId) {
|
} else if (searchParams.shareId && !searchParams.spaceId && !opts.userId) {
|
||||||
// search in shares
|
// search in shares
|
||||||
const shareId = searchParams.shareId;
|
const shareId = searchParams.shareId;
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ export class ShareService {
|
|||||||
return await this.shareRepo.insertShare({
|
return await this.shareRepo.insertShare({
|
||||||
key: nanoIdGen().toLowerCase(),
|
key: nanoIdGen().toLowerCase(),
|
||||||
pageId: page.id,
|
pageId: page.id,
|
||||||
includeSubPages: createShareDto.includeSubPages || true,
|
includeSubPages: createShareDto.includeSubPages ?? false,
|
||||||
searchIndexing: createShareDto.searchIndexing || true,
|
searchIndexing: createShareDto.searchIndexing ?? false,
|
||||||
creatorId: authUserId,
|
creatorId: authUserId,
|
||||||
spaceId: page.spaceId,
|
spaceId: page.spaceId,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
@@ -123,80 +123,82 @@ export class ShareService {
|
|||||||
.withRecursive('page_hierarchy', (cte) =>
|
.withRecursive('page_hierarchy', (cte) =>
|
||||||
cte
|
cte
|
||||||
.selectFrom('pages')
|
.selectFrom('pages')
|
||||||
|
.leftJoin('shares', 'shares.pageId', 'pages.id')
|
||||||
.select([
|
.select([
|
||||||
'id',
|
'pages.id',
|
||||||
'slugId',
|
'pages.slugId',
|
||||||
'pages.title',
|
'pages.title',
|
||||||
'pages.icon',
|
'pages.icon',
|
||||||
'parentPageId',
|
'pages.parentPageId',
|
||||||
sql`0`.as('level'),
|
sql`0`.as('level'),
|
||||||
|
'shares.id as shareId',
|
||||||
|
'shares.key as shareKey',
|
||||||
|
'shares.includeSubPages',
|
||||||
|
'shares.searchIndexing',
|
||||||
|
'shares.creatorId',
|
||||||
|
'shares.spaceId',
|
||||||
|
'shares.workspaceId',
|
||||||
|
'shares.createdAt',
|
||||||
])
|
])
|
||||||
.where(isValidUUID(pageId) ? 'id' : 'slugId', '=', pageId)
|
.where(isValidUUID(pageId) ? 'pages.id' : 'pages.slugId', '=', pageId)
|
||||||
.where('deletedAt', 'is', null)
|
.where('pages.deletedAt', 'is', null)
|
||||||
.unionAll((union) =>
|
.unionAll(
|
||||||
union
|
(union) =>
|
||||||
.selectFrom('pages as p')
|
union
|
||||||
.select([
|
.selectFrom('pages as p')
|
||||||
'p.id',
|
.innerJoin('page_hierarchy as ph', 'ph.parentPageId', 'p.id')
|
||||||
'p.slugId',
|
.leftJoin('shares as s', 's.pageId', 'p.id')
|
||||||
'p.title',
|
.select([
|
||||||
'p.icon',
|
'p.id',
|
||||||
'p.parentPageId',
|
'p.slugId',
|
||||||
// Increase the level by 1 for each ancestor.
|
'p.title',
|
||||||
sql`ph.level + 1`.as('level'),
|
'p.icon',
|
||||||
])
|
'p.parentPageId',
|
||||||
.innerJoin('page_hierarchy as ph', 'ph.parentPageId', 'p.id')
|
sql`ph.level + 1`.as('level'),
|
||||||
.where('p.deletedAt', 'is', null),
|
's.id as shareId',
|
||||||
|
's.key as shareKey',
|
||||||
|
's.includeSubPages',
|
||||||
|
's.searchIndexing',
|
||||||
|
's.creatorId',
|
||||||
|
's.spaceId',
|
||||||
|
's.workspaceId',
|
||||||
|
's.createdAt',
|
||||||
|
])
|
||||||
|
.where('p.deletedAt', 'is', null)
|
||||||
|
.where(sql`ph.share_id`, 'is', null) // stop if share found
|
||||||
|
.where(sql`ph.level`, '<', sql`25`), // prevent loop
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.selectFrom('page_hierarchy')
|
.selectFrom('page_hierarchy')
|
||||||
.leftJoin('shares', 'shares.pageId', 'page_hierarchy.id')
|
.selectAll()
|
||||||
.select([
|
.where('shareId', 'is not', null)
|
||||||
'page_hierarchy.id as sharedPageId',
|
.limit(1)
|
||||||
'page_hierarchy.slugId as sharedPageSlugId',
|
|
||||||
'page_hierarchy.title as sharedPageTitle',
|
|
||||||
'page_hierarchy.icon as sharedPageIcon',
|
|
||||||
'page_hierarchy.level as level',
|
|
||||||
'shares.id',
|
|
||||||
'shares.key',
|
|
||||||
'shares.pageId',
|
|
||||||
'shares.includeSubPages',
|
|
||||||
'shares.searchIndexing',
|
|
||||||
'shares.creatorId',
|
|
||||||
'shares.spaceId',
|
|
||||||
'shares.workspaceId',
|
|
||||||
'shares.createdAt',
|
|
||||||
'shares.updatedAt',
|
|
||||||
])
|
|
||||||
.where('shares.id', 'is not', null)
|
|
||||||
.orderBy('page_hierarchy.level', 'asc')
|
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|
||||||
if (!share || share.workspaceId != workspaceId) {
|
if (!share || share.workspaceId !== workspaceId) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (share.level === 1 && !share.includeSubPages) {
|
if ((share.level as number) > 0 && !share.includeSubPages) {
|
||||||
// we can only show a page if its shared ancestor permits it
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: share.id,
|
id: share.shareId,
|
||||||
key: share.key,
|
key: share.shareKey,
|
||||||
includeSubPages: share.includeSubPages,
|
includeSubPages: share.includeSubPages,
|
||||||
searchIndexing: share.searchIndexing,
|
searchIndexing: share.searchIndexing,
|
||||||
pageId: share.pageId,
|
pageId: share.id,
|
||||||
creatorId: share.creatorId,
|
creatorId: share.creatorId,
|
||||||
spaceId: share.spaceId,
|
spaceId: share.spaceId,
|
||||||
workspaceId: share.workspaceId,
|
workspaceId: share.workspaceId,
|
||||||
createdAt: share.createdAt,
|
createdAt: share.createdAt,
|
||||||
level: share.level,
|
level: share.level,
|
||||||
sharedPage: {
|
sharedPage: {
|
||||||
id: share.sharedPageId,
|
id: share.id,
|
||||||
slugId: share.sharedPageSlugId,
|
slugId: share.slugId,
|
||||||
title: share.sharedPageTitle,
|
title: share.title,
|
||||||
icon: share.sharedPageIcon,
|
icon: share.icon,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {Transform, TransformFnParams} from "class-transformer";
|
|||||||
|
|
||||||
export class CreateSpaceDto {
|
export class CreateSpaceDto {
|
||||||
@MinLength(2)
|
@MinLength(2)
|
||||||
@MaxLength(50)
|
@MaxLength(100)
|
||||||
@IsString()
|
@IsString()
|
||||||
@Transform(({ value }: TransformFnParams) => value?.trim())
|
@Transform(({ value }: TransformFnParams) => value?.trim())
|
||||||
name: string;
|
name: string;
|
||||||
@@ -19,7 +19,7 @@ export class CreateSpaceDto {
|
|||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
@MinLength(2)
|
@MinLength(2)
|
||||||
@MaxLength(50)
|
@MaxLength(100)
|
||||||
@IsAlphanumeric()
|
@IsAlphanumeric()
|
||||||
slug: string;
|
slug: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,4 +22,12 @@ export class UpdateWorkspaceDto extends PartialType(CreateWorkspaceDto) {
|
|||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
restrictApiToAdmins: boolean;
|
restrictApiToAdmins: boolean;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsBoolean()
|
||||||
|
aiSearch: boolean;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsBoolean()
|
||||||
|
generativeAi: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import { InjectQueue } from '@nestjs/bullmq';
|
|||||||
import { QueueJob, QueueName } from '../../../integrations/queue/constants';
|
import { QueueJob, QueueName } from '../../../integrations/queue/constants';
|
||||||
import { Queue } from 'bullmq';
|
import { Queue } from 'bullmq';
|
||||||
import { generateRandomSuffixNumbers } from '../../../common/helpers';
|
import { generateRandomSuffixNumbers } from '../../../common/helpers';
|
||||||
|
import { isPageEmbeddingsTableExists } from '@docmost/db/helpers/helpers';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WorkspaceService {
|
export class WorkspaceService {
|
||||||
@@ -50,6 +51,7 @@ export class WorkspaceService {
|
|||||||
@InjectKysely() private readonly db: KyselyDB,
|
@InjectKysely() private readonly db: KyselyDB,
|
||||||
@InjectQueue(QueueName.ATTACHMENT_QUEUE) private attachmentQueue: Queue,
|
@InjectQueue(QueueName.ATTACHMENT_QUEUE) private attachmentQueue: Queue,
|
||||||
@InjectQueue(QueueName.BILLING_QUEUE) private billingQueue: Queue,
|
@InjectQueue(QueueName.BILLING_QUEUE) private billingQueue: Queue,
|
||||||
|
@InjectQueue(QueueName.AI_QUEUE) private aiQueue: Queue,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async findById(workspaceId: string) {
|
async findById(workspaceId: string) {
|
||||||
@@ -312,6 +314,51 @@ export class WorkspaceService {
|
|||||||
delete updateWorkspaceDto.restrictApiToAdmins;
|
delete updateWorkspaceDto.restrictApiToAdmins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof updateWorkspaceDto.aiSearch !== 'undefined') {
|
||||||
|
await this.workspaceRepo.updateAiSettings(
|
||||||
|
workspaceId,
|
||||||
|
'search',
|
||||||
|
updateWorkspaceDto.aiSearch,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (updateWorkspaceDto.aiSearch) {
|
||||||
|
const tableExists = await isPageEmbeddingsTableExists(this.db);
|
||||||
|
if (!tableExists) {
|
||||||
|
throw new BadRequestException(
|
||||||
|
'Failed to activate. Make sure pgvector postgres extension is installed.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.aiQueue.add(QueueJob.WORKSPACE_CREATE_EMBEDDINGS, {
|
||||||
|
workspaceId,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Schedule deletion after 24 hours
|
||||||
|
const deleteJobId = `ai-search-disabled-${workspaceId}`;
|
||||||
|
await this.aiQueue.add(
|
||||||
|
QueueJob.WORKSPACE_DELETE_EMBEDDINGS,
|
||||||
|
{ workspaceId },
|
||||||
|
{
|
||||||
|
jobId: deleteJobId,
|
||||||
|
delay: 24 * 60 * 60 * 1000,
|
||||||
|
removeOnComplete: true,
|
||||||
|
removeOnFail: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete updateWorkspaceDto.aiSearch;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof updateWorkspaceDto.generativeAi !== 'undefined') {
|
||||||
|
await this.workspaceRepo.updateAiSettings(
|
||||||
|
workspaceId,
|
||||||
|
'generative',
|
||||||
|
updateWorkspaceDto.generativeAi,
|
||||||
|
);
|
||||||
|
delete updateWorkspaceDto.generativeAi;
|
||||||
|
}
|
||||||
|
|
||||||
await this.workspaceRepo.updateWorkspace(updateWorkspaceDto, workspaceId);
|
await this.workspaceRepo.updateWorkspace(updateWorkspaceDto, workspaceId);
|
||||||
|
|
||||||
const workspace = await this.workspaceRepo.findById(workspaceId, {
|
const workspace = await this.workspaceRepo.findById(workspaceId, {
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { sql } from 'kysely';
|
||||||
|
import { KyselyDB } from '@docmost/db/types/kysely.types';
|
||||||
|
|
||||||
|
export async function isPageEmbeddingsTableExists(db: KyselyDB) {
|
||||||
|
return tableExists({ db, tableName: 'page_embeddings' });
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function tableExists(opts: {
|
||||||
|
db: KyselyDB;
|
||||||
|
tableName: string;
|
||||||
|
}): Promise<boolean> {
|
||||||
|
const { db, tableName } = opts;
|
||||||
|
const result = await sql<{ exists: boolean }>`
|
||||||
|
SELECT EXISTS (
|
||||||
|
SELECT 1 FROM information_schema.tables
|
||||||
|
WHERE table_schema = COALESCE(current_schema(), 'public')
|
||||||
|
AND table_name = ${tableName}
|
||||||
|
) as exists
|
||||||
|
`.execute(db);
|
||||||
|
|
||||||
|
return result.rows[0]?.exists ?? false;
|
||||||
|
}
|
||||||
@@ -4,9 +4,11 @@ import { EventName } from '../../common/events/event.contants';
|
|||||||
import { InjectQueue } from '@nestjs/bullmq';
|
import { InjectQueue } from '@nestjs/bullmq';
|
||||||
import { QueueJob, QueueName } from '../../integrations/queue/constants';
|
import { QueueJob, QueueName } from '../../integrations/queue/constants';
|
||||||
import { Queue } from 'bullmq';
|
import { Queue } from 'bullmq';
|
||||||
|
import { EnvironmentService } from '../../integrations/environment/environment.service';
|
||||||
|
|
||||||
export class PageEvent {
|
export class PageEvent {
|
||||||
pageIds: string[];
|
pageIds: string[];
|
||||||
|
workspaceId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@@ -14,36 +16,65 @@ export class PageListener {
|
|||||||
private readonly logger = new Logger(PageListener.name);
|
private readonly logger = new Logger(PageListener.name);
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private readonly environmentService: EnvironmentService,
|
||||||
@InjectQueue(QueueName.SEARCH_QUEUE) private searchQueue: Queue,
|
@InjectQueue(QueueName.SEARCH_QUEUE) private searchQueue: Queue,
|
||||||
|
@InjectQueue(QueueName.AI_QUEUE) private aiQueue: Queue,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@OnEvent(EventName.PAGE_CREATED)
|
@OnEvent(EventName.PAGE_CREATED)
|
||||||
async handlePageCreated(event: PageEvent) {
|
async handlePageCreated(event: PageEvent) {
|
||||||
const { pageIds } = event;
|
const { pageIds, workspaceId } = event;
|
||||||
await this.searchQueue.add(QueueJob.PAGE_CREATED, { pageIds });
|
if (this.isTypesense()) {
|
||||||
|
await this.searchQueue.add(QueueJob.PAGE_CREATED, {
|
||||||
|
pageIds,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.aiQueue.add(QueueJob.PAGE_CREATED, { pageIds, workspaceId });
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnEvent(EventName.PAGE_UPDATED)
|
@OnEvent(EventName.PAGE_UPDATED)
|
||||||
async handlePageUpdated(event: PageEvent) {
|
async handlePageUpdated(event: PageEvent) {
|
||||||
const { pageIds } = event;
|
const { pageIds } = event;
|
||||||
|
|
||||||
await this.searchQueue.add(QueueJob.PAGE_UPDATED, { pageIds });
|
await this.searchQueue.add(QueueJob.PAGE_UPDATED, { pageIds });
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnEvent(EventName.PAGE_DELETED)
|
@OnEvent(EventName.PAGE_DELETED)
|
||||||
async handlePageDeleted(event: PageEvent) {
|
async handlePageDeleted(event: PageEvent) {
|
||||||
const { pageIds } = event;
|
const { pageIds, workspaceId } = event;
|
||||||
await this.searchQueue.add(QueueJob.PAGE_DELETED, { pageIds });
|
if (this.isTypesense()) {
|
||||||
|
await this.searchQueue.add(QueueJob.PAGE_DELETED, { pageIds });
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.aiQueue.add(QueueJob.PAGE_DELETED, { pageIds, workspaceId });
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnEvent(EventName.PAGE_SOFT_DELETED)
|
@OnEvent(EventName.PAGE_SOFT_DELETED)
|
||||||
async handlePageSoftDeleted(event: PageEvent) {
|
async handlePageSoftDeleted(event: PageEvent) {
|
||||||
const { pageIds } = event;
|
const { pageIds, workspaceId } = event;
|
||||||
await this.searchQueue.add(QueueJob.PAGE_SOFT_DELETED, { pageIds });
|
|
||||||
|
if (this.isTypesense()) {
|
||||||
|
await this.searchQueue.add(QueueJob.PAGE_SOFT_DELETED, { pageIds });
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.aiQueue.add(QueueJob.PAGE_SOFT_DELETED, {
|
||||||
|
pageIds,
|
||||||
|
workspaceId,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnEvent(EventName.PAGE_RESTORED)
|
@OnEvent(EventName.PAGE_RESTORED)
|
||||||
async handlePageRestored(event: PageEvent) {
|
async handlePageRestored(event: PageEvent) {
|
||||||
const { pageIds } = event;
|
const { pageIds, workspaceId } = event;
|
||||||
await this.searchQueue.add(QueueJob.PAGE_RESTORED, { pageIds });
|
if (this.isTypesense()) {
|
||||||
|
await this.searchQueue.add(QueueJob.PAGE_RESTORED, { pageIds });
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.aiQueue.add(QueueJob.PAGE_RESTORED, { pageIds, workspaceId });
|
||||||
|
}
|
||||||
|
|
||||||
|
isTypesense(): boolean {
|
||||||
|
return this.environmentService.getSearchDriver() === 'typesense';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { Injectable, Logger } from '@nestjs/common';
|
||||||
|
import { OnEvent } from '@nestjs/event-emitter';
|
||||||
|
import { EventName } from '../../common/events/event.contants';
|
||||||
|
import { InjectQueue } from '@nestjs/bullmq';
|
||||||
|
import { QueueJob, QueueName } from '../../integrations/queue/constants';
|
||||||
|
import { Queue } from 'bullmq';
|
||||||
|
import { EnvironmentService } from '../../integrations/environment/environment.service';
|
||||||
|
|
||||||
|
export class SpaceEvent {
|
||||||
|
spaceId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class SpaceListener {
|
||||||
|
private readonly logger = new Logger(SpaceListener.name);
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly environmentService: EnvironmentService,
|
||||||
|
@InjectQueue(QueueName.SEARCH_QUEUE) private searchQueue: Queue,
|
||||||
|
@InjectQueue(QueueName.AI_QUEUE) private aiQueue: Queue,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
@OnEvent(EventName.SPACE_DELETED)
|
||||||
|
async handleSpaceDeleted(event: SpaceEvent) {
|
||||||
|
const { spaceId } = event;
|
||||||
|
if (this.isTypesense()) {
|
||||||
|
await this.searchQueue.add(QueueJob.SPACE_DELETED, { spaceId });
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.aiQueue.add(QueueJob.SPACE_DELETED, { spaceId });
|
||||||
|
}
|
||||||
|
|
||||||
|
isTypesense(): boolean {
|
||||||
|
return this.environmentService.getSearchDriver() === 'typesense';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { Injectable, Logger } from '@nestjs/common';
|
||||||
|
import { OnEvent } from '@nestjs/event-emitter';
|
||||||
|
import { EventName } from '../../common/events/event.contants';
|
||||||
|
import { InjectQueue } from '@nestjs/bullmq';
|
||||||
|
import { QueueJob, QueueName } from '../../integrations/queue/constants';
|
||||||
|
import { Queue } from 'bullmq';
|
||||||
|
import { EnvironmentService } from '../../integrations/environment/environment.service';
|
||||||
|
|
||||||
|
export class WorkspaceEvent {
|
||||||
|
workspaceId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class WorkspaceListener {
|
||||||
|
private readonly logger = new Logger(WorkspaceListener.name);
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly environmentService: EnvironmentService,
|
||||||
|
@InjectQueue(QueueName.SEARCH_QUEUE) private searchQueue: Queue,
|
||||||
|
@InjectQueue(QueueName.AI_QUEUE) private aiQueue: Queue,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
@OnEvent(EventName.WORKSPACE_DELETED)
|
||||||
|
async handlePageDeleted(event: WorkspaceEvent) {
|
||||||
|
const { workspaceId } = event;
|
||||||
|
if (this.isTypesense()) {
|
||||||
|
await this.searchQueue.add(QueueJob.WORKSPACE_DELETED, { workspaceId });
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.aiQueue.add(QueueJob.WORKSPACE_DELETED, { workspaceId });
|
||||||
|
}
|
||||||
|
|
||||||
|
isTypesense(): boolean {
|
||||||
|
return this.environmentService.getSearchDriver() === 'typesense';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -125,6 +125,7 @@ export class PageRepo {
|
|||||||
|
|
||||||
this.eventEmitter.emit(EventName.PAGE_UPDATED, {
|
this.eventEmitter.emit(EventName.PAGE_UPDATED, {
|
||||||
pageIds: pageIds,
|
pageIds: pageIds,
|
||||||
|
workspaceId: updatePageData.workspaceId,
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -143,6 +144,7 @@ export class PageRepo {
|
|||||||
|
|
||||||
this.eventEmitter.emit(EventName.PAGE_CREATED, {
|
this.eventEmitter.emit(EventName.PAGE_CREATED, {
|
||||||
pageIds: [result.id],
|
pageIds: [result.id],
|
||||||
|
workspaceId: result.workspaceId,
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -160,7 +162,11 @@ export class PageRepo {
|
|||||||
await query.execute();
|
await query.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
async removePage(pageId: string, deletedById: string): Promise<void> {
|
async removePage(
|
||||||
|
pageId: string,
|
||||||
|
deletedById: string,
|
||||||
|
workspaceId: string,
|
||||||
|
): Promise<void> {
|
||||||
const currentDate = new Date();
|
const currentDate = new Date();
|
||||||
|
|
||||||
const descendants = await this.db
|
const descendants = await this.db
|
||||||
@@ -195,13 +201,15 @@ export class PageRepo {
|
|||||||
|
|
||||||
await trx.deleteFrom('shares').where('pageId', 'in', pageIds).execute();
|
await trx.deleteFrom('shares').where('pageId', 'in', pageIds).execute();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.eventEmitter.emit(EventName.PAGE_SOFT_DELETED, {
|
this.eventEmitter.emit(EventName.PAGE_SOFT_DELETED, {
|
||||||
pageIds: pageIds,
|
pageIds: pageIds,
|
||||||
|
workspaceId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async restorePage(pageId: string): Promise<void> {
|
async restorePage(pageId: string, workspaceId: string): Promise<void> {
|
||||||
// First, check if the page being restored has a deleted parent
|
// First, check if the page being restored has a deleted parent
|
||||||
const pageToRestore = await this.db
|
const pageToRestore = await this.db
|
||||||
.selectFrom('pages')
|
.selectFrom('pages')
|
||||||
@@ -263,6 +271,7 @@ export class PageRepo {
|
|||||||
}
|
}
|
||||||
this.eventEmitter.emit(EventName.PAGE_RESTORED, {
|
this.eventEmitter.emit(EventName.PAGE_RESTORED, {
|
||||||
pageIds: pageIds,
|
pageIds: pageIds,
|
||||||
|
workspaceId: workspaceId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,24 +293,18 @@ export class PageRepo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getRecentPages(userId: string, pagination: PaginationOptions) {
|
async getRecentPages(userId: string, pagination: PaginationOptions) {
|
||||||
const userSpaceIds = await this.spaceMemberRepo.getUserSpaceIds(userId);
|
|
||||||
|
|
||||||
const query = this.db
|
const query = this.db
|
||||||
.selectFrom('pages')
|
.selectFrom('pages')
|
||||||
.select(this.baseFields)
|
.select(this.baseFields)
|
||||||
.select((eb) => this.withSpace(eb))
|
.select((eb) => this.withSpace(eb))
|
||||||
.where('spaceId', 'in', userSpaceIds)
|
.where('spaceId', 'in', this.spaceMemberRepo.getUserSpaceIdsQuery(userId))
|
||||||
.where('deletedAt', 'is', null)
|
.where('deletedAt', 'is', null)
|
||||||
.orderBy('updatedAt', 'desc');
|
.orderBy('updatedAt', 'desc');
|
||||||
|
|
||||||
const hasEmptyIds = userSpaceIds.length === 0;
|
return executeWithPagination(query, {
|
||||||
const result = executeWithPagination(query, {
|
|
||||||
page: pagination.page,
|
page: pagination.page,
|
||||||
perPage: pagination.limit,
|
perPage: pagination.limit,
|
||||||
hasEmptyIds,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getDeletedPagesInSpace(spaceId: string, pagination: PaginationOptions) {
|
async getDeletedPagesInSpace(spaceId: string, pagination: PaginationOptions) {
|
||||||
|
|||||||
@@ -137,25 +137,19 @@ export class ShareRepo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getShares(userId: string, pagination: PaginationOptions) {
|
async getShares(userId: string, pagination: PaginationOptions) {
|
||||||
const userSpaceIds = await this.spaceMemberRepo.getUserSpaceIds(userId);
|
|
||||||
|
|
||||||
const query = this.db
|
const query = this.db
|
||||||
.selectFrom('shares')
|
.selectFrom('shares')
|
||||||
.select(this.baseFields)
|
.select(this.baseFields)
|
||||||
.select((eb) => this.withPage(eb))
|
.select((eb) => this.withPage(eb))
|
||||||
.select((eb) => this.withSpace(eb, userId))
|
.select((eb) => this.withSpace(eb, userId))
|
||||||
.select((eb) => this.withCreator(eb))
|
.select((eb) => this.withCreator(eb))
|
||||||
.where('spaceId', 'in', userSpaceIds)
|
.where('spaceId', 'in', this.spaceMemberRepo.getUserSpaceIdsQuery(userId))
|
||||||
.orderBy('updatedAt', 'desc');
|
.orderBy('updatedAt', 'desc');
|
||||||
|
|
||||||
const hasEmptyIds = userSpaceIds.length === 0;
|
return executeWithPagination(query, {
|
||||||
const result = executeWithPagination(query, {
|
|
||||||
page: pagination.page,
|
page: pagination.page,
|
||||||
perPage: pagination.limit,
|
perPage: pagination.limit,
|
||||||
hasEmptyIds,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
withPage(eb: ExpressionBuilder<DB, 'shares'>) {
|
withPage(eb: ExpressionBuilder<DB, 'shares'>) {
|
||||||
|
|||||||
@@ -209,34 +209,33 @@ export class SpaceMemberRepo {
|
|||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getUserSpaceIds(userId: string): Promise<string[]> {
|
getUserSpaceIdsQuery(userId: string) {
|
||||||
const membership = await this.db
|
return this.db
|
||||||
.selectFrom('spaceMembers')
|
.selectFrom('spaceMembers')
|
||||||
.innerJoin('spaces', 'spaces.id', 'spaceMembers.spaceId')
|
.innerJoin('spaces', 'spaces.id', 'spaceMembers.spaceId')
|
||||||
.select(['spaces.id'])
|
.select('spaces.id')
|
||||||
.where('userId', '=', userId)
|
.where('userId', '=', userId)
|
||||||
.union(
|
.union(
|
||||||
this.db
|
this.db
|
||||||
.selectFrom('spaceMembers')
|
.selectFrom('spaceMembers')
|
||||||
.innerJoin('groupUsers', 'groupUsers.groupId', 'spaceMembers.groupId')
|
.innerJoin('groupUsers', 'groupUsers.groupId', 'spaceMembers.groupId')
|
||||||
.innerJoin('spaces', 'spaces.id', 'spaceMembers.spaceId')
|
.innerJoin('spaces', 'spaces.id', 'spaceMembers.spaceId')
|
||||||
.select(['spaces.id'])
|
.select('spaces.id')
|
||||||
.where('groupUsers.userId', '=', userId),
|
.where('groupUsers.userId', '=', userId),
|
||||||
)
|
);
|
||||||
.execute();
|
}
|
||||||
|
|
||||||
|
async getUserSpaceIds(userId: string): Promise<string[]> {
|
||||||
|
const membership = await this.getUserSpaceIdsQuery(userId).execute();
|
||||||
return membership.map((space) => space.id);
|
return membership.map((space) => space.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getUserSpaces(userId: string, pagination: PaginationOptions) {
|
async getUserSpaces(userId: string, pagination: PaginationOptions) {
|
||||||
const userSpaceIds = await this.getUserSpaceIds(userId);
|
|
||||||
|
|
||||||
let query = this.db
|
let query = this.db
|
||||||
.selectFrom('spaces')
|
.selectFrom('spaces')
|
||||||
.selectAll()
|
.selectAll()
|
||||||
.select((eb) => [this.spaceRepo.withMemberCount(eb)])
|
.select((eb) => [this.spaceRepo.withMemberCount(eb)])
|
||||||
//.where('workspaceId', '=', workspaceId)
|
.where('id', 'in', this.getUserSpaceIdsQuery(userId))
|
||||||
.where('id', 'in', userSpaceIds)
|
|
||||||
.orderBy('createdAt', 'asc');
|
.orderBy('createdAt', 'asc');
|
||||||
|
|
||||||
if (pagination.query) {
|
if (pagination.query) {
|
||||||
@@ -253,14 +252,9 @@ export class SpaceMemberRepo {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasEmptyIds = userSpaceIds.length === 0;
|
return executeWithPagination(query, {
|
||||||
|
|
||||||
const result = executeWithPagination(query, {
|
|
||||||
page: pagination.page,
|
page: pagination.page,
|
||||||
perPage: pagination.limit,
|
perPage: pagination.limit,
|
||||||
hasEmptyIds,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user