mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-21 04:01:03 +10:00
feat: excalidraw integration (#214)
* update tiptap version * excalidraw init * cleanup * better file handling and other fixes * use different modal to fix excalidraw cursor position issue * see https://github.com/excalidraw/excalidraw/issues/7312 * fix websocket in vite dev mode * WIP * add align attribute * fix table * menu icons * Render image in excalidraw html * add size to custom SVG components * rewrite undefined font urls
This commit is contained in:
@ -5,11 +5,11 @@ declare global {
|
||||
}
|
||||
|
||||
export function getAppUrl(): string {
|
||||
let appUrl = window.CONFIG?.APP_URL || process.env.APP_URL;
|
||||
//let appUrl = window.CONFIG?.APP_URL || process.env.APP_URL;
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
return appUrl || "http://localhost:3000";
|
||||
}
|
||||
// if (import.meta.env.DEV) {
|
||||
// return appUrl || "http://localhost:3000";
|
||||
//}
|
||||
|
||||
return `${window.location.protocol}//${window.location.host}`;
|
||||
}
|
||||
@ -20,9 +20,10 @@ export function getBackendUrl(): string {
|
||||
|
||||
export function getCollaborationUrl(): string {
|
||||
const COLLAB_PATH = "/collab";
|
||||
const url = process.env.APP_URL || getAppUrl();
|
||||
|
||||
const wsProtocol = getAppUrl().startsWith("https") ? "wss" : "ws";
|
||||
return `${wsProtocol}://${getAppUrl().split("://")[1]}${COLLAB_PATH}`;
|
||||
const wsProtocol = url.startsWith("https") ? "wss" : "ws";
|
||||
return `${wsProtocol}://${url.split("://")[1]}${COLLAB_PATH}`;
|
||||
}
|
||||
|
||||
export function getAvatarUrl(avatarUrl: string) {
|
||||
|
||||
@ -44,3 +44,11 @@ export const formatBytes = (
|
||||
|
||||
return `${adjustedSize.toFixed(precision)} ${units[adjustedUnitIndex]}`;
|
||||
};
|
||||
|
||||
export async function svgStringToFile(
|
||||
svgString: string,
|
||||
fileName: string,
|
||||
): Promise<File> {
|
||||
const blob = new Blob([svgString], { type: "image/svg+xml" });
|
||||
return new File([blob], fileName, { type: "image/svg+xml" });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user