Compare commits

..

3 Commits

Author SHA1 Message Date
Philipinho 268001ae26 v0.10.1 2025-04-11 13:23:42 +01:00
Philip Okugbe 27fa45a769 fix local attachment paths in exports (#1013) 2025-04-11 13:18:44 +01:00
Philipinho f9711918a3 fix comment editor padding 2025-04-11 12:32:54 +01:00
6 changed files with 26 additions and 15 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "client", "name": "client",
"private": true, "private": true,
"version": "0.10.0", "version": "0.10.1",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc && vite build", "build": "tsc && vite build",
@@ -19,8 +19,7 @@
box-shadow: 0 0 0 2px var(--mantine-color-blue-3); box-shadow: 0 0 0 2px var(--mantine-color-blue-3);
} }
.ProseMirror { .ProseMirror :global(.ProseMirror){
width: 100%;
max-width: 100%; max-width: 100%;
white-space: pre-wrap; white-space: pre-wrap;
word-break: break-word; word-break: break-word;
@@ -29,7 +28,6 @@
padding-right: 6px; padding-right: 6px;
margin-top: 2px; margin-top: 2px;
margin-bottom: 2px; margin-bottom: 2px;
font-size: 14px;
overflow: hidden auto; overflow: hidden auto;
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "server", "name": "server",
"version": "0.10.0", "version": "0.10.1",
"description": "", "description": "",
"author": "", "author": "",
"private": true, "private": true,
@@ -21,7 +21,7 @@ import {
getProsemirrorContent, getProsemirrorContent,
PageExportTree, PageExportTree,
replaceInternalLinks, replaceInternalLinks,
updateAttachmentUrls, updateAttachmentUrlsToLocalPaths,
} from './utils'; } from './utils';
import { PageRepo } from '@docmost/db/repos/page/page.repo'; import { PageRepo } from '@docmost/db/repos/page/page.repo';
import { Node } from '@tiptap/pm/model'; import { Node } from '@tiptap/pm/model';
@@ -193,7 +193,7 @@ export class ExportService {
if (includeAttachments) { if (includeAttachments) {
await this.zipAttachments(updatedJsonContent, page.spaceId, folder); await this.zipAttachments(updatedJsonContent, page.spaceId, folder);
updatedJsonContent = updateAttachmentUrls(updatedJsonContent); updatedJsonContent = updateAttachmentUrlsToLocalPaths(updatedJsonContent);
} }
const pageTitle = getPageTitle(page.title); const pageTitle = getPageTitle(page.title);
+20 -7
View File
@@ -62,17 +62,30 @@ export function isAttachmentNode(nodeType: string) {
return attachmentNodeTypes.includes(nodeType); return attachmentNodeTypes.includes(nodeType);
} }
export function updateAttachmentUrls(prosemirrorJson: any) { export function updateAttachmentUrlsToLocalPaths(prosemirrorJson: any) {
const doc = jsonToNode(prosemirrorJson); const doc = jsonToNode(prosemirrorJson);
if (!doc) return null;
// Helper function to replace specific URL prefixes
const replacePrefix = (url: string): string => {
const prefixes = ['/files', '/api/files'];
for (const prefix of prefixes) {
if (url.startsWith(prefix)) {
return url.replace(prefix, 'files');
}
}
return url;
};
doc?.descendants((node: Node) => { doc?.descendants((node: Node) => {
if (isAttachmentNode(node.type.name)) { if (isAttachmentNode(node.type.name)) {
if (node.attrs.src && node.attrs.src.startsWith('/files')) { if (node.attrs.src) {
//@ts-expect-error // @ts-ignore
node.attrs.src = node.attrs.src.replace('/files', 'files'); node.attrs.src = replacePrefix(node.attrs.src);
} else if (node.attrs.url && node.attrs.url.startsWith('/files')) { }
//@ts-expect-error if (node.attrs.url) {
node.attrs.url = node.attrs.url.replace('/files', 'files'); // @ts-ignore
node.attrs.url = replacePrefix(node.attrs.url);
} }
} }
}); });
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "docmost", "name": "docmost",
"homepage": "https://docmost.com", "homepage": "https://docmost.com",
"version": "0.10.0", "version": "0.10.1",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "nx run-many -t build", "build": "nx run-many -t build",