Merge branch 'main' into feat/sharing

This commit is contained in:
Philipinho
2025-04-16 23:30:52 +01:00
7 changed files with 32 additions and 15 deletions

View File

@ -1,7 +1,7 @@
{
"name": "client",
"private": true,
"version": "0.10.0",
"version": "0.10.2",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",

View File

@ -35,6 +35,12 @@ export default function AppVersion() {
position="middle-end"
style={{ cursor: "pointer" }}
disabled={!hasUpdate}
onClick={() => {
window.open(
"https://github.com/docmost/docmost/releases",
"_blank",
);
}}
>
<Text
size="sm"

View File

@ -19,8 +19,7 @@
box-shadow: 0 0 0 2px var(--mantine-color-blue-3);
}
.ProseMirror {
width: 100%;
.ProseMirror :global(.ProseMirror){
max-width: 100%;
white-space: pre-wrap;
word-break: break-word;
@ -29,7 +28,6 @@
padding-right: 6px;
margin-top: 2px;
margin-bottom: 2px;
font-size: 14px;
overflow: hidden auto;
}

View File

@ -1,6 +1,6 @@
{
"name": "server",
"version": "0.10.0",
"version": "0.10.2",
"description": "",
"author": "",
"private": true,

View File

@ -19,7 +19,7 @@ import {
getPageTitle,
PageExportTree,
replaceInternalLinks,
updateAttachmentUrls,
updateAttachmentUrlsToLocalPaths,
} from './utils';
import { PageRepo } from '@docmost/db/repos/page/page.repo';
import { Node } from '@tiptap/pm/model';
@ -200,7 +200,7 @@ export class ExportService {
if (includeAttachments) {
await this.zipAttachments(updatedJsonContent, page.spaceId, folder);
updatedJsonContent = updateAttachmentUrls(updatedJsonContent);
updatedJsonContent = updateAttachmentUrlsToLocalPaths(updatedJsonContent);
}
const pageTitle = getPageTitle(page.title);

View File

@ -26,17 +26,30 @@ export function getPageTitle(title: string) {
return title ? title : 'untitled';
}
export function updateAttachmentUrls(prosemirrorJson: any) {
export function updateAttachmentUrlsToLocalPaths(prosemirrorJson: any) {
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) => {
if (isAttachmentNode(node.type.name)) {
if (node.attrs.src && node.attrs.src.startsWith('/files')) {
//@ts-expect-error
node.attrs.src = node.attrs.src.replace('/files', 'files');
} else if (node.attrs.url && node.attrs.url.startsWith('/files')) {
//@ts-expect-error
node.attrs.url = node.attrs.url.replace('/files', 'files');
if (node.attrs.src) {
// @ts-ignore
node.attrs.src = replacePrefix(node.attrs.src);
}
if (node.attrs.url) {
// @ts-ignore
node.attrs.url = replacePrefix(node.attrs.url);
}
}
});

View File

@ -1,7 +1,7 @@
{
"name": "docmost",
"homepage": "https://docmost.com",
"version": "0.10.0",
"version": "0.10.2",
"private": true,
"scripts": {
"build": "nx run-many -t build",