@sequent-org/moodboard 1.2.28 → 1.2.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequent-org/moodboard",
3
- "version": "1.2.28",
3
+ "version": "1.2.30",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -45,6 +45,22 @@ export class ApiClient {
45
45
  // Фильтруем объекты изображений и файлов - убираем избыточные данные
46
46
  const cleanedData = this._cleanObjectData(boardData);
47
47
 
48
+ // Диагностика размеров изображений перед отправкой
49
+ try {
50
+ const images = Array.isArray(cleanedData?.objects)
51
+ ? cleanedData.objects.filter(o => o && o.type === 'image')
52
+ : [];
53
+ images.forEach((o) => {
54
+ console.log('🧪 SAVE image size', {
55
+ id: o.id,
56
+ width: o.width,
57
+ height: o.height,
58
+ propWidth: o.properties?.width,
59
+ propHeight: o.properties?.height
60
+ });
61
+ });
62
+ } catch (_) {}
63
+
48
64
  const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
49
65
 
50
66
  const response = await fetch('/api/moodboard/save', {
@@ -157,6 +157,41 @@ export class SaveManager {
157
157
  data: saveData,
158
158
  timestamp: new Date().toISOString()
159
159
  });
160
+
161
+ // Диагностика: по флагу проверяем, что сервер отдает те же размеры на чтение
162
+ try {
163
+ if (typeof window !== 'undefined' && window.MOODBOARD_DEBUG_VERIFY_LOAD === true) {
164
+ const boardId = saveData?.id;
165
+ if (boardId) {
166
+ const verifyUrl = `${this.options.loadEndpoint}/${boardId}`;
167
+ const resp = await fetch(verifyUrl, {
168
+ method: 'GET',
169
+ headers: {
170
+ 'Accept': 'application/json',
171
+ 'X-Requested-With': 'XMLHttpRequest'
172
+ }
173
+ });
174
+ if (resp.ok) {
175
+ const result = await resp.json();
176
+ const data = result?.data || result;
177
+ const imgs = Array.isArray(data?.objects) ? data.objects.filter(o => o && o.type === 'image') : [];
178
+ imgs.forEach((o) => {
179
+ console.log('🧪 VERIFY LOAD after save image size', {
180
+ id: o.id,
181
+ width: o.width,
182
+ height: o.height,
183
+ propWidth: o.properties?.width,
184
+ propHeight: o.properties?.height
185
+ });
186
+ });
187
+ } else {
188
+ console.warn('⚠️ VERIFY LOAD failed:', resp.status, resp.statusText);
189
+ }
190
+ }
191
+ }
192
+ } catch (e) {
193
+ console.warn('⚠️ VERIFY LOAD exception:', e?.message || e);
194
+ }
160
195
  } else {
161
196
  throw new Error(response.message || 'Ошибка сохранения');
162
197
  }
@@ -31,6 +31,19 @@ export class DataManager {
31
31
 
32
32
  data.objects.forEach((objectData, index) => {
33
33
  try {
34
+ // Диагностика размеров изображений на загрузке до создания
35
+ if (objectData && objectData.type === 'image') {
36
+ try {
37
+ console.log('🧪 LOAD image size (before create)', {
38
+ id: objectData.id,
39
+ width: objectData.width,
40
+ height: objectData.height,
41
+ propWidth: objectData.properties?.width,
42
+ propHeight: objectData.properties?.height
43
+ });
44
+ } catch (_) {}
45
+ }
46
+
34
47
  // Используем полные данные объекта, включая ID
35
48
  const createdObject = this.coreMoodboard.createObjectFromData(objectData);
36
49
 
@@ -374,6 +374,21 @@ export class MoodBoard {
374
374
  }
375
375
 
376
376
  const boardData = await response.json();
377
+
378
+ // Диагностика: лог размеров изображений прямо из ответа API до любой обработки
379
+ try {
380
+ const objects = (boardData && boardData.data && Array.isArray(boardData.data.objects)) ? boardData.data.objects : [];
381
+ const images = objects.filter(o => o && o.type === 'image');
382
+ images.forEach((o) => {
383
+ console.log('🧪 API LOAD payload image size', {
384
+ id: o.id,
385
+ width: o.width,
386
+ height: o.height,
387
+ propWidth: o.properties?.width,
388
+ propHeight: o.properties?.height
389
+ });
390
+ });
391
+ } catch (_) {}
377
392
 
378
393
  if (boardData && boardData.data) {
379
394
  console.log('✅ MoodBoard: данные загружены с сервера', boardData.data);