Compare commits

...

2 Commits

Author SHA1 Message Date
Anthony LC
5ae5a3dfa3 🔖(minor) release 2.5.0
Added:
- 📝(doc) Added GNU Make link to README
- (frontend) add pinning on doc detail
- 🚩(frontend) feature flag analytic on copy as html
- (frontend) Custom block divider with export
- 🌐(i18n) activate dutch language

Changed:
- 🧑‍💻(frontend) change literal section open source
- ♻️(frontend) replace cors proxy for export
- 🚨(gitlint) Allow uppercase in commit messages

Fixed:
- 🐛(frontend) SVG export
- 🐛(frontend) remove scroll listener table content
- 🔒️(back) restrict access to favorite_list endpoint
- 🐛(backend) refactor to fix filtering on children
    and descendants views
- 🐛(action) fix notify-argocd workflow
- 🚨(helm) fix helmfile lint
- 🚚(frontend) redirect to 401 page when 401 error
2025-03-19 13:11:40 +01:00
Anthony LC
c2e7cea0a1 🐛(frontend) improve svg export to be less pixelized
Some SVGs were pixelized in the exported files.
We now add the wanted size to the svg conversion to
make sure the images are exported with the correct size
and so less pixelized.
2025-03-19 13:11:40 +01:00
14 changed files with 51 additions and 18 deletions

View File

