@emailmaker/filemanager 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/themeProvider/ThemeProvider.d.ts +4 -2
- package/components/EmIcons/EmIcons.d.ts +2 -0
- package/components/FileManagerApp/FileManagerApp.d.ts +2 -2
- package/components/PixieEditor/{PixieEditorIframe.d.ts → PixieEditor.d.ts} +3 -3
- package/components/PixieEditor/index.d.ts +1 -1
- package/file-manager.css +629 -710
- package/file-manager.d.ts +21 -1
- package/file-manager.esm.js +85 -27104
- package/file-manager.esm.js.map +1 -1
- package/file-manager.js +1 -1
- package/file-manager.js.LICENSE.txt +87 -0
- package/hooks/useNotifications.d.ts +2 -2
- package/mockServiceWorker.js +1 -1
- package/package.json +1 -1
- package/types.d.ts +14 -28
- package/utils/jsonDataProvider.d.ts +10 -0
- package/utils/themeUtils.d.ts +4 -13
- package/pixie-editor.html +0 -187
|
@@ -19,6 +19,8 @@ See the Apache Version 2.0 License for specific language governing permissions
|
|
|
19
19
|
and limitations under the License.
|
|
20
20
|
***************************************************************************** */
|
|
21
21
|
|
|
22
|
+
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* @license
|
|
24
26
|
* Lodash <https://lodash.com/>
|
|
@@ -58,6 +60,16 @@ and limitations under the License.
|
|
|
58
60
|
* LICENSE file in the root directory of this source tree.
|
|
59
61
|
*/
|
|
60
62
|
|
|
63
|
+
/**
|
|
64
|
+
* @license React
|
|
65
|
+
* react-jsx-runtime.production.min.js
|
|
66
|
+
*
|
|
67
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the MIT license found in the
|
|
70
|
+
* LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/
|
|
72
|
+
|
|
61
73
|
/**
|
|
62
74
|
* @license React
|
|
63
75
|
* scheduler.production.js
|
|
@@ -68,6 +80,81 @@ and limitations under the License.
|
|
|
68
80
|
* LICENSE file in the root directory of this source tree.
|
|
69
81
|
*/
|
|
70
82
|
|
|
83
|
+
/**
|
|
84
|
+
* @license React
|
|
85
|
+
* use-sync-external-store-shim.production.min.js
|
|
86
|
+
*
|
|
87
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the MIT license found in the
|
|
90
|
+
* LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @license React
|
|
95
|
+
* use-sync-external-store-shim/with-selector.production.min.js
|
|
96
|
+
*
|
|
97
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the MIT license found in the
|
|
100
|
+
* LICENSE file in the root directory of this source tree.
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @remix-run/router v1.0.1
|
|
105
|
+
*
|
|
106
|
+
* Copyright (c) Remix Software Inc.
|
|
107
|
+
*
|
|
108
|
+
* This source code is licensed under the MIT license found in the
|
|
109
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
110
|
+
*
|
|
111
|
+
* @license MIT
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* React Router DOM v6.4.1
|
|
116
|
+
*
|
|
117
|
+
* Copyright (c) Remix Software Inc.
|
|
118
|
+
*
|
|
119
|
+
* This source code is licensed under the MIT license found in the
|
|
120
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
121
|
+
*
|
|
122
|
+
* @license MIT
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* React Router v6.4.1
|
|
127
|
+
*
|
|
128
|
+
* Copyright (c) Remix Software Inc.
|
|
129
|
+
*
|
|
130
|
+
* This source code is licensed under the MIT license found in the
|
|
131
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
132
|
+
*
|
|
133
|
+
* @license MIT
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* react-virtual
|
|
138
|
+
*
|
|
139
|
+
* Copyright (c) TanStack
|
|
140
|
+
*
|
|
141
|
+
* This source code is licensed under the MIT license found in the
|
|
142
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
143
|
+
*
|
|
144
|
+
* @license MIT
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* virtual-core
|
|
149
|
+
*
|
|
150
|
+
* Copyright (c) TanStack
|
|
151
|
+
*
|
|
152
|
+
* This source code is licensed under the MIT license found in the
|
|
153
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
154
|
+
*
|
|
155
|
+
* @license MIT
|
|
156
|
+
*/
|
|
157
|
+
|
|
71
158
|
/** */
|
|
72
159
|
|
|
73
160
|
/** */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const useNotifications: () => {
|
|
2
|
-
error: (args: import("antd").NotificationArgsProps) => void;
|
|
3
|
-
open: (args: import("antd").NotificationArgsProps) => void;
|
|
4
2
|
success: (args: import("antd").NotificationArgsProps) => void;
|
|
3
|
+
error: (args: import("antd").NotificationArgsProps) => void;
|
|
5
4
|
info: (args: import("antd").NotificationArgsProps) => void;
|
|
6
5
|
warning: (args: import("antd").NotificationArgsProps) => void;
|
|
6
|
+
open: (args: import("antd").NotificationArgsProps) => void;
|
|
7
7
|
destroy(key?: React.Key): void;
|
|
8
8
|
};
|
package/mockServiceWorker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const PACKAGE_VERSION="2.10.
|
|
1
|
+
const PACKAGE_VERSION="2.10.5",INTEGRITY_CHECKSUM="f5825c521429caf22a4dd13b66e243af",IS_MOCKED_RESPONSE=Symbol("isMockedResponse"),activeClientIds=new Set;async function handleRequest(e,t){const n=await resolveMainClient(e),s=e.request.clone(),i=await getResponse(e,n,t);if(n&&activeClientIds.has(n.id)){const e=await serializeRequest(s),a=i.clone();sendToClient(n,{type:"RESPONSE",payload:{isMockedResponse:IS_MOCKED_RESPONSE in i,request:{id:t,...e},response:{type:a.type,status:a.status,statusText:a.statusText,headers:Object.fromEntries(a.headers.entries()),body:a.body}}},a.body?[e.body,a.body]:[])}return i}async function resolveMainClient(e){const t=await self.clients.get(e.clientId);return activeClientIds.has(e.clientId)||"top-level"===t?.frameType?t:(await self.clients.matchAll({type:"window"})).filter(e=>"visible"===e.visibilityState).find(e=>activeClientIds.has(e.id))}async function getResponse(e,t,n){const s=e.request.clone();function i(){const e=new Headers(s.headers),t=e.get("accept");if(t){const n=t.split(",").map(e=>e.trim()).filter(e=>"msw/passthrough"!==e);n.length>0?e.set("accept",n.join(", ")):e.delete("accept")}return fetch(s,{headers:e})}if(!t)return i();if(!activeClientIds.has(t.id))return i();const a=await serializeRequest(e.request),r=await sendToClient(t,{type:"REQUEST",payload:{id:n,...a}},[a.body]);switch(r.type){case"MOCK_RESPONSE":return respondWithMock(r.data);case"PASSTHROUGH":return i()}return i()}function sendToClient(e,t,n=[]){return new Promise((s,i)=>{const a=new MessageChannel;a.port1.onmessage=e=>{if(e.data&&e.data.error)return i(e.data.error);s(e.data)},e.postMessage(t,[a.port2,...n.filter(Boolean)])})}function respondWithMock(e){if(0===e.status)return Response.error();const t=new Response(e.body,e);return Reflect.defineProperty(t,IS_MOCKED_RESPONSE,{value:!0,enumerable:!0}),t}async function serializeRequest(e){return{url:e.url,mode:e.mode,method:e.method,headers:Object.fromEntries(e.headers.entries()),cache:e.cache,credentials:e.credentials,destination:e.destination,integrity:e.integrity,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,body:await e.arrayBuffer(),keepalive:e.keepalive}}addEventListener("install",function(){self.skipWaiting()}),addEventListener("activate",function(e){e.waitUntil(self.clients.claim())}),addEventListener("message",async function(e){const t=Reflect.get(e.source||{},"id");if(!t||!self.clients)return;const n=await self.clients.get(t);if(!n)return;const s=await self.clients.matchAll({type:"window"});switch(e.data){case"KEEPALIVE_REQUEST":sendToClient(n,{type:"KEEPALIVE_RESPONSE"});break;case"INTEGRITY_CHECK_REQUEST":sendToClient(n,{type:"INTEGRITY_CHECK_RESPONSE",payload:{packageVersion:"2.10.5",checksum:INTEGRITY_CHECKSUM}});break;case"MOCK_ACTIVATE":activeClientIds.add(t),sendToClient(n,{type:"MOCKING_ENABLED",payload:{client:{id:n.id,frameType:n.frameType}}});break;case"MOCK_DEACTIVATE":activeClientIds.delete(t);break;case"CLIENT_CLOSED":{activeClientIds.delete(t);const e=s.filter(e=>e.id!==t);0===e.length&&self.registration.unregister();break}}}),addEventListener("fetch",function(e){if("navigate"===e.request.mode)return;if("only-if-cached"===e.request.cache&&"same-origin"!==e.request.mode)return;if(0===activeClientIds.size)return;const t=crypto.randomUUID();e.respondWith(handleRequest(e,t))});
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -142,6 +142,7 @@ export interface FileManagerDataProviders {
|
|
|
142
142
|
name: string;
|
|
143
143
|
parentId?: string | null;
|
|
144
144
|
}) => Promise<Folder>;
|
|
145
|
+
renameFolder?: (folderId: string, newName: string) => Promise<Folder>;
|
|
145
146
|
deleteFolder?: (folderId: string) => Promise<boolean>;
|
|
146
147
|
uploadFile: (file: {
|
|
147
148
|
name: string;
|
|
@@ -166,6 +167,15 @@ export interface FileManagerDataProviders {
|
|
|
166
167
|
targetFolderId: string;
|
|
167
168
|
isFolder: boolean;
|
|
168
169
|
}) => Promise<boolean>;
|
|
170
|
+
updateFile?: (fileId: string, updates: {
|
|
171
|
+
name?: string;
|
|
172
|
+
type?: string;
|
|
173
|
+
data?: Blob | string;
|
|
174
|
+
thumbnail?: string;
|
|
175
|
+
dimensions?: string;
|
|
176
|
+
aspectRatio?: string;
|
|
177
|
+
extension?: string;
|
|
178
|
+
}) => Promise<File>;
|
|
169
179
|
}
|
|
170
180
|
export interface FileManagerHookReturn {
|
|
171
181
|
folders: Folder[];
|
|
@@ -226,6 +236,9 @@ interface Limits {
|
|
|
226
236
|
ai_img_limit?: number;
|
|
227
237
|
ai_generator_limit?: number;
|
|
228
238
|
}
|
|
239
|
+
export type CustomTheme = Partial<import('antd/es/theme/interface').AliasToken> & {
|
|
240
|
+
[key: string]: string | number | boolean | undefined;
|
|
241
|
+
};
|
|
229
242
|
export interface Config {
|
|
230
243
|
theme?: 'light' | 'dark';
|
|
231
244
|
disableMockServer?: boolean;
|
|
@@ -242,33 +255,7 @@ export interface Config {
|
|
|
242
255
|
files?: File[];
|
|
243
256
|
folders?: Folder[];
|
|
244
257
|
};
|
|
245
|
-
customTheme?:
|
|
246
|
-
colors?: {
|
|
247
|
-
primary?: string;
|
|
248
|
-
secondary?: string;
|
|
249
|
-
success?: string;
|
|
250
|
-
warning?: string;
|
|
251
|
-
error?: string;
|
|
252
|
-
info?: string;
|
|
253
|
-
textPrimary?: string;
|
|
254
|
-
textSecondary?: string;
|
|
255
|
-
textTertiary?: string;
|
|
256
|
-
bgPrimary?: string;
|
|
257
|
-
bgSecondary?: string;
|
|
258
|
-
bgTertiary?: string;
|
|
259
|
-
borderPrimary?: string;
|
|
260
|
-
borderSecondary?: string;
|
|
261
|
-
};
|
|
262
|
-
borderRadius?: {
|
|
263
|
-
none?: string;
|
|
264
|
-
xs?: string;
|
|
265
|
-
sm?: string;
|
|
266
|
-
md?: string;
|
|
267
|
-
lg?: string;
|
|
268
|
-
xl?: string;
|
|
269
|
-
full?: string;
|
|
270
|
-
};
|
|
271
|
-
};
|
|
258
|
+
customTheme?: CustomTheme;
|
|
272
259
|
UNSPLASH_KEY?: string;
|
|
273
260
|
APP_NAME_UNSPLASH?: string;
|
|
274
261
|
pushToGTM?: boolean;
|
|
@@ -290,7 +277,6 @@ export interface Config {
|
|
|
290
277
|
handleLimitUsageEmitter?: {
|
|
291
278
|
fire: (args: object) => void;
|
|
292
279
|
};
|
|
293
|
-
token?: Partial<import('antd/es/theme/interface').AliasToken>;
|
|
294
280
|
}
|
|
295
281
|
export type LibraryMenuKey = typeof MY_FILES | typeof GIF | typeof STOCK_IMAGES | typeof AI | typeof EDITOR;
|
|
296
282
|
export interface GifItem {
|
|
@@ -25,6 +25,7 @@ export declare class JSONDataProvider implements FileManagerDataProviders {
|
|
|
25
25
|
name: string;
|
|
26
26
|
parentId?: string | null;
|
|
27
27
|
}) => Promise<Folder>;
|
|
28
|
+
renameFolder: (folderId: string, newName: string) => Promise<Folder>;
|
|
28
29
|
deleteFolder: (folderId: string) => Promise<boolean>;
|
|
29
30
|
uploadFile: (file: {
|
|
30
31
|
name: string;
|
|
@@ -42,6 +43,15 @@ export declare class JSONDataProvider implements FileManagerDataProviders {
|
|
|
42
43
|
folderId?: string | null;
|
|
43
44
|
noFolder?: boolean;
|
|
44
45
|
}) => Promise<File>;
|
|
46
|
+
updateFile: (fileId: string, updates: {
|
|
47
|
+
name?: string;
|
|
48
|
+
type?: string;
|
|
49
|
+
data?: Blob | string;
|
|
50
|
+
thumbnail?: string;
|
|
51
|
+
dimensions?: string;
|
|
52
|
+
aspectRatio?: string;
|
|
53
|
+
extension?: string;
|
|
54
|
+
}) => Promise<File>;
|
|
45
55
|
deleteFile: (fileId: string) => Promise<boolean>;
|
|
46
56
|
renameFile: (fileId: string, newName: string) => Promise<File>;
|
|
47
57
|
moveItem: (options: {
|
package/utils/themeUtils.d.ts
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import { Config } from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
2
|
+
export declare const switchThemeVariables: (token?: {}) => void;
|
|
3
|
+
/** Применяет кастомную тему к CSS переменным */
|
|
5
4
|
export declare const applyCustomTheme: (config?: Config) => void;
|
|
6
|
-
/**
|
|
7
|
-
* Сбрасывает кастомную тему к значениям по умолчанию
|
|
8
|
-
*/
|
|
9
|
-
export declare const resetCustomTheme: () => void;
|
|
10
|
-
/**
|
|
11
|
-
* Устанавливает тему (светлая/темная)
|
|
12
|
-
*/
|
|
5
|
+
/** Устанавливает тему (светлая/темная) */
|
|
13
6
|
export declare const setTheme: (theme: "light" | "dark") => void;
|
|
14
|
-
/**
|
|
15
|
-
* Получает текущую тему
|
|
16
|
-
*/
|
|
7
|
+
/** Получает текущую тему */
|
|
17
8
|
export declare const getCurrentTheme: () => "light" | "dark";
|
package/pixie-editor.html
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="ru">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>Pixie Editor</title>
|
|
7
|
-
<style>
|
|
8
|
-
* {
|
|
9
|
-
margin: 0;
|
|
10
|
-
padding: 0;
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
body {
|
|
15
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
16
|
-
background: #f5f5f5;
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
#pixie-editor {
|
|
21
|
-
width: 100vw;
|
|
22
|
-
height: 100vh;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.loading {
|
|
26
|
-
position: fixed;
|
|
27
|
-
top: 50%;
|
|
28
|
-
left: 50%;
|
|
29
|
-
transform: translate(-50%, -50%);
|
|
30
|
-
background: white;
|
|
31
|
-
padding: 20px;
|
|
32
|
-
border-radius: 8px;
|
|
33
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
34
|
-
z-index: 1000;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.toolbar {
|
|
38
|
-
position: fixed;
|
|
39
|
-
bottom: 10px;
|
|
40
|
-
right: 10px;
|
|
41
|
-
z-index: 1001;
|
|
42
|
-
display: flex;
|
|
43
|
-
gap: 10px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.toolbar button {
|
|
47
|
-
padding: 8px 16px;
|
|
48
|
-
border: none;
|
|
49
|
-
border-radius: 4px;
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
font-size: 14px;
|
|
52
|
-
font-weight: 500;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.btn-save {
|
|
56
|
-
background: #1890ff;
|
|
57
|
-
color: white;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.btn-save:hover {
|
|
61
|
-
background: #40a9ff;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.btn-cancel {
|
|
65
|
-
background: #f5f5f5;
|
|
66
|
-
color: #595959;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.btn-cancel:hover {
|
|
70
|
-
background: #e6f7ff;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.btn-save:disabled {
|
|
74
|
-
background: #d9d9d9;
|
|
75
|
-
cursor: not-allowed;
|
|
76
|
-
}
|
|
77
|
-
</style>
|
|
78
|
-
</head>
|
|
79
|
-
<body>
|
|
80
|
-
<div id="loading" class="loading">
|
|
81
|
-
<div>Загрузка редактора...</div>
|
|
82
|
-
</div>
|
|
83
|
-
|
|
84
|
-
<div class="toolbar">
|
|
85
|
-
<button id="saveBtn" class="btn-save" disabled>Сохранить</button>
|
|
86
|
-
<button id="cancelBtn" class="btn-cancel">Отмена</button>
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<div id="pixie-editor"></div>
|
|
90
|
-
|
|
91
|
-
<script src="loacal_module/pixie/dist/pixie.umd.js"></script>
|
|
92
|
-
<script>
|
|
93
|
-
let pixieInstance = null;
|
|
94
|
-
let currentFile = null;
|
|
95
|
-
|
|
96
|
-
function initPixie(imageData, fileName) {
|
|
97
|
-
try {
|
|
98
|
-
console.log('Инициализация Pixie для файла:', fileName);
|
|
99
|
-
|
|
100
|
-
const config = {
|
|
101
|
-
selector: '#pixie-editor',
|
|
102
|
-
image: imageData,
|
|
103
|
-
baseUrl: "/loacal_module/pixie/assets",
|
|
104
|
-
ui: {
|
|
105
|
-
visible: true,
|
|
106
|
-
mode: 'inline',
|
|
107
|
-
toolbar: {
|
|
108
|
-
items: ['crop', 'resize', 'filter', 'draw', 'text', 'shapes', 'frame']
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
crossOrigin: true
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
if (window.Pixie) {
|
|
115
|
-
pixieInstance = new window.Pixie(config);
|
|
116
|
-
|
|
117
|
-
setTimeout(() => {
|
|
118
|
-
document.getElementById('loading').style.display = 'none';
|
|
119
|
-
document.getElementById('saveBtn').disabled = false;
|
|
120
|
-
console.log('Pixie успешно инициализирован');
|
|
121
|
-
}, 1000);
|
|
122
|
-
} else {
|
|
123
|
-
throw new Error('Pixie не загружен');
|
|
124
|
-
}
|
|
125
|
-
} catch (error) {
|
|
126
|
-
console.error('Ошибка инициализации Pixie:', error);
|
|
127
|
-
document.getElementById('loading').innerHTML = '<div>Ошибка загрузки: ' + error.message + '</div>';
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
document.getElementById('saveBtn').addEventListener('click', async () => {
|
|
131
|
-
if (!pixieInstance || !currentFile) return;
|
|
132
|
-
|
|
133
|
-
try {
|
|
134
|
-
document.getElementById('saveBtn').disabled = true;
|
|
135
|
-
document.getElementById('saveBtn').textContent = 'Сохранение...';
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const dataUrl = await pixieInstance.tools.export.getDataUrl("png", 0.9);
|
|
139
|
-
window.parent.postMessage({
|
|
140
|
-
type: 'PIXIE_SAVE',
|
|
141
|
-
data: {
|
|
142
|
-
file: currentFile,
|
|
143
|
-
imageData: dataUrl
|
|
144
|
-
}
|
|
145
|
-
}, '*');
|
|
146
|
-
|
|
147
|
-
} catch (error) {
|
|
148
|
-
console.error('Ошибка сохранения:', error);
|
|
149
|
-
alert('Ошибка при сохранении изображения');
|
|
150
|
-
document.getElementById('saveBtn').disabled = false;
|
|
151
|
-
document.getElementById('saveBtn').textContent = 'Сохранить';
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
document.getElementById('cancelBtn').addEventListener('click', () => {
|
|
156
|
-
window.parent.postMessage({
|
|
157
|
-
type: 'PIXIE_CANCEL'
|
|
158
|
-
}, '*');
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
window.addEventListener('message', (event) => {
|
|
162
|
-
if (event.data.type === 'INIT_PIXIE') {
|
|
163
|
-
currentFile = event.data.file;
|
|
164
|
-
const imageData = event.data.imageData;
|
|
165
|
-
initPixie(imageData, currentFile.name);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
window.addEventListener('load', () => {
|
|
170
|
-
window.parent.postMessage({
|
|
171
|
-
type: 'PIXIE_READY'
|
|
172
|
-
}, '*');
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
window.addEventListener('beforeunload', () => {
|
|
176
|
-
if (pixieInstance) {
|
|
177
|
-
try {
|
|
178
|
-
pixieInstance.close?.();
|
|
179
|
-
pixieInstance.destroy?.();
|
|
180
|
-
} catch (error) {
|
|
181
|
-
console.warn('Ошибка при закрытии Pixie:', error);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
</script>
|
|
186
|
-
</body>
|
|
187
|
-
</html>
|