@sequent-org/moodboard 1.0.1 → 1.0.3

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.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "axios": "^1.0.0",
31
- "pixi.js": ">=7.0.0"
31
+ "pixi.js": "^7.0.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@testing-library/dom": "^10.4.1",
@@ -85,6 +85,12 @@ export class MoodBoard {
85
85
  this.htmlTextLayer.attach();
86
86
  this.htmlHandlesLayer = new HtmlHandlesLayer(this.canvasContainer, this.coreMoodboard.eventBus, this.coreMoodboard);
87
87
  this.htmlHandlesLayer.attach();
88
+
89
+ // Устанавливаем глобальные свойства для доступа к слоям
90
+ if (typeof window !== 'undefined') {
91
+ window.moodboardHtmlTextLayer = this.htmlTextLayer;
92
+ window.moodboardHtmlHandlesLayer = this.htmlHandlesLayer;
93
+ }
88
94
  // Поповер для комментариев
89
95
  this.commentPopover = new CommentPopover(this.canvasContainer, this.coreMoodboard.eventBus, this.coreMoodboard);
90
96
  this.commentPopover.attach();
@@ -95,8 +95,8 @@ export class TextObject {
95
95
  // Эмитим событие для скрытия текста
96
96
  if (this.rect && this.rect._mb && this.rect._mb.objectId) {
97
97
  // Используем EventBus через core, если доступен
98
- if (window.moodboard && window.moodboard.eventBus) {
99
- window.moodboard.eventBus.emit('tool:hide:object:text', {
98
+ if (typeof window !== 'undefined' && window.moodboardEventBus) {
99
+ window.moodboardEventBus.emit('tool:hide:object:text', {
100
100
  objectId: this.rect._mb.objectId
101
101
  });
102
102
  }
@@ -112,8 +112,8 @@ export class TextObject {
112
112
  // Эмитим событие для показа текста
113
113
  if (this.rect && this.rect._mb && this.rect._mb.objectId) {
114
114
  // Используем EventBus через core, если доступен
115
- if (window.moodboard && window.moodboard.eventBus) {
116
- window.moodboard.eventBus.emit('tool:show:object:text', {
115
+ if (typeof window !== 'undefined' && window.moodboardEventBus) {
116
+ window.moodboardEventBus.emit('tool:show:object:text', {
117
117
  objectId: this.rect._mb.objectId
118
118
  });
119
119
  }
@@ -1727,8 +1727,8 @@ export class SelectTool extends BaseTool {
1727
1727
  // Скрываем статичный текст во время редактирования для всех типов объектов
1728
1728
  if (objectId) {
1729
1729
  // Проверяем, что HTML-элемент существует перед попыткой скрыть текст
1730
- if (window.moodboard && window.moodboard.htmlTextLayer) {
1731
- const el = window.moodboard.htmlTextLayer.idToEl.get(objectId);
1730
+ if (typeof window !== 'undefined' && window.moodboardHtmlTextLayer) {
1731
+ const el = window.moodboardHtmlTextLayer.idToEl.get(objectId);
1732
1732
  if (el) {
1733
1733
  this.eventBus.emit(Events.Tool.HideObjectText, { objectId });
1734
1734
  } else {
@@ -1787,8 +1787,8 @@ export class SelectTool extends BaseTool {
1787
1787
  // Показываем статичный текст после завершения редактирования для всех типов объектов
1788
1788
  if (objectId) {
1789
1789
  // Проверяем, что HTML-элемент существует перед попыткой показать текст
1790
- if (window.moodboard && window.moodboard.htmlTextLayer) {
1791
- const el = window.moodboard.htmlTextLayer.idToEl.get(objectId);
1790
+ if (typeof window !== 'undefined' && window.moodboardHtmlTextLayer) {
1791
+ const el = window.moodboardHtmlTextLayer.idToEl.get(objectId);
1792
1792
  if (el) {
1793
1793
  this.eventBus.emit(Events.Tool.ShowObjectText, { objectId });
1794
1794
  } else {
@@ -2119,8 +2119,8 @@ export class SelectTool extends BaseTool {
2119
2119
  // Показываем статичный текст после завершения редактирования для всех типов объектов
2120
2120
  if (objectId) {
2121
2121
  // Проверяем, что HTML-элемент существует перед попыткой показать текст
2122
- if (window.moodboard && window.moodboard.htmlTextLayer) {
2123
- const el = window.moodboard.htmlTextLayer.idToEl.get(objectId);
2122
+ if (typeof window !== 'undefined' && window.moodboardHtmlTextLayer) {
2123
+ const el = window.moodboardHtmlTextLayer.idToEl.get(objectId);
2124
2124
  if (el) {
2125
2125
  this.eventBus.emit(Events.Tool.ShowObjectText, { objectId });
2126
2126
  } else {