@firestitch/block-editor 12.3.3 → 12.3.5
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/components/block/block.component.d.ts +18 -9
- package/app/interfaces/block.d.ts +4 -1
- package/app/services/block-editor.service.d.ts +4 -1
- package/bundles/firestitch-block-editor.umd.js +195 -73
- package/bundles/firestitch-block-editor.umd.js.map +1 -1
- package/esm2015/app/components/artboard/artboard.component.js +5 -5
- package/esm2015/app/components/block/block.component.js +139 -55
- package/esm2015/app/components/sidebar/sidebar.component.js +2 -2
- package/esm2015/app/interfaces/block.js +1 -1
- package/esm2015/app/services/block-editor.service.js +9 -3
- package/esm2015/app/services/blocks-store.service.js +1 -1
- package/fesm2015/firestitch-block-editor.js +150 -60
- package/fesm2015/firestitch-block-editor.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AfterContentInit, ChangeDetectorRef, ElementRef, OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { FsZoomPanComponent } from '@firestitch/zoom-pan';
|
|
3
3
|
import Moveable from 'moveable';
|
|
4
|
-
import { BlockEditorService } from './../../services';
|
|
4
|
+
import { BlockEditorService, GoogleFontService } from './../../services';
|
|
5
5
|
import { Block } from './../../interfaces';
|
|
6
6
|
import { BlockType } from '../../enums';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
@@ -9,6 +9,7 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
|
|
|
9
9
|
private _blockEditor;
|
|
10
10
|
private _elementRef;
|
|
11
11
|
private _cdRef;
|
|
12
|
+
private _googleFontService;
|
|
12
13
|
element: ElementRef;
|
|
13
14
|
contentElement: ElementRef;
|
|
14
15
|
contentEditable: ElementRef;
|
|
@@ -17,26 +18,32 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
|
|
|
17
18
|
zoompan: FsZoomPanComponent;
|
|
18
19
|
transformating: boolean;
|
|
19
20
|
unit: any;
|
|
20
|
-
content: string;
|
|
21
21
|
BlockType: typeof BlockType;
|
|
22
22
|
private _moveable;
|
|
23
23
|
private _editable;
|
|
24
24
|
private _transformable;
|
|
25
25
|
private _destroy$;
|
|
26
|
-
constructor(_blockEditor: BlockEditorService, _elementRef: ElementRef, _cdRef: ChangeDetectorRef);
|
|
26
|
+
constructor(_blockEditor: BlockEditorService, _elementRef: ElementRef, _cdRef: ChangeDetectorRef, _googleFontService: GoogleFontService);
|
|
27
27
|
get el(): any;
|
|
28
28
|
get moveable(): Moveable;
|
|
29
29
|
get editable(): any;
|
|
30
|
-
get
|
|
30
|
+
get styleTop(): string;
|
|
31
|
+
get styleLeft(): string;
|
|
32
|
+
get styleWidth(): string;
|
|
33
|
+
get styleHeight(): string;
|
|
34
|
+
get styleImageHeight(): string;
|
|
35
|
+
get styleImageWidth(): string;
|
|
36
|
+
get styleImageTop(): string;
|
|
37
|
+
get styleImageLeft(): string;
|
|
38
|
+
get styleClipPath(): string;
|
|
39
|
+
get styleBoxShadow(): string;
|
|
31
40
|
set elementGuidelines(value: any);
|
|
32
41
|
set editable(value: any);
|
|
33
|
-
|
|
42
|
+
get isSelected(): boolean;
|
|
43
|
+
get clippable(): boolean;
|
|
44
|
+
set clippable(value: boolean);
|
|
34
45
|
get transformable(): boolean;
|
|
35
46
|
set transformable(value: boolean);
|
|
36
|
-
set width(value: any);
|
|
37
|
-
set height(value: any);
|
|
38
|
-
set top(value: any);
|
|
39
|
-
set left(value: any);
|
|
40
47
|
set rotate(value: any);
|
|
41
48
|
set index(value: any);
|
|
42
49
|
set keepRatio(value: any);
|
|
@@ -45,6 +52,7 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
|
|
|
45
52
|
ngAfterContentInit(): void;
|
|
46
53
|
pxToIn(px: any): number;
|
|
47
54
|
round(value: any, decimals: any): number;
|
|
55
|
+
select(): void;
|
|
48
56
|
deselect(): void;
|
|
49
57
|
disableContentEdit(): void;
|
|
50
58
|
deselectContent(): void;
|
|
@@ -55,6 +63,7 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
|
|
|
55
63
|
private _updateElementGuidelines;
|
|
56
64
|
private _initMoveable;
|
|
57
65
|
private _initEvents;
|
|
66
|
+
private _initFonts;
|
|
58
67
|
static ɵfac: i0.ɵɵFactoryDeclaration<FsBlockComponent, never>;
|
|
59
68
|
static ɵcmp: i0.ɵɵComponentDeclaration<FsBlockComponent, "fs-block", never, { "block": "block"; "html": "html"; "zoompan": "zoompan"; }, {}, never, never>;
|
|
60
69
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OnDestroy } from '@angular/core';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
2
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
3
3
|
import { FsFile } from '@firestitch/file';
|
|
4
4
|
import { FsDialog } from '@firestitch/dialog';
|
|
5
5
|
import { BlocksStore } from './blocks-store.service';
|
|
@@ -16,6 +16,7 @@ export declare class BlockEditorService implements OnDestroy {
|
|
|
16
16
|
private _selectedBlocks$;
|
|
17
17
|
private _selectionRange;
|
|
18
18
|
private _blockComponents;
|
|
19
|
+
private _blockClippable$;
|
|
19
20
|
private _destroy$;
|
|
20
21
|
private _blockInited$;
|
|
21
22
|
constructor(_store: BlocksStore, _dialog: FsDialog);
|
|
@@ -28,6 +29,8 @@ export declare class BlockEditorService implements OnDestroy {
|
|
|
28
29
|
removeSelectedBlocks(): void;
|
|
29
30
|
get blocks$(): Observable<Block[]>;
|
|
30
31
|
get blockChanged$(): Observable<Block>;
|
|
32
|
+
get blockClippable$(): BehaviorSubject<boolean>;
|
|
33
|
+
set blockClippable(value: any);
|
|
31
34
|
get blockAdded$(): Observable<Block>;
|
|
32
35
|
get blockInited$(): Observable<Block>;
|
|
33
36
|
get blockRemoved$(): Observable<Block>;
|
|
@@ -662,6 +662,7 @@
|
|
|
662
662
|
this._dialog = _dialog;
|
|
663
663
|
this._selectedBlocks$ = new rxjs.BehaviorSubject([]);
|
|
664
664
|
this._blockComponents = new Map();
|
|
665
|
+
this._blockClippable$ = new rxjs.BehaviorSubject(null);
|
|
665
666
|
this._destroy$ = new rxjs.Subject();
|
|
666
667
|
this._blockInited$ = new rxjs.Subject();
|
|
667
668
|
}
|
|
@@ -718,6 +719,20 @@
|
|
|
718
719
|
enumerable: false,
|
|
719
720
|
configurable: true
|
|
720
721
|
});
|
|
722
|
+
Object.defineProperty(BlockEditorService.prototype, "blockClippable$", {
|
|
723
|
+
get: function () {
|
|
724
|
+
return this._blockClippable$;
|
|
725
|
+
},
|
|
726
|
+
enumerable: false,
|
|
727
|
+
configurable: true
|
|
728
|
+
});
|
|
729
|
+
Object.defineProperty(BlockEditorService.prototype, "blockClippable", {
|
|
730
|
+
set: function (value) {
|
|
731
|
+
this._blockClippable$.next(value);
|
|
732
|
+
},
|
|
733
|
+
enumerable: false,
|
|
734
|
+
configurable: true
|
|
735
|
+
});
|
|
721
736
|
Object.defineProperty(BlockEditorService.prototype, "blockAdded$", {
|
|
722
737
|
get: function () {
|
|
723
738
|
return this._store.blockAdded$;
|
|
@@ -784,9 +799,8 @@
|
|
|
784
799
|
set: function (blocks) {
|
|
785
800
|
this.blockComponents
|
|
786
801
|
.forEach(function (blockComponent) {
|
|
787
|
-
blockComponent.editable = false;
|
|
788
802
|
if (blocks.indexOf(blockComponent.block) !== -1) {
|
|
789
|
-
blockComponent.
|
|
803
|
+
blockComponent.select();
|
|
790
804
|
}
|
|
791
805
|
else {
|
|
792
806
|
blockComponent.deselect();
|
|
@@ -896,10 +910,11 @@
|
|
|
896
910
|
}], ctorParameters: function () { return [{ type: i1__namespace$1.HttpClient }]; } });
|
|
897
911
|
|
|
898
912
|
var FsBlockComponent = /** @class */ (function () {
|
|
899
|
-
function FsBlockComponent(_blockEditor, _elementRef, _cdRef) {
|
|
913
|
+
function FsBlockComponent(_blockEditor, _elementRef, _cdRef, _googleFontService) {
|
|
900
914
|
this._blockEditor = _blockEditor;
|
|
901
915
|
this._elementRef = _elementRef;
|
|
902
916
|
this._cdRef = _cdRef;
|
|
917
|
+
this._googleFontService = _googleFontService;
|
|
903
918
|
this.transformating = false;
|
|
904
919
|
this.BlockType = exports.BlockType;
|
|
905
920
|
this._editable = false;
|
|
@@ -933,75 +948,157 @@
|
|
|
933
948
|
enumerable: false,
|
|
934
949
|
configurable: true
|
|
935
950
|
});
|
|
936
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
951
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleTop", {
|
|
937
952
|
get: function () {
|
|
938
|
-
|
|
939
|
-
|
|
953
|
+
var top = this.block.top;
|
|
954
|
+
return "" + top + this.unit;
|
|
955
|
+
},
|
|
956
|
+
enumerable: false,
|
|
957
|
+
configurable: true
|
|
958
|
+
});
|
|
959
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleLeft", {
|
|
960
|
+
get: function () {
|
|
961
|
+
var left = this.block.left;
|
|
962
|
+
return "" + left + this.unit;
|
|
963
|
+
},
|
|
964
|
+
enumerable: false,
|
|
965
|
+
configurable: true
|
|
966
|
+
});
|
|
967
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleWidth", {
|
|
968
|
+
get: function () {
|
|
969
|
+
var width = this.block.width;
|
|
970
|
+
if (this.block.clipPath) {
|
|
971
|
+
width -= (this.block.width * this.block.clipPath.values[1] / 100) + (this.block.width * this.block.clipPath.values[3] / 100);
|
|
940
972
|
}
|
|
941
|
-
|
|
942
|
-
var shadow = this.block.shadowX + "pt " + (this.block.shadowY || 0) + "pt " + (this.block.shadowBlur || 0) + "pt " + (this.block.shadowSpread || 0) + "pt " + this.block.shadowColor;
|
|
943
|
-
return shadow;
|
|
973
|
+
return "" + width + this.unit;
|
|
944
974
|
},
|
|
945
975
|
enumerable: false,
|
|
946
976
|
configurable: true
|
|
947
977
|
});
|
|
948
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
949
|
-
|
|
950
|
-
this.
|
|
978
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleHeight", {
|
|
979
|
+
get: function () {
|
|
980
|
+
var height = this.block.height;
|
|
981
|
+
if (this.block.clipPath) {
|
|
982
|
+
height -= (this.block.height * this.block.clipPath.values[0] / 100) + (this.block.height * this.block.clipPath.values[2] / 100);
|
|
983
|
+
}
|
|
984
|
+
return "" + height + this.unit;
|
|
951
985
|
},
|
|
952
986
|
enumerable: false,
|
|
953
987
|
configurable: true
|
|
954
988
|
});
|
|
955
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
956
|
-
|
|
957
|
-
this.
|
|
989
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleImageHeight", {
|
|
990
|
+
get: function () {
|
|
991
|
+
var height = this.block.height;
|
|
992
|
+
if (this.block.clipPath) {
|
|
993
|
+
var values = this.block.clipPath.values || {};
|
|
994
|
+
//height += (values[0]/100 * height) + (values[2]/100 * height);
|
|
995
|
+
}
|
|
996
|
+
return "" + height + this.unit;
|
|
958
997
|
},
|
|
959
998
|
enumerable: false,
|
|
960
999
|
configurable: true
|
|
961
1000
|
});
|
|
962
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
1001
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleImageWidth", {
|
|
963
1002
|
get: function () {
|
|
964
|
-
|
|
1003
|
+
var width = this.block.width;
|
|
1004
|
+
if (this.block.clipPath) {
|
|
1005
|
+
var values = this.block.clipPath.values || {};
|
|
1006
|
+
//width += (values[1]/100 * width) + (values[3]/100 * width);
|
|
1007
|
+
}
|
|
1008
|
+
return "" + width + this.unit;
|
|
965
1009
|
},
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1010
|
+
enumerable: false,
|
|
1011
|
+
configurable: true
|
|
1012
|
+
});
|
|
1013
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleImageTop", {
|
|
1014
|
+
get: function () {
|
|
1015
|
+
var top = 0;
|
|
1016
|
+
if (this.block.clipPath) {
|
|
1017
|
+
var values = this.block.clipPath.values || {};
|
|
1018
|
+
top = (values[0] / 100) * this.block.width * -1;
|
|
1019
|
+
}
|
|
1020
|
+
return "" + top + this.unit;
|
|
971
1021
|
},
|
|
972
1022
|
enumerable: false,
|
|
973
1023
|
configurable: true
|
|
974
1024
|
});
|
|
975
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
this.
|
|
1025
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleImageLeft", {
|
|
1026
|
+
get: function () {
|
|
1027
|
+
var left = 0;
|
|
1028
|
+
if (this.block.clipPath) {
|
|
1029
|
+
var values = this.block.clipPath.values || {};
|
|
1030
|
+
left = (values[3] / 100) * this.block.width * -1;
|
|
1031
|
+
}
|
|
1032
|
+
return "" + left + this.unit;
|
|
1033
|
+
},
|
|
1034
|
+
enumerable: false,
|
|
1035
|
+
configurable: true
|
|
1036
|
+
});
|
|
1037
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleClipPath", {
|
|
1038
|
+
get: function () {
|
|
1039
|
+
if (!this.block.clipPath) {
|
|
1040
|
+
return null;
|
|
1041
|
+
}
|
|
1042
|
+
var values = this.block.clipPath.values || {};
|
|
1043
|
+
var top = values[0] / 100 * this.block.height;
|
|
1044
|
+
var right = (values[1]) / 100 * this.block.width;
|
|
1045
|
+
var bottom = (values[2]) / 100 * this.block.height;
|
|
1046
|
+
var left = values[3] / 100 * this.block.width;
|
|
1047
|
+
var clipPath = "inset(" + top + this.unit + " " + right + this.unit + " " + bottom + this.unit + " " + left + this.unit + ")";
|
|
1048
|
+
return clipPath;
|
|
1049
|
+
},
|
|
1050
|
+
enumerable: false,
|
|
1051
|
+
configurable: true
|
|
1052
|
+
});
|
|
1053
|
+
Object.defineProperty(FsBlockComponent.prototype, "styleBoxShadow", {
|
|
1054
|
+
get: function () {
|
|
1055
|
+
if (!this.block.shadowColor) {
|
|
1056
|
+
return null;
|
|
1057
|
+
}
|
|
1058
|
+
var shadow = this.block.shadowX + "pt " + (this.block.shadowY || 0) + "pt " + (this.block.shadowBlur || 0) + "pt " + (this.block.shadowSpread || 0) + "pt " + this.block.shadowColor;
|
|
1059
|
+
return shadow;
|
|
979
1060
|
},
|
|
980
1061
|
enumerable: false,
|
|
981
1062
|
configurable: true
|
|
982
1063
|
});
|
|
983
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
1064
|
+
Object.defineProperty(FsBlockComponent.prototype, "elementGuidelines", {
|
|
984
1065
|
set: function (value) {
|
|
985
|
-
this.
|
|
986
|
-
this.moveable.updateRect();
|
|
1066
|
+
this.moveable.elementGuidelines = value;
|
|
987
1067
|
},
|
|
988
1068
|
enumerable: false,
|
|
989
1069
|
configurable: true
|
|
990
1070
|
});
|
|
991
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
1071
|
+
Object.defineProperty(FsBlockComponent.prototype, "isSelected", {
|
|
1072
|
+
get: function () {
|
|
1073
|
+
return this._blockEditor.selectedBlocks.includes(this.block);
|
|
1074
|
+
},
|
|
1075
|
+
enumerable: false,
|
|
1076
|
+
configurable: true
|
|
1077
|
+
});
|
|
1078
|
+
Object.defineProperty(FsBlockComponent.prototype, "clippable", {
|
|
1079
|
+
get: function () {
|
|
1080
|
+
return !!this.moveable.clippable;
|
|
1081
|
+
},
|
|
992
1082
|
set: function (value) {
|
|
993
|
-
this.
|
|
994
|
-
|
|
995
|
-
|
|
1083
|
+
this.moveable.clippable = value;
|
|
1084
|
+
if (this.isSelected) {
|
|
1085
|
+
this.moveable.resizable = !value;
|
|
1086
|
+
this.moveable.rotatable = !value;
|
|
1087
|
+
this.moveable.scalable = !value;
|
|
1088
|
+
}
|
|
996
1089
|
},
|
|
997
1090
|
enumerable: false,
|
|
998
1091
|
configurable: true
|
|
999
1092
|
});
|
|
1000
|
-
Object.defineProperty(FsBlockComponent.prototype, "
|
|
1093
|
+
Object.defineProperty(FsBlockComponent.prototype, "transformable", {
|
|
1094
|
+
get: function () {
|
|
1095
|
+
return this._transformable;
|
|
1096
|
+
},
|
|
1001
1097
|
set: function (value) {
|
|
1002
|
-
this.
|
|
1003
|
-
this.
|
|
1004
|
-
this.moveable.
|
|
1098
|
+
this._transformable = value;
|
|
1099
|
+
this.moveable.resizable = value;
|
|
1100
|
+
this.moveable.rotatable = value;
|
|
1101
|
+
this.moveable.scalable = value;
|
|
1005
1102
|
},
|
|
1006
1103
|
enumerable: false,
|
|
1007
1104
|
configurable: true
|
|
@@ -1034,18 +1131,19 @@
|
|
|
1034
1131
|
FsBlockComponent.prototype.ngOnInit = function () {
|
|
1035
1132
|
var _this = this;
|
|
1036
1133
|
this.unit = this._blockEditor.config.unit;
|
|
1037
|
-
this.content = this.block.content;
|
|
1038
1134
|
this.block.shadowOpacity = this.block.shadowOpacity || 100;
|
|
1135
|
+
this._initFonts();
|
|
1136
|
+
this._blockEditor.blockClippable$
|
|
1137
|
+
.pipe(operators.filter(function () { return _this.isSelected; }), operators.takeUntil(this._destroy$))
|
|
1138
|
+
.subscribe(function (clippable) {
|
|
1139
|
+
_this.clippable = clippable;
|
|
1140
|
+
_this._cdRef.markForCheck();
|
|
1141
|
+
});
|
|
1039
1142
|
this._blockEditor.blockChanged$
|
|
1040
1143
|
.pipe(operators.filter(function (block) { return block === _this.block; }), operators.takeUntil(this._destroy$))
|
|
1041
1144
|
.subscribe(function (block) {
|
|
1042
1145
|
_this.keepRatio = block.keepRatio;
|
|
1043
|
-
_this.width = block.width;
|
|
1044
|
-
_this.height = block.height;
|
|
1045
|
-
_this.top = block.top;
|
|
1046
|
-
_this.left = block.left;
|
|
1047
1146
|
_this.rotate = _this.block.rotate;
|
|
1048
|
-
_this.clippable = _this.block.clippable;
|
|
1049
1147
|
_this._cdRef.markForCheck();
|
|
1050
1148
|
});
|
|
1051
1149
|
};
|
|
@@ -1055,10 +1153,6 @@
|
|
|
1055
1153
|
_this._initEvents();
|
|
1056
1154
|
_this._initMoveable();
|
|
1057
1155
|
_this._setTransform();
|
|
1058
|
-
_this.width = _this.block.width;
|
|
1059
|
-
_this.height = _this.block.height;
|
|
1060
|
-
_this.top = _this.block.top;
|
|
1061
|
-
_this.left = _this.block.left;
|
|
1062
1156
|
_this.rotate = _this.block.rotate;
|
|
1063
1157
|
_this._blockEditor.initBlock(_this.block, _this);
|
|
1064
1158
|
_this._blockEditor.blockInited$
|
|
@@ -1074,7 +1168,12 @@
|
|
|
1074
1168
|
FsBlockComponent.prototype.round = function (value, decimals) {
|
|
1075
1169
|
return parseFloat(value.toFixed(decimals));
|
|
1076
1170
|
};
|
|
1171
|
+
FsBlockComponent.prototype.select = function () {
|
|
1172
|
+
this.transformable = true;
|
|
1173
|
+
};
|
|
1077
1174
|
FsBlockComponent.prototype.deselect = function () {
|
|
1175
|
+
this.editable = false;
|
|
1176
|
+
this.clippable = false;
|
|
1078
1177
|
this.transformable = false;
|
|
1079
1178
|
this.disableContentEdit();
|
|
1080
1179
|
};
|
|
@@ -1106,9 +1205,6 @@
|
|
|
1106
1205
|
FsBlockComponent.prototype._setTransform = function (transforms) {
|
|
1107
1206
|
if (transforms === void 0) { transforms = []; }
|
|
1108
1207
|
transforms = transforms !== null && transforms !== void 0 ? transforms : [];
|
|
1109
|
-
if (this.block.rotate) {
|
|
1110
|
-
transforms.push("rotate(" + this.block.rotate + "deg)");
|
|
1111
|
-
}
|
|
1112
1208
|
this.el.style.transform = transforms.join(' ');
|
|
1113
1209
|
};
|
|
1114
1210
|
FsBlockComponent.prototype._triggerChanged = function () {
|
|
@@ -1131,6 +1227,8 @@
|
|
|
1131
1227
|
rotatable: false,
|
|
1132
1228
|
warpable: false,
|
|
1133
1229
|
origin: false,
|
|
1230
|
+
clipRelative: true,
|
|
1231
|
+
clipArea: true,
|
|
1134
1232
|
keepRatio: this.block.keepRatio,
|
|
1135
1233
|
snappable: true,
|
|
1136
1234
|
snapDirections: { left: true, top: true, right: true, bottom: true, center: true, middle: true },
|
|
@@ -1145,9 +1243,24 @@
|
|
|
1145
1243
|
this._updateElementGuidelines();
|
|
1146
1244
|
this.moveable
|
|
1147
1245
|
.on('clip', function (e) {
|
|
1148
|
-
_this.
|
|
1246
|
+
_this.moveable.keepRatio = false;
|
|
1149
1247
|
e.target.style.clipPath = e.clipStyle;
|
|
1248
|
+
_this.block.clipPath = {
|
|
1249
|
+
type: 'inset',
|
|
1250
|
+
values: e.clipStyles
|
|
1251
|
+
.map(function (value) {
|
|
1252
|
+
var number = Number(value.replace('%', ''));
|
|
1253
|
+
return number > 0 ? number : 0;
|
|
1254
|
+
}),
|
|
1255
|
+
};
|
|
1256
|
+
})
|
|
1257
|
+
.on('clipEnd', function (e) {
|
|
1258
|
+
_this.moveable.keepRatio = true;
|
|
1259
|
+
e.target.style.clipPath = null;
|
|
1150
1260
|
_this._triggerChanged();
|
|
1261
|
+
setTimeout(function () {
|
|
1262
|
+
_this.moveable.updateRect();
|
|
1263
|
+
}, 100);
|
|
1151
1264
|
})
|
|
1152
1265
|
.on('dragStart', function () {
|
|
1153
1266
|
_this.disableContentEdit();
|
|
@@ -1160,10 +1273,10 @@
|
|
|
1160
1273
|
target.style.top = _this.pxToIn(top) + _this.unit;
|
|
1161
1274
|
_this.block.top = _this.pxToIn(top);
|
|
1162
1275
|
_this.block.left = _this.pxToIn(left);
|
|
1163
|
-
_this._triggerChanged();
|
|
1164
1276
|
})
|
|
1165
1277
|
.on('dragEnd', function () {
|
|
1166
1278
|
_this.transformating = false;
|
|
1279
|
+
_this._triggerChanged();
|
|
1167
1280
|
_this._cdRef.markForCheck();
|
|
1168
1281
|
})
|
|
1169
1282
|
.on('resizeStart', function () {
|
|
@@ -1192,20 +1305,22 @@
|
|
|
1192
1305
|
transform[0] = dist[0] * -1;
|
|
1193
1306
|
}
|
|
1194
1307
|
_this._setTransform(["translate(" + transform[0] + "px, " + transform[1] + "px)"]);
|
|
1195
|
-
_this._triggerChanged();
|
|
1196
1308
|
})
|
|
1197
1309
|
.on('resizeEnd', function (_a) {
|
|
1198
1310
|
var target = _a.target;
|
|
1199
1311
|
var matrix = new WebKitCSSMatrix(target.style.transform);
|
|
1200
1312
|
_this.block.top = parseFloat(target.style.top) + _this.pxToIn(matrix.m42);
|
|
1201
1313
|
_this.block.left = parseFloat(target.style.left) + _this.pxToIn(matrix.m41);
|
|
1202
|
-
target.style.top = _this.block.top + _this.unit;
|
|
1203
|
-
target.style.left = _this.block.left + _this.unit;
|
|
1204
1314
|
_this._setTransform();
|
|
1205
1315
|
_this._triggerChanged();
|
|
1206
1316
|
_this.zoompan.enable();
|
|
1207
1317
|
_this.transformating = false;
|
|
1208
1318
|
_this._cdRef.markForCheck();
|
|
1319
|
+
target.style.top = _this.block.top + "in";
|
|
1320
|
+
target.style.left = _this.block.left + "in";
|
|
1321
|
+
target.style.width = _this.block.width + "in";
|
|
1322
|
+
target.style.height = _this.block.height + "in";
|
|
1323
|
+
_this.moveable.updateRect();
|
|
1209
1324
|
})
|
|
1210
1325
|
.on('rotateStart', function (_a) {
|
|
1211
1326
|
var inputEvent = _a.inputEvent;
|
|
@@ -1221,7 +1336,6 @@
|
|
|
1221
1336
|
_this.el.style.transform = transform;
|
|
1222
1337
|
_this.block.rotate = rotation % 360;
|
|
1223
1338
|
if (inputEvent) {
|
|
1224
|
-
_this._triggerChanged();
|
|
1225
1339
|
_this.zoompan.enable();
|
|
1226
1340
|
}
|
|
1227
1341
|
})
|
|
@@ -1230,6 +1344,7 @@
|
|
|
1230
1344
|
if (inputEvent) {
|
|
1231
1345
|
_this.transformating = false;
|
|
1232
1346
|
_this._cdRef.markForCheck();
|
|
1347
|
+
_this._triggerChanged();
|
|
1233
1348
|
}
|
|
1234
1349
|
});
|
|
1235
1350
|
};
|
|
@@ -1237,21 +1352,23 @@
|
|
|
1237
1352
|
var _this = this;
|
|
1238
1353
|
rxjs.fromEvent(this.contentEditable.nativeElement, 'input')
|
|
1239
1354
|
.pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
|
|
1240
|
-
_this.block.content = event.target.
|
|
1355
|
+
_this.block.content = event.target.innerText;
|
|
1241
1356
|
_this._triggerChanged();
|
|
1242
1357
|
});
|
|
1243
1358
|
rxjs.fromEvent(this.el, 'mousedown')
|
|
1244
1359
|
.pipe(operators.takeUntil(this._destroy$)).subscribe(function (event) {
|
|
1245
1360
|
_this.zoompan.disable();
|
|
1246
|
-
if (_this.
|
|
1247
|
-
if (_this.
|
|
1248
|
-
event.
|
|
1249
|
-
|
|
1250
|
-
|
|
1361
|
+
if (!_this.moveable.clippable) {
|
|
1362
|
+
if (_this.editable) {
|
|
1363
|
+
if (_this.contentElement.nativeElement.isSameNode(event.target)) {
|
|
1364
|
+
event.preventDefault();
|
|
1365
|
+
event.stopImmediatePropagation();
|
|
1366
|
+
event.stopPropagation();
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
else {
|
|
1370
|
+
_this._blockEditor.selectedBlock = _this.block;
|
|
1251
1371
|
}
|
|
1252
|
-
}
|
|
1253
|
-
else {
|
|
1254
|
-
_this._blockEditor.selectedBlock = _this.block;
|
|
1255
1372
|
}
|
|
1256
1373
|
});
|
|
1257
1374
|
rxjs.fromEvent(this.el, 'mouseup')
|
|
@@ -1273,10 +1390,15 @@
|
|
|
1273
1390
|
}
|
|
1274
1391
|
});
|
|
1275
1392
|
};
|
|
1393
|
+
FsBlockComponent.prototype._initFonts = function () {
|
|
1394
|
+
if (this.block.fontFamily) {
|
|
1395
|
+
this._googleFontService.loadFont({ family: this.block.fontFamily });
|
|
1396
|
+
}
|
|
1397
|
+
};
|
|
1276
1398
|
return FsBlockComponent;
|
|
1277
1399
|
}());
|
|
1278
|
-
FsBlockComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, deps: [{ token: BlockEditorService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1279
|
-
FsBlockComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html", zoompan: "zoompan" }, host: { properties: { "class.transforming": "this.transformating" } }, viewQueries: [{ propertyName: "element", first: true, predicate: ["element"], descendants: true, static: true }, { propertyName: "contentElement", first: true, predicate: ["contentElement"], descendants: true, static: true }, { propertyName: "contentEditable", first: true, predicate: ["contentEditable"], descendants: true, static: true }], ngImport: i0__namespace, template: "<div\n #element\n [class]=\"'block ' + 'block-' + block.type\"\n [ngClass]=\"{ \n editable: editable, \n readonly: block.readonly,\n required: block.required\n }\"\n [style.zIndex]=\"block.index\">\n <div\n #contentElement\n class=\"content\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontFamily]=\"block.fontFamily || ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + 'pt' : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + 'pt' : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + 'pt' : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + 'pt' : ''\"\n [style.
|
|
1400
|
+
FsBlockComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, deps: [{ token: BlockEditorService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: GoogleFontService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1401
|
+
FsBlockComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html", zoompan: "zoompan" }, host: { properties: { "class.transforming": "this.transformating" } }, viewQueries: [{ propertyName: "element", first: true, predicate: ["element"], descendants: true, static: true }, { propertyName: "contentElement", first: true, predicate: ["contentElement"], descendants: true, static: true }, { propertyName: "contentEditable", first: true, predicate: ["contentEditable"], descendants: true, static: true }], ngImport: i0__namespace, template: "<div\n #element\n [class]=\"'block ' + 'block-' + block.type\"\n [style.top]=\"styleTop\"\n [style.left]=\"styleLeft\"\n [style.width]=\"styleWidth\"\n [style.height]=\"styleHeight\"\n [ngClass]=\"{ \n editable: editable, \n readonly: block.readonly,\n required: block.required\n }\"\n [style.zIndex]=\"block.index\">\n <div\n #contentElement\n class=\"content\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontFamily]=\"block.fontFamily || ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + 'pt' : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + 'pt' : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + 'pt' : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + 'pt' : ''\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + 'pt' : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + 'pt' : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + 'pt' : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + 'pt' : ''\"\n [style.boxShadow]=\"styleBoxShadow\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <ng-container [ngSwitch]=\"block.type\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <img [src]=\"block.imageUrl\">\n </ng-container>\n <img \n *ngIf=\"block.imageUrl\" \n [style.clipPath]=\"styleClipPath\" \n [style.height]=\"styleImageHeight\" \n [style.width]=\"styleImageWidth\" \n [style.top]=\"styleImageTop\" \n [style.left]=\"styleImageLeft\" \n [src]=\"block.imageUrl\">\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n {{block.label || block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"block.content\">\n </div>\n </div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}:host.transforming ::ng-deep .moveable-control,:host.transforming ::ng-deep .moveable-rotation{display:none}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none;cursor:pointer}.block.block-shorttext,.block.block-longtext,.block.block-date,.block.block-radiobutton,.block.block-signature,.block.block-checkbox{background-color:#aab5e1cc;color:#585555;font-size:12px}.block.block-radiobutton{border-radius:50%}.block.required{background-color:#f7adaa}.block .content-editable{outline:none;position:relative}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:0px solid transparent;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:none!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:transparent!important}\n"], directives: [{ type: i13__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i13__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i13__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1280
1402
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FsBlockComponent, decorators: [{
|
|
1281
1403
|
type: i0.Component,
|
|
1282
1404
|
args: [{
|
|
@@ -1285,7 +1407,7 @@
|
|
|
1285
1407
|
styleUrls: ['block.component.scss'],
|
|
1286
1408
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1287
1409
|
}]
|
|
1288
|
-
}], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { element: [{
|
|
1410
|
+
}], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: GoogleFontService }]; }, propDecorators: { element: [{
|
|
1289
1411
|
type: i0.ViewChild,
|
|
1290
1412
|
args: ['element', { static: true }]
|
|
1291
1413
|
}], contentElement: [{
|
|
@@ -1478,7 +1600,7 @@
|
|
|
1478
1600
|
};
|
|
1479
1601
|
SidebarComponent.prototype.imageClip = function () {
|
|
1480
1602
|
this.clippable = !this.clippable;
|
|
1481
|
-
this._blockEditor.
|
|
1603
|
+
this._blockEditor.blockClippable = true;
|
|
1482
1604
|
};
|
|
1483
1605
|
SidebarComponent.prototype.blockChangeProperty = function (value, name) {
|
|
1484
1606
|
this._blockEditor.selectedBlockComponentChangeProperty(value, name);
|
|
@@ -1662,16 +1784,16 @@
|
|
|
1662
1784
|
.forEach(function (blockComponent) {
|
|
1663
1785
|
switch (event.key) {
|
|
1664
1786
|
case 'ArrowUp':
|
|
1665
|
-
blockComponent.top = blockComponent.block.top - inchPixel;
|
|
1787
|
+
blockComponent.block.top = blockComponent.block.top - inchPixel;
|
|
1666
1788
|
break;
|
|
1667
1789
|
case 'ArrowDown':
|
|
1668
|
-
blockComponent.top = blockComponent.block.top + inchPixel;
|
|
1790
|
+
blockComponent.block.top = blockComponent.block.top + inchPixel;
|
|
1669
1791
|
break;
|
|
1670
1792
|
case 'ArrowLeft':
|
|
1671
|
-
blockComponent.left = blockComponent.block.left - inchPixel;
|
|
1793
|
+
blockComponent.block.left = blockComponent.block.left - inchPixel;
|
|
1672
1794
|
break;
|
|
1673
1795
|
case 'ArrowRight':
|
|
1674
|
-
blockComponent.left = blockComponent.block.left + inchPixel;
|
|
1796
|
+
blockComponent.block.left = blockComponent.block.left + inchPixel;
|
|
1675
1797
|
break;
|
|
1676
1798
|
}
|
|
1677
1799
|
_this._blockEditor.blockChange(blockComponent.block);
|