@sequent-org/moodboard 1.2.27 → 1.2.29
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
package/src/core/ApiClient.js
CHANGED
|
@@ -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', {
|
|
@@ -9,10 +9,18 @@ export class DataManager {
|
|
|
9
9
|
/**
|
|
10
10
|
* Загружает данные в MoodBoard
|
|
11
11
|
*/
|
|
12
|
-
loadData(data) {
|
|
12
|
+
async loadData(data) {
|
|
13
13
|
if (!data) return;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// Восстанавливаем отсутствующие URL изображений по imageId перед созданием объектов
|
|
16
|
+
try {
|
|
17
|
+
const apiClient = this.coreMoodboard?.apiClient;
|
|
18
|
+
if (apiClient && typeof apiClient.restoreObjectUrls === 'function') {
|
|
19
|
+
data = await apiClient.restoreObjectUrls(data);
|
|
20
|
+
}
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.warn('⚠️ Не удалось восстановить URL изображений по imageId:', e?.message || e);
|
|
23
|
+
}
|
|
16
24
|
|
|
17
25
|
// Очищаем доску перед загрузкой
|
|
18
26
|
this.clearBoard();
|
|
@@ -23,6 +31,19 @@ export class DataManager {
|
|
|
23
31
|
|
|
24
32
|
data.objects.forEach((objectData, index) => {
|
|
25
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
|
+
|
|
26
47
|
// Используем полные данные объекта, включая ID
|
|
27
48
|
const createdObject = this.coreMoodboard.createObjectFromData(objectData);
|
|
28
49
|
|
|
@@ -344,7 +344,7 @@ export class MoodBoard {
|
|
|
344
344
|
|
|
345
345
|
if (!boardId || !this.options.apiUrl) {
|
|
346
346
|
console.log('📦 MoodBoard: нет boardId или apiUrl, загружаем пустую доску');
|
|
347
|
-
this.dataManager.loadData(this.data || { objects: [] });
|
|
347
|
+
await this.dataManager.loadData(this.data || { objects: [] });
|
|
348
348
|
|
|
349
349
|
// Вызываем коллбек onLoad
|
|
350
350
|
if (typeof this.options.onLoad === 'function') {
|
|
@@ -377,7 +377,7 @@ export class MoodBoard {
|
|
|
377
377
|
|
|
378
378
|
if (boardData && boardData.data) {
|
|
379
379
|
console.log('✅ MoodBoard: данные загружены с сервера', boardData.data);
|
|
380
|
-
this.dataManager.loadData(boardData.data);
|
|
380
|
+
await this.dataManager.loadData(boardData.data);
|
|
381
381
|
|
|
382
382
|
// Вызываем коллбек onLoad
|
|
383
383
|
if (typeof this.options.onLoad === 'function') {
|
|
@@ -385,7 +385,7 @@ export class MoodBoard {
|
|
|
385
385
|
}
|
|
386
386
|
} else {
|
|
387
387
|
console.log('📦 MoodBoard: нет данных с сервера, загружаем пустую доску');
|
|
388
|
-
this.dataManager.loadData(this.data || { objects: [] });
|
|
388
|
+
await this.dataManager.loadData(this.data || { objects: [] });
|
|
389
389
|
|
|
390
390
|
// Вызываем коллбек onLoad
|
|
391
391
|
if (typeof this.options.onLoad === 'function') {
|