mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-22 22:59:28 +01:00
feat: Dynamically load jspdf and html2canvas-pro to improve first-screen loading speed
This commit is contained in:
@@ -5,9 +5,6 @@
|
||||
|
||||
const { saveAs } = fileSaver;
|
||||
|
||||
import jsPDF from 'jspdf';
|
||||
import html2canvas from 'html2canvas-pro';
|
||||
|
||||
import dayjs from '$lib/dayjs';
|
||||
import duration from 'dayjs/plugin/duration';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
@@ -137,6 +134,11 @@
|
||||
|
||||
const downloadPdf = async (note) => {
|
||||
try {
|
||||
const [{ default: jsPDF }, { default: html2canvas }] = await Promise.all([
|
||||
import('jspdf'),
|
||||
import('html2canvas-pro')
|
||||
]);
|
||||
|
||||
// Define a fixed virtual screen size
|
||||
const virtualWidth = 1024; // Fixed width (adjust as needed)
|
||||
const virtualHeight = 1400; // Fixed height (adjust as needed)
|
||||
|
||||
Reference in New Issue
Block a user