From 089359eb83083558e43f1d63385feaec2fac09df Mon Sep 17 00:00:00 2001 From: Aliaksei Hrynko Date: Sun, 21 Jan 2024 15:43:54 +0100 Subject: [PATCH] Export rotation styles for annotation and text layers --- vite.config.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 89a3d6d..ebc7920 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -27,18 +27,23 @@ export default defineConfig({ copy({ hook: 'writeBundle', targets: Object.entries({ - textLayer: [0, 116], - annotationLayer: [118, 486], - }).map(([key, [start, end]]) => ({ + textLayer: [ + [0, 116], + [1835, 1845], + ], + annotationLayer: [ + [118, 486], + [1835, 1845], + ], + }).map(([key, ranges]) => ({ src: 'node_modules/pdfjs-dist/web/pdf_viewer.css', dest: 'dist/style', rename: `${key}.css`, transform: (contents) => { - const css = contents - .toString() - .split('\n') - .slice(start, end) - .join('\n') + const lines = contents.toString().split('\n') + const css = ranges.reduce((acc, [start, end]) => { + return acc + lines.slice(start, end).join('\n') + }, '') return new CleanCSS().minify(css).styles + '\n' }, })),