@worktile/theia 3.0.10 → 3.0.13
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/bundles/worktile-theia.umd.js +14 -9
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/esm2015/plugins/image/image.component.js +13 -8
- package/fesm2015/worktile-theia.js +12 -7
- package/fesm2015/worktile-theia.js.map +1 -1
- package/package.json +1 -1
- package/plugins/image/image.component.d.ts +2 -1
|
@@ -3349,15 +3349,20 @@
|
|
|
3349
3349
|
_this.uploadingSubscription.unsubscribe();
|
|
3350
3350
|
_this.uploading = false;
|
|
3351
3351
|
_this.theContextService.removeUploadImage(_this.fileItem);
|
|
3352
|
-
_this.theContextService.uploadingStatus$.next(false);
|
|
3352
|
+
setTimeout(function () { return _this.theContextService.uploadingStatus$.next(false); }, 0);
|
|
3353
3353
|
}
|
|
3354
3354
|
_this.cdr.detectChanges();
|
|
3355
3355
|
});
|
|
3356
3356
|
};
|
|
3357
|
+
TheImageComponent.prototype.setImageNodes = function (imageInfo) {
|
|
3358
|
+
var _this = this;
|
|
3359
|
+
var path = i1.AngularEditor.findPath(this.editor, this.element);
|
|
3360
|
+
var data = Object.assign({ type: exports.ElementKinds.image, url: null }, imageInfo);
|
|
3361
|
+
slateHistory.HistoryEditor.withoutSaving(this.editor, function () { return slate.Transforms.setNodes(_this.editor, data, { at: path }); });
|
|
3362
|
+
};
|
|
3357
3363
|
TheImageComponent.prototype.uploadImage = function (file) {
|
|
3358
3364
|
return __awaiter(this, void 0, void 0, function () {
|
|
3359
|
-
var _b, width, height, _c, uploadFileEntity,
|
|
3360
|
-
var _this = this;
|
|
3365
|
+
var _b, width, height, _c, uploadFileEntity, thumbUrl, originUrl, imageInfo;
|
|
3361
3366
|
return __generator(this, function (_d) {
|
|
3362
3367
|
switch (_d.label) {
|
|
3363
3368
|
case 0: return [4 /*yield*/, this.resolveImageSize(file, this.theContextService.getOptions().width)];
|
|
@@ -3374,7 +3379,6 @@
|
|
|
3374
3379
|
return [4 /*yield*/, this.imageUploaderService.uploadFileHandle([file]).toPromise()];
|
|
3375
3380
|
case 2:
|
|
3376
3381
|
_c = __read.apply(void 0, [_d.sent(), 1]), uploadFileEntity = _c[0];
|
|
3377
|
-
path = i1.AngularEditor.findPath(this.editor, this.element);
|
|
3378
3382
|
thumbUrl = uploadFileEntity.thumbUrl, originUrl = uploadFileEntity.originUrl;
|
|
3379
3383
|
imageInfo = {
|
|
3380
3384
|
name: file.name,
|
|
@@ -3384,7 +3388,7 @@
|
|
|
3384
3388
|
originUrl: originUrl,
|
|
3385
3389
|
align: this.imageEntry.align || exports.Alignment.center
|
|
3386
3390
|
};
|
|
3387
|
-
|
|
3391
|
+
this.setImageNodes(imageInfo);
|
|
3388
3392
|
return [2 /*return*/];
|
|
3389
3393
|
}
|
|
3390
3394
|
});
|
|
@@ -3486,11 +3490,11 @@
|
|
|
3486
3490
|
};
|
|
3487
3491
|
TheImageComponent.prototype.preview = function ($event) {
|
|
3488
3492
|
var _this = this;
|
|
3489
|
-
if (this.readonly || this.isCollapsed) {
|
|
3493
|
+
if ((this.readonly || this.isCollapsed) && $event.button === 0) {
|
|
3490
3494
|
var images = getAllNodesByType(this.editor.children, exports.ElementKinds.image);
|
|
3491
3495
|
var previewImages = images.map(function (item) {
|
|
3492
3496
|
return {
|
|
3493
|
-
src: item.
|
|
3497
|
+
src: item.thumbUrl,
|
|
3494
3498
|
name: item.name,
|
|
3495
3499
|
width: item.width,
|
|
3496
3500
|
height: item.height,
|
|
@@ -3501,9 +3505,10 @@
|
|
|
3501
3505
|
};
|
|
3502
3506
|
});
|
|
3503
3507
|
var startIndex = previewImages.findIndex(function (item) { return item.key === _this.element.key; });
|
|
3504
|
-
|
|
3508
|
+
var config = {
|
|
3505
3509
|
startIndex: startIndex
|
|
3506
|
-
}
|
|
3510
|
+
};
|
|
3511
|
+
this.thyImageService.preview(previewImages, config);
|
|
3507
3512
|
}
|
|
3508
3513
|
$event.stopPropagation();
|
|
3509
3514
|
};
|