@sequent-org/moodboard 1.2.27 → 1.2.28

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.27",
3
+ "version": "1.2.28",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -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();
@@ -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') {