@@ -8,6 +8,8 @@ and this project adheres to
## [Unreleased]
## [2.5.0] - 2025-03-18
## Added
- 📝(doc) Added GNU Make link to README #750
@@ -15,12 +17,15 @@ and this project adheres to
- 🚩(frontend) feature flag analytic on copy as html #649
- ✨(frontend) Custom block divider with export #698
- 🌐(i18n) activate dutch language #742
- ✨(frontend) add Beautify action to AI transform #478
- ✨(frontend) add Emojify action to AI transform #478
## Changed
- 🧑‍💻(frontend) change literal section open source #702
- ♻️(frontend) replace cors proxy for export #695
- 🚨(gitlint) Allow uppercase in commit messages #756
- ♻️(frontend) Improve AI translations #478
## Fixed
@@ -39,13 +44,10 @@ and this project adheres to
## Added
- ✨(frontend) synchronize language-choice #401
- ✨(frontend) add Beautify action to AI transform #478
- ✨(frontend) add Emojify action to AI transform #478
## Changed
- Use sentry tags instead of extra scope
- ♻️(frontend) Improve AI translations #478
## Fixed
@@ -466,7 +468,9 @@ and this project adheres to
- ✨(frontend) Coming Soon page (#67)
- 🚀 Impress, project to manage your documents easily and collaboratively.
[unreleased]: https://github.com/numerique-gouv/impress/compare/v2.3.0...main
[unreleased]: https://github.com/numerique-gouv/impress/compare/v2.5.0...main
[v2.5.0]: https://github.com/numerique-gouv/impress/releases/v2.5.0
[v2.4.0]: https://github.com/numerique-gouv/impress/releases/v2.4.0
[v2.3.0]: https://github.com/numerique-gouv/impress/releases/v2.3.0
[v2.2.0]: https://github.com/numerique-gouv/impress/releases/v2.2.0
[v2.1.0]: https://github.com/numerique-gouv/impress/releases/v2.1.0

View File

@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "impress"
version = "2.4.0"
version = "2.5.0"
authors = [{ "name" = "DINUM", "email" = "dev@mail.numerique.gouv.fr" }]
classifiers = [
"Development Status :: 5 - Production/Stable",

View File

@@ -1,6 +1,6 @@
{
"name": "app-e2e",
"version": "2.4.0",
"version": "2.5.0",
"private": true,
"scripts": {
"lint": "eslint . --ext .ts",

View File

@@ -1,6 +1,6 @@
{
"name": "app-impress",
"version": "2.4.0",
"version": "2.5.0",
"private": true,
"scripts": {
"dev": "next dev",

View File

@@ -22,9 +22,13 @@ export const blockMappingImageDocx: DocsExporterDocx['mappings']['blockMapping']
let pngConverted: string | undefined;
let dimensions: { width: number; height: number } | undefined;
if (!blob.type.includes('image')) {
return [];
}
if (blob.type.includes('svg')) {
const svgText = await blob.text();
pngConverted = await convertSvgToPng(svgText);
pngConverted = await convertSvgToPng(svgText, block.props.previewWidth);
const img = new Image();
img.src = pngConverted;
await new Promise((resolve) => {

View File

@@ -13,9 +13,13 @@ export const blockMappingImagePDF: DocsExporterPDF['mappings']['blockMapping']['
const blob = await exporter.resolveFile(block.props.url);
let pngConverted: string | undefined;
if (!blob.type.includes('image')) {
return <View wrap={false} />;
}
if (blob.type.includes('svg')) {
const svgText = await blob.text();
pngConverted = await convertSvgToPng(svgText);
pngConverted = await convertSvgToPng(svgText, block.props.previewWidth);
}
return (

View File

@@ -23,16 +23,37 @@ export function downloadFile(blob: Blob, filename: string) {
* @param svgText - The SVG text to convert
* @returns The PNG data URL
*/
export async function convertSvgToPng(svgText: string) {
export async function convertSvgToPng(svgText: string, width: number) {
// Create a canvas and render the SVG onto it
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const ctx = canvas.getContext('2d', {
alpha: true,
});
if (!ctx) {
throw new Error('Canvas context is null');
}
// Parse SVG to get original dimensions
const parser = new DOMParser();
const svgDoc = parser.parseFromString(svgText, 'image/svg+xml');
const svgElement = svgDoc.documentElement;
// Get viewBox or fallback to width/height attributes
let height;
const svgWidth = svgElement.getAttribute?.('width');
const svgHeight = svgElement.getAttribute?.('height');
const viewBox = svgElement.getAttribute('viewBox')?.split(' ').map(Number);
const originalWidth = svgWidth ? parseInt(svgWidth) : viewBox?.[2];
const originalHeight = svgHeight ? parseInt(svgHeight) : viewBox?.[3];
if (originalWidth && originalHeight) {
const aspectRatio = originalHeight / originalWidth;
height = Math.round(width * aspectRatio);
}
const svg = Canvg.fromString(ctx, svgText);
svg.resize(width, height, true);
await svg.render();
return canvas.toDataURL('image/png');

View File

@@ -1,6 +1,6 @@
{
"name": "impress",
"version": "2.4.0",
"version": "2.5.0",
"private": true,
"workspaces": {
"packages": [

View File

@@ -1,6 +1,6 @@
{
"name": "eslint-config-impress",
"version": "2.4.0",
"version": "2.5.0",
"license": "MIT",
"scripts": {
"lint": "eslint --ext .js ."

View File

@@ -1,6 +1,6 @@
{
"name": "packages-i18n",
"version": "2.4.0",
"version": "2.5.0",
"private": true,
"scripts": {
"extract-translation": "yarn extract-translation:impress",

View File

@@ -1,6 +1,6 @@
{
"name": "server-y-provider",
"version": "2.4.0",
"version": "2.5.0",
"description": "Y.js provider for docs",
"repository": "https://github.com/numerique-gouv/impress",
"license": "MIT",

View File

@@ -1,7 +1,7 @@
environments:
dev:
values:
- version: 2.4.0
- version: 2.5.0
---
repositories:
- name: bitnami

View File

@@ -1,5 +1,5 @@
apiVersion: v2
type: application
name: docs
version: 2.4.0
version: 2.5.0
appVersion: latest

View File

@@ -1,6 +1,6 @@
{
"name": "mail_mjml",
"version": "2.4.0",
"version": "2.5.0",
"description": "An util to generate html and text django's templates from mjml templates",
"type": "module",
"dependencies": {