mirror of
https://github.com/docmost/docmost.git
synced 2025-11-18 09:21:09 +10:00
Merge branch 'main' into feat/sharing
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "client",
|
"name": "client",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.10.0",
|
"version": "0.10.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
|
|||||||
@ -35,6 +35,12 @@ export default function AppVersion() {
|
|||||||
position="middle-end"
|
position="middle-end"
|
||||||
style={{ cursor: "pointer" }}
|
style={{ cursor: "pointer" }}
|
||||||
disabled={!hasUpdate}
|
disabled={!hasUpdate}
|
||||||
|
onClick={() => {
|
||||||
|
window.open(
|
||||||
|
"https://github.com/docmost/docmost/releases",
|
||||||
|
"_blank",
|
||||||
|
);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|||||||
@ -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,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "server",
|
"name": "server",
|
||||||
"version": "0.10.0",
|
"version": "0.10.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "",
|
"author": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import {
|
|||||||
getPageTitle,
|
getPageTitle,
|
||||||
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';
|
||||||
@ -200,7 +200,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);
|
||||||
|
|||||||
@ -26,17 +26,30 @@ export function getPageTitle(title: string) {
|
|||||||
return title ? title : 'untitled';
|
return title ? title : 'untitled';
|
||||||
}
|
}
|
||||||
|
|
||||||
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,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "docmost",
|
"name": "docmost",
|
||||||
"homepage": "https://docmost.com",
|
"homepage": "https://docmost.com",
|
||||||
"version": "0.10.0",
|
"version": "0.10.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "nx run-many -t build",
|
"build": "nx run-many -t build",
|
||||||
|
|||||||
Reference in New Issue
Block a user