mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
changes withou consider zlib
This commit is contained in:
parent
a89f353f5b
commit
a8b9295067
2 changed files with 23 additions and 18 deletions
|
@ -77,19 +77,20 @@ export const encodePngMetadata = async ({
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
let metadataChunk;
|
let metadataChunk: TEXtChunk | ITXtChunk;
|
||||||
try {
|
try {
|
||||||
if (useITXt) {
|
if (useITXt) {
|
||||||
metadataChunk = iTXt.encodeSync(
|
metadataChunk = {
|
||||||
MIME_TYPES.excalidraw,
|
name: "iTXt",
|
||||||
encodedData,
|
data: iTXt.encodeSync({
|
||||||
{
|
keyword: MIME_TYPES.excalidraw,
|
||||||
compressed: true,
|
text: encodedData,
|
||||||
compressedMethod: 0,
|
compressionFlag: true,
|
||||||
language: "en",
|
compressionMethod: 0,
|
||||||
translated: ""
|
languageTag: "en",
|
||||||
}
|
translatedKeyword: ""
|
||||||
);
|
})
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Fallback to tEXt");
|
throw new Error("Fallback to tEXt");
|
||||||
}
|
}
|
||||||
|
|
14
packages/excalidraw/global.d.ts
vendored
14
packages/excalidraw/global.d.ts
vendored
|
@ -43,11 +43,15 @@ declare module "png-chunk-text" {
|
||||||
function decode(data: Uint8Array): { keyword: string; text: string };
|
function decode(data: Uint8Array): { keyword: string; text: string };
|
||||||
}
|
}
|
||||||
declare module "png-chunk-itxt" {
|
declare module "png-chunk-itxt" {
|
||||||
function encodeSync(
|
function encodeSync(options: {
|
||||||
keyword: string,
|
keyword: string;
|
||||||
text: string,
|
text: string;
|
||||||
options?: { compressed?: boolean; compressedMethod: number; language?: string; translated?: string },
|
compressionFlag?: boolean;
|
||||||
): { name: "iTXt"; data: Uint8Array };
|
compressionMethod?: number;
|
||||||
|
languageTag?: string;
|
||||||
|
translatedKeyword?: string;
|
||||||
|
}): Uint8Array;
|
||||||
|
|
||||||
function decodeSync(data: Uint8Array): {
|
function decodeSync(data: Uint8Array): {
|
||||||
keyword: string;
|
keyword: string;
|
||||||
text: string;
|
text: string;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue