mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
renamed itxt function names
This commit is contained in:
parent
770f44019a
commit
6ee38ad826
2 changed files with 7 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
import tEXt from "png-chunk-text";
|
||||
import { encode as encodeITXt, decode as decodeITXt } from "png-chunk-itxt";
|
||||
import { encodeSync, decodeSync} from "png-chunk-itxt";
|
||||
import encodePng from "png-chunks-encode";
|
||||
import decodePng from "png-chunks-extract";
|
||||
|
||||
|
@ -28,7 +28,7 @@ export const getMetadataChunk = async (
|
|||
|
||||
if (iTXtChunk) {
|
||||
try {
|
||||
const decoded = decodeITXt(iTXtChunk.data);
|
||||
const decoded = decodeSync(iTXtChunk.data);
|
||||
console.log("Decoded iTXt chunk:", decoded);
|
||||
return {
|
||||
keyword: decoded.keyword,
|
||||
|
@ -67,7 +67,7 @@ export const encodePngMetadata = async ({
|
|||
!(chunk.name === "tEXt" &&
|
||||
tEXt.decode(chunk.data).keyword === MIME_TYPES.excalidraw) &&
|
||||
!(chunk.name === "iTXt" &&
|
||||
decodeITXt(chunk.data).keyword === MIME_TYPES.excalidraw)
|
||||
decodeSync(chunk.data).keyword === MIME_TYPES.excalidraw)
|
||||
);
|
||||
|
||||
const encodedData = JSON.stringify(
|
||||
|
@ -80,7 +80,7 @@ export const encodePngMetadata = async ({
|
|||
let metadataChunk;
|
||||
try {
|
||||
if (useITXt) {
|
||||
metadataChunk = encodeITXt(
|
||||
metadataChunk = encodeSync(
|
||||
MIME_TYPES.excalidraw,
|
||||
encodedData,
|
||||
{
|
||||
|
|
6
packages/excalidraw/global.d.ts
vendored
6
packages/excalidraw/global.d.ts
vendored
|
@ -43,12 +43,12 @@ declare module "png-chunk-text" {
|
|||
function decode(data: Uint8Array): { keyword: string; text: string };
|
||||
}
|
||||
declare module "png-chunk-itxt" {
|
||||
function encode(
|
||||
function encodeSync(
|
||||
keyword: string,
|
||||
text: string,
|
||||
options?: { compressed?: boolean; compressedMethod: number; language?: string; translated?: string },
|
||||
): { name: "iTXt"; data: Uint8Array };
|
||||
function decode(data: Uint8Array): {
|
||||
function decodeSync (data: Uint8Array): {
|
||||
keyword: string;
|
||||
text: string;
|
||||
compressed?: boolean;
|
||||
|
@ -56,7 +56,7 @@ declare module "png-chunk-itxt" {
|
|||
language?: string;
|
||||
translated?: string;
|
||||
};
|
||||
export { encode, decode };
|
||||
export { encodeSync, decodeSync };
|
||||
}
|
||||
declare module "png-chunks-encode" {
|
||||
function encode(chunks: (TEXtChunk | ITXtChunk)[]): Uint8Array;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue