@firestitch/block-editor 12.3.21 → 12.3.22
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/app/services/block-editor.service.d.ts +1 -1
- package/app/services/blocks-store.service.d.ts +1 -1
- package/bundles/firestitch-block-editor.umd.js +16 -12
- package/bundles/firestitch-block-editor.umd.js.map +1 -1
- package/esm2015/app/components/block/block.component.js +3 -2
- package/esm2015/app/components/sidebar/sidebar.component.js +4 -3
- package/esm2015/app/services/block-editor.service.js +2 -2
- package/esm2015/app/services/blocks-store.service.js +13 -11
- package/fesm2015/firestitch-block-editor.js +17 -13
- package/fesm2015/firestitch-block-editor.js.map +1 -1
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ export declare class BlockEditorService implements OnDestroy {
|
|
|
24
24
|
get selectedComponentBlocks(): FsBlockComponent[];
|
|
25
25
|
init(config: BlockEditorConfig): void;
|
|
26
26
|
blockAdd(block: Block): void;
|
|
27
|
-
blockUpload(block: Block, fsFile: FsFile):
|
|
27
|
+
blockUpload(block: Block, fsFile: FsFile): Observable<Block>;
|
|
28
28
|
blockRemove(block: Block): void;
|
|
29
29
|
removeSelectedBlocks(): void;
|
|
30
30
|
get blocks$(): Observable<Block[]>;
|
|
@@ -19,7 +19,7 @@ export declare class BlocksStore implements OnDestroy {
|
|
|
19
19
|
init(config: BlockEditorConfig): void;
|
|
20
20
|
blockExists(block: Block): boolean;
|
|
21
21
|
blockAdd(block: Block): void;
|
|
22
|
-
blockUpload(block: Block, fsFile: FsFile):
|
|
22
|
+
blockUpload(block: Block, fsFile: FsFile): Observable<Block>;
|
|
23
23
|
blockChange(block: Block): void;
|
|
24
24
|
blockRemove(targetBlocks: Block | Block[]): void;
|
|
25
25
|
isReordableBlock(block: Block): boolean;
|
|
@@ -604,12 +604,13 @@
|
|
|
604
604
|
BlocksStore.prototype.blockUpload = function (block, fsFile) {
|
|
605
605
|
var _this = this;
|
|
606
606
|
if (!this._config.blockUpload) {
|
|
607
|
-
|
|
608
|
-
return;
|
|
607
|
+
return rxjs.throwError('[BlockEditor] Config "blockUpload" is not defined');
|
|
609
608
|
}
|
|
610
609
|
var existing = this.blockExists(block);
|
|
611
|
-
|
|
612
|
-
|
|
610
|
+
if (!existing) {
|
|
611
|
+
block = this._createBlock(block);
|
|
612
|
+
}
|
|
613
|
+
return rxjs.from(fsFile.imageInfo)
|
|
613
614
|
.pipe(operators.switchMap(function (imageInfo) {
|
|
614
615
|
if (!existing && (imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.height) && (imageInfo === null || imageInfo === void 0 ? void 0 : imageInfo.width)) {
|
|
615
616
|
var ratio = imageInfo.height / imageInfo.width;
|
|
@@ -617,15 +618,16 @@
|
|
|
617
618
|
block.height = block.width * ratio;
|
|
618
619
|
}
|
|
619
620
|
return _this._config.blockUpload(block, fsFile.file);
|
|
620
|
-
}), operators.
|
|
621
|
-
.subscribe(function (newBlock) {
|
|
621
|
+
}), operators.tap(function (newBlock) {
|
|
622
622
|
if (existing) {
|
|
623
|
-
_this.
|
|
623
|
+
var blocks = _this._blocks$.getValue();
|
|
624
|
+
blocks[blocks.indexOf(block)] = newBlock;
|
|
625
|
+
_this._setBlocks(blocks);
|
|
624
626
|
}
|
|
625
627
|
else {
|
|
626
628
|
_this._appendBlock(newBlock);
|
|
627
629
|
}
|
|
628
|
-
});
|
|
630
|
+
}), operators.takeUntil(this._destroy$));
|
|
629
631
|
};
|
|
630
632
|
BlocksStore.prototype.blockChange = function (block) {
|
|
631
633
|
this._dispatchEvent(EventType.Change, block);
|
|
@@ -756,7 +758,7 @@
|
|
|
756
758
|
this._store.blockAdd(block);
|
|
757
759
|
};
|
|
758
760
|
BlockEditorService.prototype.blockUpload = function (block, fsFile) {
|
|
759
|
-
this._store.blockUpload(block, fsFile);
|
|
761
|
+
return this._store.blockUpload(block, fsFile);
|
|
760
762
|
};
|
|
761
763
|
BlockEditorService.prototype.blockRemove = function (block) {
|
|
762
764
|
this._store.blockRemove(block);
|
|
@@ -1195,8 +1197,9 @@
|
|
|
1195
1197
|
_this._cdRef.markForCheck();
|
|
1196
1198
|
});
|
|
1197
1199
|
this._blockEditor.blockChanged$
|
|
1198
|
-
.pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
|
|
1200
|
+
.pipe(operators.filter(function (block) { return block.guid === _this.block.guid; }), operators.takeUntil(this._destroy$))
|
|
1199
1201
|
.subscribe(function (block) {
|
|
1202
|
+
_this.block = Object.assign(Object.assign({}, _this.block), block);
|
|
1200
1203
|
_this.keepRatio = block.keepRatio;
|
|
1201
1204
|
_this.rotate = _this.block.rotate;
|
|
1202
1205
|
_this._updateMoveable();
|
|
@@ -1700,8 +1703,9 @@
|
|
|
1700
1703
|
}
|
|
1701
1704
|
};
|
|
1702
1705
|
SidebarComponent.prototype.blockUpload = function (block, fsFile) {
|
|
1703
|
-
this._blockEditor
|
|
1704
|
-
.
|
|
1706
|
+
this._blockEditor.blockUpload(block, fsFile)
|
|
1707
|
+
.subscribe(function (newBlock) {
|
|
1708
|
+
});
|
|
1705
1709
|
};
|
|
1706
1710
|
SidebarComponent.prototype.blockAdd = function (type) {
|
|
1707
1711
|
if (type === exports.BlockType.Pdf || type === exports.BlockType.Image) {
|