mirror of
https://github.com/suitenumerique/docs.git
synced 2026-04-25 17:15:01 +02:00
Compare commits
2 Commits
fix/link-p
...
v2.5.0-pre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ae5a3dfa3 | ||
|
|
c2e7cea0a1 |
12
CHANGELOG.md
12
CHANGELOG.md
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "app-e2e",
|
||||
"version": "2.4.0",
|
||||
"version": "2.5.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"lint": "eslint . --ext .ts",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "app-impress",
|
||||
"version": "2.4.0",
|
||||
"version": "2.5.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "impress",
|
||||
"version": "2.4.0",
|
||||
"version": "2.5.0",
|
||||
"private": true,
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eslint-config-impress",
|
||||
"version": "2.4.0",
|
||||
"version": "2.5.0",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"lint": "eslint --ext .js ."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "packages-i18n",
|
||||
"version": "2.4.0",
|
||||
"version": "2.5.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"extract-translation": "yarn extract-translation:impress",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
environments:
|
||||
dev:
|
||||
values:
|
||||
- version: 2.4.0
|
||||
- version: 2.5.0
|
||||
---
|
||||
repositories:
|
||||
- name: bitnami
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
apiVersion: v2
|
||||
type: application
|
||||
name: docs
|
||||
version: 2.4.0
|
||||
version: 2.5.0
|
||||
appVersion: latest
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user