@sequent-org/moodboard 1.4.9 → 1.4.10
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 +1 -1
- package/src/core/ApiClient.js +0 -6
- package/src/core/index.js +0 -3
- package/src/moodboard/ActionHandler.js +17 -0
package/package.json
CHANGED
package/src/core/ApiClient.js
CHANGED
|
@@ -174,9 +174,6 @@ export class ApiClient {
|
|
|
174
174
|
cleanedObj.properties = { ...cleanedObj.properties };
|
|
175
175
|
delete cleanedObj.properties.src;
|
|
176
176
|
}
|
|
177
|
-
if ('imageId' in cleanedObj) {
|
|
178
|
-
delete cleanedObj.imageId;
|
|
179
|
-
}
|
|
180
177
|
return cleanedObj;
|
|
181
178
|
}
|
|
182
179
|
|
|
@@ -236,9 +233,6 @@ export class ApiClient {
|
|
|
236
233
|
restoredObj.properties = { ...restoredObj.properties };
|
|
237
234
|
delete restoredObj.properties.src;
|
|
238
235
|
}
|
|
239
|
-
if ('imageId' in restoredObj) {
|
|
240
|
-
delete restoredObj.imageId;
|
|
241
|
-
}
|
|
242
236
|
return restoredObj;
|
|
243
237
|
}
|
|
244
238
|
|
package/src/core/index.js
CHANGED
|
@@ -535,9 +535,6 @@ export class CoreMoodBoard {
|
|
|
535
535
|
objectData.properties = { ...objectData.properties };
|
|
536
536
|
delete objectData.properties.src;
|
|
537
537
|
}
|
|
538
|
-
if ('imageId' in objectData) {
|
|
539
|
-
delete objectData.imageId;
|
|
540
|
-
}
|
|
541
538
|
}
|
|
542
539
|
if (objectData.type === 'mindmap') {
|
|
543
540
|
logMindmapCompoundDebug('core:load-object', {
|
|
@@ -11,6 +11,8 @@ export class ActionHandler {
|
|
|
11
11
|
* Обрабатывает действия тулбара
|
|
12
12
|
*/
|
|
13
13
|
handleToolbarAction(action) {
|
|
14
|
+
this._assertImageActionContract(action);
|
|
15
|
+
|
|
14
16
|
switch (action.type) {
|
|
15
17
|
case 'frame':
|
|
16
18
|
case 'simple-text':
|
|
@@ -112,4 +114,19 @@ export class ActionHandler {
|
|
|
112
114
|
exportBoard() {
|
|
113
115
|
return this.handleExportBoard();
|
|
114
116
|
}
|
|
117
|
+
|
|
118
|
+
_assertImageActionContract(action) {
|
|
119
|
+
if (!action || (action.type !== 'image' && action.type !== 'revit-screenshot-img')) return;
|
|
120
|
+
const src = typeof action?.properties?.src === 'string' ? action.properties.src.trim() : '';
|
|
121
|
+
if (src) return;
|
|
122
|
+
|
|
123
|
+
const reason = 'в цепочке создания отсутствует обязательное поле properties.src';
|
|
124
|
+
const message = `Загрузить картинку не получилось: ${reason}. Попробуйте еще раз.`;
|
|
125
|
+
if (this.workspaceManager?.showNotification) {
|
|
126
|
+
this.workspaceManager.showNotification(message);
|
|
127
|
+
} else if (typeof alert === 'function') {
|
|
128
|
+
alert(message);
|
|
129
|
+
}
|
|
130
|
+
throw new Error(`Image action contract violated: ${reason}`);
|
|
131
|
+
}
|
|
115
132
|
}
|