@sequent-org/moodboard 1.2.116 → 1.2.117
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/tools/ToolManager.js +54 -0
package/package.json
CHANGED
package/src/tools/ToolManager.js
CHANGED
|
@@ -484,6 +484,60 @@ export class ToolManager {
|
|
|
484
484
|
return;
|
|
485
485
|
}
|
|
486
486
|
|
|
487
|
+
const nonImageFiles = files.filter(f => !f.type || !f.type.startsWith('image/'));
|
|
488
|
+
if (nonImageFiles.length > 0) {
|
|
489
|
+
let index = 0;
|
|
490
|
+
for (const file of nonImageFiles) {
|
|
491
|
+
const offset = 25 * index++;
|
|
492
|
+
const position = { x: x + offset, y: y + offset };
|
|
493
|
+
const fallbackProps = {
|
|
494
|
+
fileName: file.name || 'file',
|
|
495
|
+
fileSize: file.size || 0,
|
|
496
|
+
mimeType: file.type || 'application/octet-stream',
|
|
497
|
+
formattedSize: null,
|
|
498
|
+
url: null,
|
|
499
|
+
width: 120,
|
|
500
|
+
height: 140
|
|
501
|
+
};
|
|
502
|
+
try {
|
|
503
|
+
if (this.core && this.core.fileUploadService) {
|
|
504
|
+
const uploadResult = await this.core.fileUploadService.uploadFile(file, file.name || 'file');
|
|
505
|
+
this.eventBus.emit(Events.UI.ToolbarAction, {
|
|
506
|
+
type: 'file',
|
|
507
|
+
id: 'file',
|
|
508
|
+
position,
|
|
509
|
+
properties: {
|
|
510
|
+
fileName: uploadResult.name,
|
|
511
|
+
fileSize: uploadResult.size,
|
|
512
|
+
mimeType: uploadResult.mimeType,
|
|
513
|
+
formattedSize: uploadResult.formattedSize,
|
|
514
|
+
url: uploadResult.url,
|
|
515
|
+
width: 120,
|
|
516
|
+
height: 140
|
|
517
|
+
},
|
|
518
|
+
fileId: uploadResult.fileId || uploadResult.id || null
|
|
519
|
+
});
|
|
520
|
+
} else {
|
|
521
|
+
this.eventBus.emit(Events.UI.ToolbarAction, {
|
|
522
|
+
type: 'file',
|
|
523
|
+
id: 'file',
|
|
524
|
+
position,
|
|
525
|
+
properties: fallbackProps
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
} catch (error) {
|
|
529
|
+
console.warn('Ошибка загрузки файла через drag-and-drop:', error);
|
|
530
|
+
this.eventBus.emit(Events.UI.ToolbarAction, {
|
|
531
|
+
type: 'file',
|
|
532
|
+
id: 'file',
|
|
533
|
+
position,
|
|
534
|
+
properties: fallbackProps
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
|
|
487
541
|
// 2) Перетаскивание с другой вкладки: HTML/URI/PLAIN
|
|
488
542
|
const html = dt.getData('text/html');
|
|
489
543
|
if (html && html.includes('<img')) {
|